Respuesta :

You want to prove that

[tex]n^2\equiv k\mod8,k\in\{0,1,4\}[/tex]

for (presumably) all integers [tex]n\ge1[/tex].

Let's consider some sub-cases.

Suppose [tex]n=2\ell-1[/tex] is odd. Then

[tex]n^2=(2\ell-1)^2=4\ell^2-4\ell+1[/tex]

If [tex]\ell[/tex] is even, then so is [tex]\ell^2-\ell[/tex], which means you can write [tex]4\ell^2-4\ell=8m[/tex] for some integer [tex]m[/tex], and this reduces to [tex]n^2\equiv1\mod8[/tex].

If [tex]\ell[/tex] is odd, the same thing happens; you get that [tex]\ell^2-\ell[/tex] is still even, so [tex]4\ell^2-4\ell\equiv0\mod8[/tex] and you're left again with [tex]n^2\equiv1\mod8[/tex].

Now assume [tex]n=2\ell[/tex] is even. Then [tex]n^2=4\ell^2[/tex]. If [tex]\ell=2j[/tex] is even, then you will always be able to write

[tex]n^2=(2\ell)^2=4\ell^2=4(2j)^2=8\times2j^2\equiv0\mod8[/tex]

Meanwhile, if [tex]\ell=2j-1[/tex] is odd, then

[tex]n^2=4\ell^2=4(2j-1)^2=16j^2-16j+4\equiv4\mod8[/tex]

So you conclude that

[tex]n^2\equiv\begin{cases}0\mod8&\text{for }n\in\{4,8,12,16,\ldots\}\\1\mod8&\text{for }n\in\{1,3,5,7,\ldots\}\\4\mod8&\text{for }n\in\{2,6,10,14,\ldots\}\end{cases}[/tex]