Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sorry, this is very much 'can you do my homework' but I have a little competition at work that requires me to solve (and prove) the following.

Find all positive integers $L$, $M$, $N$ such that $L^2 + M^2 = \sqrt{ N^2 +21}$.

The answers I have are $L=1$, $M=2$, $N=2$ and $L=2$, $M=1$, $N=2$ (by iterating over all values of L, M, and N from 1 to 100 in Ruby). I think it's pretty unlikely there are any higher answers but proving it is beyond me. Can anyone point me in the right direction?

Hi DJ, don't dob me in!

share|cite|improve this question
up vote 18 down vote accepted

Let $(L^2 + M^2) = A$. Then you have $A^2 = N^2 + 21$ i.e. $(A+N)(A-N) = 21 = 21 \times 1= 7 \times 3$. Now work out the different possibilities with the constraint that you are dealing with positive integers. Move your mouse over the gray area to find the solution.

The first one i.e. $21 \times 1$, gives us $A = 11$ and $N = 10$, while the second one i.e. $7 \times 3$ gives us $A = 5$ and $N = 2$. $A = 11$ cannot be expressed as sum of two squares since it is $3 \bmod 4$. $A=5$ implies that $L^2 + M^2 = 5$ which gives us $(L,M) = (2,1)$ or $(L,M) = (1,2)$. Hence, $(2,1,2)$ and $(1,2,2)$ are the only solutions.

share|cite|improve this answer
Dammit Marvis, you beat me to it haha. – Nico Bellic May 17 '12 at 3:09
There's no need to swear about it... just type faster! – The Chaz 2.0 May 17 '12 at 3:11
+1 for the 'magic answer'. – Sniper Clown May 17 '12 at 7:00

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.