# 24 divides m if n^2 -m and n^2 +m are perfect squares

## Homework Statement

Show that if n2 + m and n2 - m are perfect squares then m is divisible by 24.

## Homework Equations

This problem comes from Larson's Problem-solving Through Problems in the section on modular arithmetic. It is the third part of a four-part problem, with the previous two parts of the problem being to prove that if x3 + y3 = z3 has a solution in integers x, y, and z then one of them is divisible by seven, and the second part to prove that if 2n + n2 is prime then n is congruent to 3 mod6. Since they're part of the same problem I assume that they are somehow relevant.

## The Attempt at a Solution

I want to show that m is divisible by both 3 and 8. By the Chinese Remainder Theorem, I can set up the following:

m ≡ a(mod3)
m ≡ b(mod8)

And I assume that what I want to do is show that the two expressions can only be perfect squares if a = b = 0.

I don't know if any of the following actually brings me any closer to a solution, but I feel like they might be pointing in the right direction:

I can set up the following relations:

n2 + m ≡ n2(mod3) + a(mod3)
n2 + m ≡ n2(mod8) + b(mod8)
n2
- m ≡ n2(mod3) - a(mod3)
n2
- m ≡ n2(mod8) - b(mod8)

And further I can mod n out so that
n2(mod3) + a(mod3)[a(mod3)](modn), etc

I can also multiply n2 + m and n2 - m to get n4 - m 2, which gets

n4 - m 2 ≡ (-a2mod3)(modn)
n4 - m 2 ≡ (-b2mod8)(modn)

All of which I think might be useful in establishing a = b = 0, but I can't think of how to get there.

Related Calculus and Beyond Homework Help News on Phys.org
.Scott
Homework Helper
Well, you have $a^{2}+b^{2}=2n^{2}$.
Note that if a and b share any common factors, so will n. So for example, if a and b are even, n will also be even and if a and b are multiples of 3, n will also be a multiple of 3. So we can start by dividing a, b, and n by the greatest common divisor (GCD) of a and b.

Working in modulo 3:
n = 0, 1, 2; so $n^{2}$ = 0, 1, 1
So the square is never 2.
$a^{2}+b^{2}=2n^{2}$ becomes (0+1,1+0, or 1+1) = 0 or 2
Only the 1+1=2 solution is possible. This means that none of a, b, and n are divisible by 3.
So $a^{2}-b^{2}=2m$ becomes (1-1)=2m, so m=0 modulo 3.

Working in modulo 2:
$a^{2}=a; b^{2}=b, 2n^{2}=0$
So $a^{2}+b^{2}=2n^{2}$ becomes a+b=0 or a=b
If a and b were both even, we would reduce the problem by an even GCD. So they must be both odd.

Let $a=2A+1; b=2B+1$
So $2m = a^{2}-b^{2} = (2A+1)^{2}-(2B+1)^{2} = 4A^{2}+4A+1-4B^{2}-4B-1 = 4(A^{2}+A-B^{2}-B)$
So $m = 2(A^{2}+A+B^{2}+B) = 2(A(A+1)-B(B+1))$
Since A and A+1 are consecutive number, one will be even and the product will be even. Same with B.
So (A(A+1)-B(B+1)) is even-even which is even. And m = 2(even) which is 0 modulo 4.

So I've got m modulo 12 = 0
Not quite what you need, but I hope it helps.

haruspex