I'm working on a RSA encryption algorithm, and I can put in the formula and get the result I want, but I'm trying to understand how it is doing what it's doing.
So the theorem in its basic form is:
If GCD(x, y) = 1; and x < y; then xφ(y) ≡ 1 (mod y)
So for 8 and 21:
8φ21 ≡ 812 ≡ 1 (mod 21)
Where Φ(n) is all the numbers that are relatively prime to n for 1 to n - 1 (i.e. all the numbers in that range than have no factors in common with n other than 1).
But my question is why is this the case? Why is xφ(y) always congruent with 1 for a modulo of y? (When GCD(x, y) = 1; and x < y). I can't seem to get my head around what is going on conceptually, even though I can use the formula in practice. Any advice will be greatly appreciated.