# Triangular numbers is relating to Pythagoras triples

Let

$$T_n:=1,3,6,10,15,...$$

are triangular numbers, $T_n={n(n+1)\over 2}.$

Pythagoras triples $(5,12,13),(7,24,25),(9,40,41),(11,60,61)$ and so on,...

Observe that $S_n=T_n+2T_{n+1}+T_{n+2}$ for $n\ge1$

$S_1=13$

$S_2=25$

$S_3=41$ and so on, ...

Can anyone explain how does this formula $S_n$ in term of triangular is related to Pythagoras triple numbers?

Notice that all triples of the form $(u^2-v^2, 2uv, u^2+v^2)$ for $v<u$ are pythagorean.
Also, $$S_n=\frac{n(n+1)+2(n+1)(n+2)+(n+2)(n+3)}{2}=2n^2+6n+5=(n+2)^2+(n+1)^2$$
thus, $S_n$ is always the greatest number in a pythagorean triple. In fact:
$$S_n^2=(2n+3)^2+(2(n+1)(n+2))^2$$
Pythagorean triples can be gnerated by $(m^2-n^2, 2nm , n^2+m^2)$ and if $m=n+1$ you will obtain your sequence.
Note that your sequence $S_n$ are the sum of two consecutive squares. $S_=n^2+(n+1)^2$. Also \begin{eqnarray*} S_n&=& \frac{n(n+1)}{2}+ 2\frac{(n+1)(n+2)}{2}+\frac{(n+2)(n+3)}{2}= 2n^2+6n+5 \\&=&(n+1)^2+(n+2)^2 \end{eqnarray*} again the sum of two consecutive squares (offset by $1$).