Sign up ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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$

share|cite|improve this question
The standard form I have seen requires $c=1$. I wasn't sure if this was a typo on your part or part of your question so I didn't edit it. – nullUser Sep 18 '12 at 22:25
when c is 1, then the radii of the ellipse are a and b (are they still called radii?) but unless it is 0 (in which case it is a degenerate point), then the radii will be $a\sqrt{c}, b\sqrt{c}$ – mathguy Sep 18 '12 at 22:31

2 Answers 2

up vote 0 down vote accepted

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.

share|cite|improve this answer

Gerry Myerson shows that this is a sum-of-two-squares problem.

This is related to: Efficiently finding two squares which sum to a prime

Given a^2 * b^2 * c, we can efficiently find m, n such that m^2 + n^2 = a^2 * b^2 * c. Then it's a simple matter of checking to see if a or b divides m, and if so, if the other value divides n.

I believe an outline of the proof process you want to go through, goes something like this:

Let X = a^2 * b^2 * c If X is divisible by a prime equal to 3 mod 4, then X is divisible by that prime raised to an even power, and both 'm' and 'n' will be divisible by that prime raised to that even power. So we can effectively factor out those primes.

We now have Y divides a^2 * b^2 * c and Y is a product of primes equal to 1 mod 3. And we can look for 'k' and 'l' such that k^2 + l^2 == Y.

If Y is prime, then there is a unique solution, and the above referenced stackexchange page discusses how to find 'k' and 'l'.

If Y is not prime, then we can find a solution for each factor, and combine the partial solutions to enumerate all solutions. Suppose for example that Y = WZ where W and Z are prime and i^2 + j^2 = W and q^2 + r^2 = Z. Then (iq + jr)^2 + (ir - jq)^2 = WZ. There are also solutions involving the conjugates i^2 + (-j)^2 and q^2 + (-r)^2. Equivalent solutions can be avoided by using only the positive form for one of the primes, but allowing either the positive form or the conjugate form for each of the other primes.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.