# BMO2 2016 Number Theory Problem

Suppose that $p$ is a prime number and that there are different positive integers $u$ and $v$ such that $p^2$ is the mean of $u^2$ and $v^2$. Prove that $2p−u−v$ is a square or twice a square.

Can anyone find a proof. I can't really see any way to approach the problem.

• Can you find a primitive pythagorean triple? – Empy2 Feb 1 '16 at 16:56

First assume that $p>2$ (because when $p=2$ the equation $u^2+v^2=8$ is easily solved).

Now use the following trick to form $2p-u-v$ :

$$4p^2=2\cdot 2p^2=2(u^2+v^2)=(u+v)^2+(u-v)^2$$

and use the difference of squares :

$$(2p-u-v)(2p+u+v)=(u-v)^2$$

Let $q$ be a prime factor of both $2p-u-v$ and $2p+u+v$ so :

$$q \mid (2p-u-v)+(2p+u+v)=4p$$ $$q \mid (2p+u+v)-(2p-u-v)=2(u+v)$$

Now let's consider two cases :

• If $q$ is odd then $q \mid p$ but because $p$ is prime it follows that $q=p$ and then $p \mid u+v$ .

But then :

$$p \mid (u+v)^2-(u^2+v^2)=2uv$$ $$p \mid uv$$

If for example $p \mid u$ then also $p \mid v$ because $p \mid u+v$ .Thus both $u$ and $v$ are divisible with $p$ and so :

$$2p^2=u^2+v^2 \geq p^2+p^2=2p^2$$

Thus we must have $u=v=p$ and $2p-u-v=0$ is a perfect square .

• If none of the common prime factors $q$ is odd then their gcd must be a power of two , some $2^k$

Using the identity :

$$(2p-u-v)(2p+u+v)=(u-v)^2$$

it follows that $2p-u-v=2^kx^2$ and $2p+u+v=2^ky^2$ for some $x$ and $y$ .

Thus if $k$ is even then $2p-u-v$ is a perfect square and if it's odd it's twice a perfect square which proves the claim .

• Thanks. I actually started down this route, but I missed a step and couldn't really make any progress so just went looking for different ways of attacking the problem, it was only when I saw the hint given that I realized what I was doing was right, I just needed to follow it through. Thanks anyway. – MadChickenMan Feb 1 '16 at 17:27
• By "$u^2+v^2=8$ is easily solved", did you mean that it's clear there is no solution where $u$ and $v$ are distinct positive integers, as specified in the question? – Todd Wilcox Feb 1 '16 at 22:35
• @ToddWilcox What I mean is that the only solution is $u=v=2$ and then $2p-u-v=0$ is a perfect square .Because there are few solutions I considered more important the case $p>2$ . – user252450 Feb 2 '16 at 5:37
• My reading of the question is that $u=v=2$ is actually not a valid solution because it was specified that $u\neq v$, wasn't it? "...there are different positive integers $u$ and $v$..." would mean $u^2+v^2=8$ would have no valid solutions. – Todd Wilcox Feb 2 '16 at 14:48
• @ToddWilcox I didn't noticed that part but does it really matter that much? If $u=v$ then $2p-u-v=0^2$ . – user252450 Feb 2 '16 at 15:29

Hint: One way to get squares from the given $2p-u-v$ is to multiply it by a conjugate, $2p+u+v$. Simplify what you get using the fact that $2p^2 = u^2+v^2$, and look at the factorization of the result. Then consider the possible values for $2p-u-v$ given that factorization.

• Whoa. Great trick. There's a good bunch of secial cases (aka. pitfalls) to consider though – Hagen von Eitzen Feb 1 '16 at 17:11

Note that $2p^2=u^2+v^2$, or $(p-u)(p+u)=(v-p)(v+p)$. WLOG, suppose $u<p<v$.

From the above equation, we have: $$2p-u-v=(p-u)+(p-v)=\frac{(v-p)(v-u)}{p+u}$$ Now, we do following analysis:

If $q$ is odd prime, and $q^a|(v-p)$ then $q^a\not|(v+p)$ since $p$ is prime, and $p\not|v$.

So, $q^a|(p-u)(p+u)$, and only one of $(p-u)$ and $(p+u)$ is divisible by $q^a$.

If $q^a|(p-u)$, then $q^a|(v-p+p-u)$, i.e $q^a|(v-p)$, and so $$q^{2a}|\frac{(v-p)(v-u)}{p+u}.$$

If $q^a|(p+u)$, then $$q\not|\frac{(v-p)(v-u)}{p+u}.$$ since factorization of numerator and denominator will cancel all $q$'s.

The above is true for all odd primes, so$$2p-u-v=\frac{(v-p)(v-u)}{p+u}=n^2,$$ or $$2p-u-v=\frac{(v-p)(v-u)}{p+u}=2n^2.$$