Solve a system of quadratic equations in two variables for integral solutions.

21.4k Views Asked by At

Let's say I have two equations like:

$x^2 - y^2 = 6$ or

$x^2 + y^2 = 6$

What is the best way to solve these sort of equations for finding only positive integral solutions?

3

There are 3 best solutions below

2
On

For the first you can write

$$(x-y)(x+y)=6$$

For the second equation do case work. If

$$x=1$$

you get

$$y^2=5$$

and for

$$x=2$$

you will get

$$y^2=2$$

and

$$x=3$$

is impossible, thus we have no solutions.

0
On

General Case:

These equations belong to the conic sections: $$ Ax^2 + Bxy + Cy^2 +Dx + Ey + F = 0 $$ If $x$ and $y$ are real values you end up with curves like hyperbolas and circles.

If you restrict the unknowns to integer values, these equations are called Diophantine equations.

An example is Pell's equation: $$ x^2-ny^2=1 $$ which is equivalent to the type of your first equation. You might restrict its general solutions to positive ones.

For the second type of equations one ends up with Pythgorean triples: $$ a^2 + b^2 = c^2 $$

Your Case:

For your given equations there seem to be no solutions according to WA (link and link).

First Equation: Looking for a solution of $$ x^2 - y^2 = 6 \\ $$ Case $x \le y$: For $x$ and $y = x + k$ for $k \ge 0$ we have $$ 6 = x^2 - (x + k)^2 = -k^2 - 2kx \le 0 $$ so no solution for $x \le y$.

Case $x > y$: For $x = y + k$ and $k > 0$ we have $$ 6 = (y + k)^2 - y^2 = k^2 + 2ky = f(k,y) $$ So we simply try out the first few positive integer values for $k$: $$ f(1, y) = 1 + 2y \ne 6 $$ because the left hand side is odd and the right hand side even. $$ f(2, y) = 4 + 4 y \ge 8 > 6 $$ As $f$ is increasing with $k$, we have $f(k,y) > 6$ for $k \ge 2$, so no solution here either.

Second Equation: Looking for a solution of $$ x^2 + y^2 = 6 \\ $$ We can assume $x \ge y$, otherwise we rename $x$ into $y$ and vice versa.

So we have $x = y + k$ and $k \ge 0$ and get $$ 6 = (y + k)^2 + y^2 = 2y^2 + k^2 + 2k = g(k, y) $$ We try out the first few non-negative integer values for $k$: $$ g(0, y) = 2y^2 = 6 \iff y = \pm \sqrt{3} \\ $$ which is no integer. $$ g(1, y) = 2y^2 + 3 = 6 \iff y^2 = 3/2 $$ which is no integer as well. $$ g(2, y) = 2 y^2 + 8 \ge 10 > 6 $$ as $g$ is increasing with $k$, it will not get better, so no solution here either.

0
On

As a starting point, I suggest plotting the solutions to each equation to see where the intersections (if any) between them are. For the pair of equations given in the question, we see that there appear to be two points where the circle $x^2 + y^2 = 6$ (red) intersects with the hyperbola $x^2 - y^2 = 6$ (blue), and the intersection is at approximately $x = \pm 2.4, y=0$.

enter image description here

You can find the solutions analytically by adding and subtracting the two equations: $$(x^2 + y^2) + (x^2 - y^2) = 6 + 6 \implies x^2 = 6 \implies x = \pm \sqrt{6} \approx 2.449$$ and $$(x^2 + y^2) - (x^2 - y^2) = 6 - 6 \implies y^2 = 0 \implies y = 0.$$ Therefore, the solutions to the system of equations are $(\pm \sqrt{6}, 0)$.