TITLE: If $n$ is an odd natural number, then $8$ divides $n^{2}-1$
QUESTION [9 upvotes]: I am trying to show that if $n$ is an odd natural number, then $8$ divides $n^{2}-1.$ I was able to prove that because I know that if $n$ is an odd natural number, then $n^{2}$ can be written as $8k+1$ for some $k\in \mathbb{N}.$ I would like to show this question by using the Euclidian division. Then I wrote $n^{2}-1=8k+r$, where $0\leq r  < 8.$ When $r=2$ we get $n^{2}-1=8k+2.$ Since $n$ is odd, then $n^{2}-1$ is even and I got stuck. Is there way to fix that?

REPLY [15 votes]: Here are are $8$ proofs $\pm1.\ $ First:  $\bmod 8\!:\ {\rm odd}^2 \equiv \{1,\,3,\!\overbrace{5,\,7}^{\large -3,\ -1}\!\!\}^{\large 2}\equiv \{\pm1,\:\!\pm3\}^{\large 2} \equiv 1 $

Alternatively,
$\ \ \rm n\ odd\ \Rightarrow\ n = 4k\pm1\ \Rightarrow\ n^2-1 = (4k\pm1)^2-1 = 8k \:\!(2k\pm1)$

Or: $\rm\: n\equiv u = \pm1\pmod 4\:\Rightarrow\: 4\:|\:n\!-\!u,\:2\:|\:n\!+\!u\:\Rightarrow\: 8\:|\:(n\!-\!u)(n\!+\!u) = n^2 - 1$

Or, it's easy by induction: it's true for $\rm\:n = 1,\:$ and if true for all odds below the odd $\rm\:n\!+\!2\:$ then $\rm\:(n\!+\!2)^2\!-1\: =\: n^2\!-\!1 + 4\:\!(n\!+\!1).\:$ But $\rm\:8\:|\:n^2\!-\!1\:$ by induction, $\rm\:8\:|\:4(n\!+\!1)\:$ by $\rm\:n\:$ odd.

Or, notice that $\rm\:mod\ 8,\:$ the function $\rm\:f(n) = (2n\!-\!1)^2\:$ is constant (hence $\rm\:f(n)\equiv f(1)\equiv 1)$ because its first difference is $\equiv 0,\:$ i.e.  $\rm\:f(n\!+\!1)-f(n) = (2n\!+\!1)^2-(2n\!-\!1)^2\! = 8n\equiv 0.$ 

By telescopy the prior proof yields the sum representation below, and a vivid proof.
$$\rm\quad (2n+1)^2 - 1\: =\:  \sum_{k\!\:=\!\:1}^n\!\: 8k$$

More generally, it's the special case $\rm\:m = 8,\:\lambda(8)=2\:$ of the Euler-Carmichael theorem
$$\rm\ gcd(a,m) = 1\ \Rightarrow\ a^{\lambda(m)}\equiv 1\pmod{m}$$