Proof that hexagonal numbers are triangular While solving Project Euler problem 45, I tried to prove that all hexagonal numbers are triangular. I came up with the following.
We need to prove that a number of the form (hexagonal formula)
$$2n_h^2 - n_h$$
can be written as (triangular formula)
$$\frac{n_t^2 + n_t}{2}.$$
This seems easy enough:
$$
\begin{align}
& 2n_h^2 - n_h \\
=& \frac{4n_h^2 - 2n_h}{2} \\
=& \frac{(2n_h)^2 - 2n_h}{2} \\
=& \frac{(-2n_h)^2 + (-2n_h)}{2}  \square
\end{align}
$$
This proof seems to imply that the hexagonal number with index $n_h$ is the triangular number with index $-2n_h$. Clearly, there is something wrong here (the minus should not be there) but I cannot figure out where I went wrong.

Let's adopt a new notation $T(n)=\frac{n(n+1)}{2}$ and $H(n)=2n^2-n$
The aim is to prove $T(n)=H(m)$ for some $n,m$.
This gives $\frac{n(n+1)}{2}=2m^2-m=m(2m-1)\iff n(n+1)=(2m-1)2m$

Under this form it is obvious that $n=2m-1$ works and $T(2m-1)=H(m)$ or equivalently $H(\frac{n+1}{2})=T(n)$ (for $n$ odd).

Don't be surprised by your formula though, because in fact
$T(-n)=\frac{-n(-n+1)}{2}=\frac{n(n-1)}{2}=T(n-1)$
And you get $H(n)=T(-2n)=T(2n-1)=H(n)$ and the cycle is complete.
