# $k^{2}+(k+1)^{2}$ being a perfect square for infinitely many $k$

Generally one can see that there are infinite number of solutions for this equation $$a^{2}+b^{2}=c^{2}$$ by taking multiples of the solution $3,4$ and $5$.

Can i use this as a fact to prove, that $k^{2} + (k+1)^{2}$ is a perfect square for infinitely many $k \in \mathbb{N}$? Any hints, suggestions would be helpful. If not, then how do i prove this fact!

## 5 Answers

You can find infinitely many by considering solutions of Pell's equation $m^2 - 2a^2=-1.$ Your (3,4,5) solution comes from$$(7-5\sqrt{2})(7+5\sqrt{2})=-1,$$ where $m=7$ and $a=5$. For example $$(7-5\sqrt{2})^3$$ yields $$696^2+697^2 = 985^2.$$

Just to make it a bit more clear note that $$\left( {m-1 \over 2} \right)^2 + \left( {m+1 \over 2} \right)^2 = a^2.$$

This is obvious by ascent in the ternary tree of Pythagorean triples. Explicitly, ascent yields this formula:

$\rm (x,x+1,z) \to (X,X+1,Z),\ \ X = 3x+2z+1,\ \ Z = 4x+3z+2\:.\ \$ For example

$\rm (3,4,5)\to (20, 21, 29)\to (119, 120, 169)\to (696, 697, 985)\to (4059, 4060, 5741)\to\cdots$

This corresponds to always taking the middle branch in the tree, see below

The reflection that yields the descent in the triples tree is the following

$\quad\quad (x,y,z)\; \mapsto (x,y,z) - 2 \dfrac{(x,y,z)\cdot(1,1,1)}{(1,1,1)\cdot(1,1,1)} (1,1,1)$

$\quad\quad\quad\quad\quad\quad = (x,y,z) - 2 \; (x+y-z) \; (1,1,1)$

$\quad\quad\quad\quad\quad\quad = (-x-2y+2z, \; -2x-y+2z, \; -2x-2y+3z)$

We ascend the tree by inverting this reflection, combined with trivial sign-changing reflections:

$\quad\quad (-3,+4,5) \mapsto (-3,+4,5) - 2 \; (-3+4-5) \; (1,1,1) = ( 5,12,13)$

$\quad\quad (-3,-4,5) \mapsto (-3,-4,5) - 2 \; (-3-4-5) \; (1,1,1) = (21,20,29)$

$\quad\quad (+3,-4,5) \mapsto (+3,-4,5) - 2 \; (+3-4-5) \; (1,1,1) = (15,8,17)$

Continuing in this way enables one to reflectively generate the entire tree of primitive Pythagorean triples. This has a beautiful geometric interpretation in terms of refelections - see my said MathOverflow post and see here for sums of four squares.

Just to add to Derek's excellent answer,

Pell's equation becomes essential in getting all the solutions to $$k^2 + (k+1)^2 = j^2$$.

Since $gcd(k,k+1) =1$ we may assume that (by the formula for all primitive pythagorean triples) that

$$m^2 - n^2 = 2mn \pm 1$$

This is a quadratic in $m$ and solving for $m$ gives us

$$m = n \pm \sqrt{2n^2 \pm 1}$$

Thus any solution of $$k^2 + (k+1)^2 = j^2$$ can be used to get a solution to the equation $$2n^2 \pm 1 = b^2$$ and vice versa.

It is clear that there is a relationship with solutions of Pell's equation, but it must still be written more clearly and in a more general way.

Solutions of the equation: $X^2+(X\pm{a})^2=Y^2$

Defined solutions of Pell's equation: $p^2-2s^2=\pm{a}$

And the solutions are of the form:

$X=2s(s+p)$

$Y=2s(s+p)+p^2$

These numbers can be different characters.

I almost forgot. If we know what the solution of Pell's equation $p^2-2s^2=a$

$s_{2}=2p+3s$

$p_{2}=3p+4s$

The most direct formula I've found in generating these can be found in "Pythagorean Triangles" by Waclaw Sierpeinski "The scriptia Mathematical Studies Number Nine" (1962) Chapter 4. Pythagorean Triangles Two Sides of Which are Successive Numbers page $$17$$. Starting with $$A,B,C=3,4,5$$, subsequent triples can be generated with the formula $$(3A+2C+1, 3A+2C+2, 4A+3C+2)$$. By the nature of the formula, we can see that the series of triples is infinite. Here are the first $$19$$ I was able to generate with the limits of precision in a spreadsheet.

$$(3,4,5)\\ (20,21,29)\\ (119,120,169)\\ (696,697,985)\\ (4059,4060,5741)\\ (23660,23661,33461)\\ (137903,137904,195025)\\ (803760,803761,1136689)\\ (4684659,4684660,6625109)\\ (27304196,27304197,38613965)\\ (159140519,159140520,225058681)\\ (927538920,927538921,1311738121)\\ (5406093003,5406093004,7645370045)\\ (31509019100,31509019101,44560482149)\\ (183648021599,183648021600,259717522849)\\ (1070379110496,1070379110497,1513744654945)\\ (6238626641379,6238626641380,8822750406821)\\ (36361380737780,36361380737781,51422757785981)\\ (211929657785303,211929657785304,299713796309065)$$