# $a+n^2$ is the sum of two perfect squares

$$a+n^2$$ is the sum of two perfect squares for a given positive integer $$a$$ and all positive integers $$n$$. Show that $$a$$ is a perfect square.

At first I thought of putting a bound on the difference between perfect squares up to a point, like maybe choosing $$n=c$$ so that one of the squares on the right hand side is the smallest, to try and show that if $$a = x^2 + k< (x+1)^2$$ that there would have to be two pairs of squares with the same difference, but I can't seem to work out the details

• What is the meaning of "all positive integers n"? – Moti Feb 5 at 4:50
• @Moti exactly as it says, it satisfies the conditions for $n=1,2,3,...$ and so on – justadumbguy Feb 5 at 5:45
• Since $a+1$ and $a+a^2$ can both be written as the sum of two perfect squares, and $(a+a^2)/(a+1) = a$, it easily follows from the Sum of Two Squares Theorem that $a$ can also be written as the sum of two squares. I'm not sure if that can be used to show that $a$ itself is a perfect square, but I'll leave it here just in case it helps someone else solve this problem. – JimmyK4542 Feb 5 at 6:42
• See quora.com/…. – rudgns55 Feb 5 at 8:23

## 1 Answer

The general solution of the equation $$x^2+y^2=z^2+w^2$$ is given by the identity with four arbitrary parameters $$(tX+sY)^2+(tY-sX)^2=(tX-sY)^2+(tY+sX)^2$$ Let $$n$$ be any integer so we have $$a+n^2=z^2+w^2$$Making $$n=tY-sX\\z=tX-sY\\w=tY+sX$$ we have three equations with four unknowns which in general have infinitely many solutions. Any way we have $$n^2=t^2Y^2+s^2X^2-2stXY\\z^2=t^2X^2+s^2Y^2-2stXY\\w^2=t^2Y^2+s^2X^2+2stXY$$ which implies $$z^2+w^2-n^2=t^2X^2+s^2Y^2+2stXY=(tX+sY)^2$$ Since $$a=z^2+w^2-n^2$$ we have $$a=(tX+sY)^2$$ We are done.

• Rightly commented and nicely done! – Moti Feb 5 at 19:18
• Thank you very much friend. There are one or more guys who are putting downvotes to my previous answers in order to lower my reputation points which contravenes all mathematical ethics. Do not be surprised that the up vote that I currently have on this problem (which others have not been able to solve!) Is later eliminated by this action of these guys who should be expelled from MSE. – Piquito Feb 6 at 12:08
• I totally agree that this became a political work of under knowledge guys with lack of depth and mathematical imagination. – Moti Feb 7 at 5:29