# Triangular Numbers and Perfect Squares

Prove that $n$ is a triangular number if and only if $8n+1$ is a perfect square.

I proved the easier part first (I think), that is, if $n$ is a triangular number then $8n+1$ is a perfect square.

By the way, this was taken from David Burton's book, Elementary Number Theory and sadly it doesn't have all the solutions...

• Almost trivial: $$N=\frac{M(M+1)}{2}\Longleftrightarrow 8N+1 = (2M+1)^2$$ – Jack D'Aurizio Jan 11 '18 at 17:16
• Oh, forgot that $n$ couldn't be even..., Thanks a lot! – lil' mathematician Jan 11 '18 at 17:19
• Start and the beginning. Go on to the middle. And when you get to the end-- stop. If $8n + 1 = m^2$ then $8n = m^2 - 1 = (m-1)(m+1)$ so $n= \frac {(m-1)(m+1)}8$ is an integer. So $2$ either divides $m-1$ or $m+1$ but as $m-1, m+1$ are either both even or both odd so they are both even. Let $m-1 = 2k$ then $m+1 = (m-1) +2= 2k + 2$. So $n =\frac {(2k)(2k+2)}8 = \frac {4k(k+1)}{8} = \frac {k(k+1)}2$. Stop. That's if you didn't have the insight that $8N+1$ is odd so $8N+1 = (2K+1)^2$, which makes the proof much shorter. But even without it, the proof is straightforward. – fleablood Jan 11 '18 at 17:34
• I suppose a trick is to NOT get bogged down in proving that if $8|(m-1)(m+1)$ then $2$ divides one and $4$ divides the other. That is true and it isn't difficult to prove but it's slightly tedious (it's one of those "how obscure and vague in my langauge vs. too many variables and considered cases should I be" proofs) and absolutely unnecessary. – fleablood Jan 11 '18 at 17:47

• If $n$ is a triangular number, then $n = \frac{k(k+1)}{2}$ and $8n+1 = 4k(k+1)+1 = (2k+1)^2$.
• If $8n+1$ is a perfect square, then $8n+1 = (2m+1)^2 \implies n = \frac{4m^2+4m+1-1}{8} = \frac{m(m+1)}{2}$ (because $8n+1$ is odd so it must be square of an odd number).
• Even if it never occurs to one that the square must also be odd we would have $8n+1 = m^2$ we'd get $n = \frac {m^2 - 1}8 = \frac {(m-1)(m+1)}8$ so one of m-1 or m+1 is even. If one is even the other is so if $m-1 = 2k$ then $m+1 = 2k + 2$ and .... it still follows. – fleablood Jan 11 '18 at 17:41