# Thread: System of two equations with three integer unknowns

1. ## System of two equations with three integer unknowns

Hi all,
here is my problem. I have the following system :

$S \left\{\begin{array}{cc}a^2 - ab + n = 0
\\a^2 - ac - n = 0\end{array}\right.$

Where $a$, $b$ and $c$ are integer unknowns and $n$ is any integer value (known)

Is there any general way to solve such equations quickly (for all three unknowns) ? Thanks a lot !

2. Originally Posted by Bacterius
Hi all,
here is my problem. I have the following system :

$S \left\{\begin{array}{cc}a^2 - ab + n = 0
\\a^2 - ac - n = 0\end{array}\right.$

Where $a$, $b$ and $c$ are integer unknowns and $n$ 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 $2a^2- a(b+c)= 0$. One obvious solution to that is a= 0. But that gives $a^2- ab+ n= n= 0$ 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 $(b+c)^2- (b+c)b+ n= b^2+ 2bc+ c^2- b^2- bc+ n$ $= bc+ c^2+ n= 0$ so $c^2= bc- n$.

Putting a= b+ c into the last eqaution gives $(b+c)^2- (b+c)c- n= 0$ or $b^2+ 2bc+ c^2- bc- c^2- n= b^2+ bc- n= 0$ and, now, $c^2= bc-n$. That means we must have $b^2= c^2$ and so $c= \pm b$.

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 $a^2- ab+ n= 0$ becomes $4k^2- k^2+ n= 3k^2+ n= 0$.

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, $k^2= -n/3$ so that $k= \sqrt{-n/3}$ which is integer only if n is -3 times a square: [tex]n= -3m^2[tex], in which case $k= m$.

That is:
If $n\ge 0$ or n< 0 is not of the form $n= -3m^2$ for some integer m, then a=0, b, c any numbers is the only solution.

If $m= -3m^2$, then a= 2m, b= c= m.

3. Well $n > 3$, and I know that (maybe it could help) $n = ad$ (with new unknown $d$ of course)
And, $a > 0$, $b > 0$, $c > 0$ (and $d > 1$).

But it looks like I'm screwed, perhaps I need more information ?

4. ## Brute Force Approach - General

Solve for a using the quadratic formula: $2a=b\pm\sqrt{b^2-4n}=c\pm\sqrt{c^2+4n}$

Now isolate b in terms of c: $b^2-4n=(c-b\pm\sqrt{c^2+4n})^2$

Solution: $b=\frac{c^2\pm c\sqrt{c^2+4n}+4n}{c\pm\sqrt{c^2+4n}}$

Simplify by multiplying by the conjugate: $b=\pm\sqrt{c^2+4n}$, or equivalently, $c=\pm\sqrt{b^2-4n}$

Substituting, $2a=b+c$

A better way of expressing the solution is by finding b,c such that $b^2-c^2=4n$, and let $a=\frac12(b+c)$

For a to be an integer, $b+c$ must be even, so b,c must have the same parity (both even or both odd), so $b-c$ is even also.

An all-integer answer can thus be gotten: Given n, factor n, and find b,c satisfying $b^2-c^2=4n$, or $\frac{b+c}{2}\frac{b-c}{2}=n$. Define a as above.

This solution has the advantage of working for all $n\in\mathbb{Z}$ -- 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 $n=xy$, WLOG $x\geq y$

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).

5. Just wanted to point out what may be an error in HallsofIvy's post .... if you divide $2a^2- a(b+c)= 0$ by $2$, you get that $2a- (b+c)= 0$, and NOT $a- (b+c)= 0$

6. Originally Posted by Bingk
Just wanted to point out what may be an error in HallsofIvy's post .... if you divide $2a^2- a(b+c)= 0$ by $2$, you get that $2a- (b+c)= 0$, and NOT $a- (b+c)= 0$
You mean divide by $a$ surely ?

7. hahahaha ... yeah, by a