I have started it like this
If $p>2$, then $p= 2k+1$ ,
$p^2= 4k^2 +4k+1$,
$p^2 -1 = 4k(k+1)$ ,
But I can't get how to make it divisible by $8$.
I have started it like this
If $p>2$, then $p= 2k+1$ ,
$p^2= 4k^2 +4k+1$,
$p^2 -1 = 4k(k+1)$ ,
But I can't get how to make it divisible by $8$.
$p^2-1=(p-1)(p+1)$ is a product of two even numbers. Since these are consecutive even numbers one of them must be divisible by $4$. So the product is divisible by $8$.
To complete your solution, remember that $k (k + 1)$ is always even.
We can also do a slightly different alternate solution.
Let, $p=4k-m, ~m\in\left\{1,3\right\}$ then we have,
$$\begin{align}p^2-1&=(4k-m)^2-1\\ &=16k^2-8km+(m^2-1)\end{align}$$
Finally, we observe that if $m:=1,3$ then
$$(m^2-1) \equiv 0 ~(\text{mod}~ 8).$$
Show that if $\;p>\;2$ is prime, then $\;8\;$ divides $\;p^2-1\;.$
Proof:
If $\;p>2\;$ is prime, then $\;p= 2k+1\;,\;$ where $\;k\in\mathbb{N}\;,$
moreover,
$p^2=4k^2+4k+1\;,$
$p^2-1=4k(k+1)\;.$
Since $\;k(k+1)\;$ is the product of two consecutive positive integer numbers, it is even, hence
$k(k+1)=2h\;,\;$ where $\;h\in\mathbb{N}\;.$
Consequently,
$p^2-1=4k(k+1)=4\cdot2h=8h\;,$
therefore $\;8\;$ divides $\;p^2-1\;.$