<s>[INST] Solve $ \binom{a}{2} + \binom{b}{2} = \binom{c}{2} $ with $a,b,c \in \mathbb{Z}$ I am trying to solve the Diophantine equation:
$$ \binom{a}{2} + \binom{b}{2} = \binom{c}{2} $$
Here's what it looks like if you expand, it's variant of the Pythagorean triples:
$$ a \times (a-1) + b \times (b-1) = c \times (c-1) $$
I was able to find solutions by computer search but this could have also been checked using the Hasse principle.
\begin{eqnarray*}
\binom{3}{2}+ \binom{3}{2}&=& \binom{4}{2} \\ \\
\binom{5}{2}+ \binom{10}{2}&=& \binom{11}{2} \\ \\
\binom{15}{2}+ \binom{15}{2}&=& \binom{21}{2} 
\end{eqnarray*}
and many others.  Is there a general formula for the $(a,b,c) \in \mathbb{Z}^3$ that satisfy this integer constraint.

>>> N = 25
>>> f = lambda a : a*(a-1)/2
>>> X = [(a,b,c,f(a) + f(b) - f(c)) for a in range(N) for b in range(N) for c in range(N)] 

>>> [(x[0],x[1],x[2]) for x in X if x[3] == 0 and x[0] > 1  and x[1] > 1 and x[2] > 1]

[( 3,  3,  4),  ( 4, 6, 7) , ( 5, 10, 11), ( 6,  4,  7), ( 6,  7,  9), 
 ( 6, 15, 16),  ( 7, 6, 9) , ( 7, 10, 12), ( 7, 21, 22), ( 9, 11, 14), 
 (10,  5, 11),  (10, 7, 12), (10, 14, 17), (10, 22, 24), (11,  9, 14), 
 (12, 15, 19), (12, 21, 24), (13, 18, 22), (14, 10, 17), (15,  6, 16), 
 (15, 12, 19), (15, 15, 21), (15, 19, 24), (18, 13, 22), (19, 15, 24), 
 (21,  7, 22), (21, 12, 24), (22, 10, 24)]

 [/INST] After some algebra you can rewrite the equation as
$$
a(a-1)=(c-b)(c+b-1)
$$
Note that $c-b$ and $c+b-1$ have opposite parity. Conversely, if $p$ and $q$ are integers with opposite parity, then we can find integers $b,c$ such that $p=c-b$, $q=c+b-1$: namely, $b=\frac{q+1-p}{2}$ and $c=\frac{q+1+p}{2}$.
That is to say, all solutions to the equation can be obtained in the following way:


*

*Choose some number $a$. Factor $a(a-1)$ into two numbers $p,q$ of opposite parity. Since $a(a-1)$ is always even, this just means $p$ and $q$ can't both be even.

*Take $b=\frac{q+1-p}{2}$, $c=\frac{q+1+p}{2}$.


For example, we could take $a=16$. Then $a(a-1)=240$, which factors into two numbers with opposite parity in four different ways:
\begin{align}
1&\cdot 240\\
3 &\cdot 80\\
5 &\cdot 48\\
15 &\cdot 16
\end{align}
These give four essentially different solutions to the equation:
\begin{align}
\binom{16}{2}+\binom{120}{2}&=\binom{121}{2}\\
\binom{16}{2}+\binom{39}{2}&=\binom{42}{2}\\
\binom{16}{2}+\binom{22}{2}&=\binom{27}{2}\\
\binom{16}{2}+\binom{1}{2}&=\binom{16}{2}
\end{align}
A few notes:


*

*Swapping $p,q$, or replacing them by $-p,-q$, gives a solution which is essentially the same if you remember that $\binom{n}{2}=\binom{1-n}{2}$.

*The symmetry between $a$ and $b$ means that this method will produce each solution twice. For example, the third solution above ($\binom{16}{2}+\binom{22}{2}=\binom{27}{2}$) could also have been found by taking $a=22$, $p=11$, $q=42$.

</s>