How to find integer solutions for an ellipse equation?

1.2k Views Asked by At

How can I find the positive integer solutions to $x$ and $y$, given the integers $a$, $b$ and $c$ in the following ellipse equation in the form:

$\frac{x^2}{a^2} + \frac{y^2}{b^2}=c$

For example, when $a, b, c = 1,2,2$, one possible solution may be $x, y = 1,2$:

$\frac{1^2}{1^2} + \frac{2^2}{2^2}=2$

1

There are 1 best solutions below

0
On BEST ANSWER

Let's rewrite the equation as $$b^2x^2+a^2y^2=a^2b^2c$$ First of all, if $c\le0$, then clearly there are no solutions in positive integers $x,y$. So, we assume $c\gt0$. Then you can simply test each value $x=1,2,\dots,r$, where $r\lt a\sqrt c\le r+1$, to see whether the corresponding $y$-value is an integer.