# If $a^2 + p^2 = b^2$ then $2(a+p+1)$ is a perfect square

We are given $$a^2 + p^2 = b^2$$ where $a,b\in\mathbb{Z}$ and $p$ is prime. We are to show that $$2(a+p+1)$$ is a perfect square. Is there any elegant ways to go about this problem? Struggling to find a proof myself. Thanks in advance.

• It follows from the usual representation theorem for Pythagorean triples. Not elegant, but it does the job. – André Nicolas Jan 30 '15 at 23:41
• Sorry, but I don't seem to be familiar with this representation theorem? – user211337 Jan 30 '15 at 23:49
• Suppose $a^2+b^2=c^2$. There are integers $s,t,k$ (with $s$ and $t$ relatively prime and of opposite parity) such that $a=2kst$, $b=k(s^2-t^2)$ and $c=k(s^2+t^2)$. In our case the $k$ is irrelevant. – André Nicolas Jan 30 '15 at 23:52
• We can also argue directly from the equation, but I think of the representation theorem as so standard that it is not worthwhile to do so. – André Nicolas Jan 30 '15 at 23:55
• mmm..., You may use the fact p is prime as follow: $a^2 - b^2 = (a+b)(a-b) = -p^2$ and solve the differents equations systems, like a diofantin equation, you can find $a$ in terms of $p$, and replace... – user6565190 Jan 30 '15 at 23:58

We have $a^2 + p^2 = b^2$ so $p^2 = b^2-a^2 = (b+a)(b-a)$.
Therefore $b-a=1$ and $p^2 = b+a=2a+1$
Therefore $2(a+p+1) = p^2 + 2p + 1 = (p+1)^2$
• How does $b-a=1$ follow from everything that precedes it? – Eric Jan 31 '15 at 6:14
• $p^2$ has three factors: $p^2, p$ and $1$. $(b+a)$ and $(b-a)$ cannot both be $p$ therefore they are $p^2$ and $1$ respectively. – Joffan Jan 31 '15 at 6:25