Hi all,
here is my problem. I have the following system :
Where , and are integer unknowns and is any integer value (known)
Is there any general way to solve such equations quickly (for all three unknowns) ? Thanks a lot !
Hi all,
here is my problem. I have the following system :
Where , and are integer unknowns and is any integer value (known)
Is there any general way to solve such equations quickly (for all three unknowns) ? Thanks a lot !
The first thing I notice is that adding the two equations gives . One obvious solution to that is a= 0. But that gives and [tex]a^2- ac- n= n= 0[/itex]. If n= 0, then a= 0 , b, c any integers satisfy the equations.
If a is not 0, we can divide through by it and get a- (b+c)= 0 so a= b+c. Putting that into the first equation we get so .
Putting a= b+ c into the last eqaution gives or and, now, . That means we must have and so .
If c= -b, we have, from a-(b+c)= a= 0 again.
If c= b, a-(b+c)= 0 becomes a- 2b= 0 so a= 2b. Given any integer, k, take a= 2k, b= c= k. The equation becomes .
If n> 0, that is impossible. The only solution is a=0, b, c any integers.
If n= 0, that gives k= 0. That is a= b= c= 0, which is included in "a= 0, b, c any integers above".
If n< 0, so that which is integer only if n is -3 times a square: [tex]n= -3m^2[tex], in which case .
That is:
If or n< 0 is not of the form for some integer m, then a=0, b, c any numbers is the only solution.
If , then a= 2m, b= c= m.
Solve for a using the quadratic formula:
Now isolate b in terms of c:
Solution:
Simplify by multiplying by the conjugate: , or equivalently,
Substituting,
A better way of expressing the solution is by finding b,c such that , and let
For a to be an integer, must be even, so b,c must have the same parity (both even or both odd), so is even also.
An all-integer answer can thus be gotten: Given n, factor n, and find b,c satisfying , or . Define a as above.
This solution has the advantage of working for all -- there are no restraints on n. Given a random n, the number of a,b,c solutions is equivalent to the number of unique ways to factor , WLOG
Interestingly, a|n necessarily, so dividing through both equations by a, we arrive at the solution:
Given any integer n, choose a factor of n, a|n, and define b=a+n/a, c=a-n/a. We might have guessed at this solution from the start, but the preceding serves as a formal proof that it is the whole and only solution (aside from the trivial a=b=c=0, which works iff n=0).