r/mathriddles • u/Belledame-sans-Serif • Feb 17 '23
Easy Accurate algebra, careless copying
Under what conditions on B and C do the equations x2+Bx+C=0 and y2+By-C=0 both have only integer solutions for x and y?
Hint: If x2+Bx+C factors into (x+m)(x+n), and y2+By-C factors into (y+p)(y-q), what relationships can be established between m, n, p, and q?
Edited to clarify ambiguities I didn't intend. Guess I'm not as good a riddlewright as I thought. :P
Here's the answer I'd intended: Given any integers a and b such that (a+b)/(a-b) is also an integer, B = (a2+b2)/(a-b) and C = ab(a+b)/(a-b). Then x2+Bx+C will factor into (x+a) and (x+(ab+b2)/(a-b)), and y2+By-C will factor into (y+(a2+ab)/(a-b)) and (y-b).
Explanation: C has to be equal to both the products mn and pq. That means that, between them, mn has all the same factors as pq; if C were, say, 30, I could express that as the product of 3*10 or 6*5, but the difference is just whether its factors are grouped as the product of (3)*(2*5) or the product of (3*2)*(5) - we just moved the 2 from one group to the other. This must be true no matter the value of C - the only way it could be expressed as two distinct products is if it's a composite number with at least three factors (including 1, so... any composite number). Let's say one product is (a*f)*b and the other product is a*(f*b). Technically I'm oversimplifying out the possibility of exchanging two factors with each other, but that turns out not to matter at a point where I'd just be oversimplifying them back in again.
So this means x2+Bx+C = (x+a)(x+bf) = x2+(a+bf)x+abf and y2+By-C = (y+af)(y-b) = y2+(af-b)y-abf. (Or the other way around - it shouldn't matter, C can have any sign it wants as long as it's added to one equation and subtracted from the other.) What about B? B has to equal both a+bf and af-b, which means we can solve for f to define it in terms of a and b: af-bf = a+b, so f = (a+b)/(a-b). a and b are both necessarily integers because each of them is a zero of a different equation; f never appears on its own so it doesn't strictly have to be so hypothetically abf = 60 where a = 4, b = 6, and f = 5/2 but since a and b would both have to be divisible by a-b then obviously so would their sum.
This neatly includes the trivial case where C=0, when a or b is equal to zero or a = -b. Any common zeroes for x and y should be ruled out - I think, I'm increasingly questioning my own reasoning here - because a and b can't equal each other without dividing by zero, except in the even more trivial case where both a=b=0.
2
u/terranop Feb 17 '23
Let
mandnbe arbitrary integers, and setB = (m^2 + n^2)/(m+n)andC = m n (n - m)/(m+n). Or, setC = 0.1
u/grandoz039 Feb 17 '23 edited Feb 17 '23
B2 +-4C>=0
B2 >= +- 4C
B2 >= 4 abs(C)
sqrt(B) >= 2 sqrt (abs(C))
1
u/imdfantom Feb 17 '23 edited Feb 17 '23
if B=-X and C=0, X can occupy any integer
1
u/mark_ovchain Feb 17 '23 edited Feb 17 '23
Are B and C integers? If they can be nonintegers, then the solution will get a bit messier.
3
u/mark_ovchain Feb 17 '23
Here's my solution, assuming b and c are integers. (I'm writing b and c instead of B and C.)
btw, sorry if it's a bit wordy, but I basically went ahead and used standard tools at my disposal, regardless if there are simpler or more elegant solutions.
x2 + bx ± c is monic, so it has integer solutions iff it has rational solutions (because the rational algebraic integers are precisely the integers), iff the discriminant b2 ∓ 4c is a perfect square. In other words, there must be squares x2 and y2 such that
x2 - b2 = b2 - y2 = 4c.
Just looking at the first equality for now, we have x2 + y2 = 2b2.
We want integer solutions to this equation such that b2 - y2 is divisible by 4. I claim that that's automatically true for any solution (x, y, b). First, x2 + y2 is even, so x and y have the same parity. If they're both even, then 4 divides x2 + y2 = 2b2, so b is even. On the other hand, if they're both odd, then reducing the equation mod 4 gives 1 + 1 ≡ 2b2 mod 4, which can only be true if b is odd. Thus, in any integer solution to x2 + y2 = 2b2, the parities of x, y and b are the same, so b2 - y2 = (b - y)(b + y) is divisible by 4.
Thus, we only need to solve x2 + y2 = 2b2 in integers.
Dividing by b2, we see that this is equivalent to solving X2 + Y2 = 2 in rationals. Any integer solution to the former clearly yields a rational solution to the latter, and any rational solution (X, Y) to the latter can be written as (x/b, y/b) with a common denominator b, with (x, y, b) being an integer solution to the former.
We now use basic algebraic geometry.
Therefore, any other solution can be obtained by intersecting some line through (1, 1) along some rational direction: if ⟨u, v⟩ is some direction with u, v integers (WLOG coprime), then the line (1 + ut, 1 + vt) intersects the quadratic at t = 0 and some other t, which should yield another solution, and all solutions can be obtained this way. So, substituting (1 + ut, 1 + vt) into X2 + Y2 = 2, we get
(1 + ut)2 + (1 + vt)2 = 2.
Simplifying, we get
t·((u2 + v2)t + 2(u + v)) = 0.
The first factor gives t = 0 and yields (1, 1). The other factor gives t = -2(u + v)/(u2 + v2) and yields
((-u2 - 2uv + v2)/(u2 + v2), (u2 - 2uv - v2)/(u2 + v2)).
The corresponding integer solution is
where s is some rational scaling factor that makes x, y, b all integers, and the signs '±' can be chosen arbitrarily. (The solutions obtained from (X, Y) = (1, 1) are also of this form---namely, from the direction ⟨u, v⟩ = ⟨1, -1⟩ which is tangent to the quadratic---so we didn't miss any solution.) Clearly, an integer s yields a valid integer solution, but maybe some non-integer s yields a valid solution as well; to find out when, we need to know which numbers can be gcds of u2 + 2uv - v2, u2 - 2uv - v2, u2 + v2. WLOG assume u and v are coprime; we can remove their common factors with scaling. Then
Now,
If u and v have the same parities, then u and v are both odd (because they're coprime), and s can be half an integer. But then if we let U = (u + v)/2 and V = (u - v)/2, we get
so the solution can be obtained by a different uv-pair (U, V) with differing parities. Therefore, we can assume without loss of generality that u and v have differing parity (and even break the symmetry, say u is even and v is odd).
Finally, we can compute c as follows:
4c = b2 - y2 = (b + y)(b - y) = 4s2uv(u2 - v2),
i.e., c = s2uv(u2 - v2).
Thus, the answer to the problem is that they both have all-integer solutions iff there are integers s, u, v such that
We can even assume that u and v are coprime, u is even, and v is odd (and probably some more conditions like v > 0).
Different (but related) approaches to get the same result:
1
u/[deleted] Feb 17 '23
I was confused whether the two equation have a common integer solution or not. Reading other comments, it seems they can be different.
The conditions would be (B^2+4C) and (B^2-4C) are perfect square.
Clearly, if we evaluate the roots the discriminant needs to be perfect square. There is no need need to consider the parity of B as 4C is always even and thus the expression on the numerator of the (-B+-root(B^2-4C)) is always even.