Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

How to find all natural $x$ for that $x^2 + (x+1)^2$ is a perfect square?

share|improve this question
add comment

1 Answer

up vote 11 down vote accepted

Suppose $x^2 + (x+1)^2 = y^2$. We can rewrite it as $(2x+1)^2 + 1 = 2y^2$ or $(2x+1)^2 - 2y^2 = -1$.

If $z=2x+1$ then we have $z^2 - 2y^2 = -1$. This is Pell's equation. Wikipedia article shows how to solve it.

share|improve this answer
In particular, because the smallest solution of z²-2y²=-1 is (1,1), all solutions are given by writing (1+√2)^n = z + y√2, for odd n. For instance (1+√2)³ = (7+5√2). So solutions (z,y) are (1,1), (7,5), (41,29), (239,169), (1393,985) and so on, corresponding to x = 0, 3, 20, 119, 696, … –  ShreevatsaR Jul 29 '10 at 7:50
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.