$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

  • $\begingroup$ What is the meaning of "all positive integers n"? $\endgroup$
    – Moti
    Feb 5, 2021 at 4:50
  • $\begingroup$ @Moti exactly as it says, it satisfies the conditions for $n=1,2,3,...$ and so on $\endgroup$ Feb 5, 2021 at 5:45
  • $\begingroup$ 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. $\endgroup$
    – JimmyK4542
    Feb 5, 2021 at 6:42
  • 1
    $\begingroup$ See quora.com/…. $\endgroup$
    – rudgns55
    Feb 5, 2021 at 8:23

1 Answer 1


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.

  • $\begingroup$ Rightly commented and nicely done! $\endgroup$
    – Moti
    Feb 5, 2021 at 19:18
  • $\begingroup$ 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. $\endgroup$
    – Piquito
    Feb 6, 2021 at 12:08
  • $\begingroup$ I totally agree that this became a political work of under knowledge guys with lack of depth and mathematical imagination. $\endgroup$
    – Moti
    Feb 7, 2021 at 5:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .