Error in my approach to prove that $(m-1)^{m-1} \equiv m - 1 \pmod m$ using a concrete example I read somewhere that if $m$ is composite then $(m - 1)^{m - 1} \equiv m - 1 \pmod m$ and I was curious to try to prove it myself.
So I took as $m = 6$.
Now I can see that $5^5 \equiv 5 \pmod 6$
I was thinking along the following lines:
Since $\gcd(6,5) = 1$ this means that if we multiply $5$ with all the numbers from $1$ to $5$ we have to get all the numbers in different order.
I.e.
The numbers less than $6$: $1,2,3,4,5$.
Multiply the above by $5$: $5,4,3,2,1$ i.e. we get the same set of numbers but in different order.
Since: $1\cdot 2\cdot 3\cdot 4\cdot 5 = 5\cdot 4\cdot 3\cdot 2\cdot 1$ we also have:
$1\cdot 2\cdot 3\cdot 4\cdot 5 \equiv (1\cdot 5) \cdot (2\cdot 5) \cdot (3\cdot 5) \cdot (4\cdot 5) \cdot (5\cdot 5) \Leftrightarrow  1\cdot 2\cdot 3\cdot 4\cdot 5 \equiv 5^5 (1\cdot 2\cdot 3\cdot 4\cdot 5) \Leftrightarrow 1 \equiv 5^5$
Which is actually wrong.
What is the problem in my approach and thought process?

The fallacy in your argument is in the last step, where you "cancel" $1\cdot2\cdot3 \cdot 4\cdot 5$ from each side of the congruence.
As in ordinary arithmetic, you can only cancel factors that aren't $0$. (In fact, you can only reliably cancel factors that are relatively prime to the modulus.)
So in this case the assertion you are trying to prove is correct but your argument is not. The argument does work for arithmetic with a prime modulus.
