# Why is $x^2+1$ divisible by $10$ if $x$ has a $3$ or $7$ in the one's place?

So I have the simple polynomial $x^2+1$. If I plug in ANY number that has a $3$ or a $7$ in the ones place $x^2+1$ is divisible by $10$. Why? Is there a reason for this?

So numbers like $3,7,13,17,23,27,\ldots$ when plugged into $x^2+1$ is divisible by 10. Why? Is there a reason for this?

• $x$ ends with a $3$ means $x^2$ ends with a $9$. $x$ ends with a $7$ means $x^2$ ends with a $9$. Now add 1. They both end with a $0$ – George Feb 10 '16 at 18:48

and similarly for $7$.
• Alternatively, one could do $x^2+1\equiv 3^2+1\equiv 0\mod 10$. Nice solution though, +1 – vrugtehagel Feb 10 '16 at 18:50
• We can write this, incidentally, as $(10k \pm 3)^2+1 = 100k^2 \pm 60k + 9 + 1 = 10(10k^2\pm 6k+1)$, and take care of both cases. It also shows how they're related. – Brian Tung Feb 10 '16 at 18:52
• @BrianTung Yes, a nice observation; and for even more generality this is related to the fact that $k^2$ and $(n - k)^2$ have the same residue mod $n$. – user296602 Feb 10 '16 at 18:53