Suppose you need to know what the possible unit digits are for integers written on the form $4n^2$ for some integer $n$. Me myself have always just relayed on numerical investigation, i.e. compute the answer for the first few values of $n$ and assume that the observed pattern (if found) goes on for ever. For example.
The first few values of $4n^2$:
$[4, 16, 36, 64, 100, 144, 196, 256, 324, 400]$
Computing modulo $10$ of above numbers yields:
$[4, 6, 6, 4, 0, 4, 6, 6, 4, 0]$
And so I would just assume that the unit digit follow the pattern $(4, 6, 6, 4, 0,...)$ and deduce that the only possible unit digit values are $0,4,6$. But so far this is just an observation and one must prove that this pattern goes on forever if one is to be certain that the only unit digits possible are indeed $0,4,6$. How can you prove this or rather, what is the general approach for proving that patterns recognized modulo $m$ repeats to infinity? That is, don't get stuck on the fact that we are talking unit digits above. Another example would be $n^2 (mod 8)$ which gives the recognizeable pattern to prove:
$[1, 4, 1, 0, 1, 4, 1, 0, 1, 4, 1, 0, 1, 4]$
So to clarify, what I'm asking is: Do there exist a general approach or some tricks that are commonly used to prove that such modulo patterns continue forever? Or is it very "case specific" depending on the expression that you are working with, whereas sometimes you have to factor and other times use famous theorems etc.? Thanks.
Let's assume that you have found the length of the recurring pattern to be $r$. Then you want to show that $$f(n+r) \equiv f(n) \pmod {m}$$
For example, in the case of $f(n) = 4n^2, m = 10, r = 5$, you want to show that $$4(n+5)^2 \equiv 4n^2 \pmod {10}$$ This can easily be seen by expanding the square to get $$4n^2+40n+100 \equiv 4n^2 \pmod {10}$$