Saturday, December 4, 2010

On the remainder of powers of an integer

There’s a certain rule, which says that, when a number “a” divides different powers of another number N i.e. N1, N2, N3 … the remainders appear in cyclic form i.e. they repeat a fixed pattern.
Eg. 31 divided by 5 gives a remainder of 3
32 = 9 divided by 5 gives a remainder of 4
33 = 27 divided by 5 gives a remainder of 2
34 = 81 divided by 5 gives a remainder of 1
35 = 243 divided by 5 gives a remainder of  3
and that’s when the pattern starts repeating (3, 4, 2, 1, 3, 4, 2, 1, 3, 4, 2, 1…)

The proof of this is what will now follow. Note: I will only work with the domain of positive integers in the whole of this proof. 

Denote the remainder of any number x, divided by the number a, by the function R(x).

Now, first take a number  N, which, when divided by a, gives a remainder of r.
R(N) = r
Then, N = an + r (where n is an integer)
Raise N to the pth power (p being a positive integer)
Np = (an + r)p
= (an)p + ……… + rp
(by binomial expansion) ---- (1) 
Here, all the terms before rp have an “a” in them, and are therefore together a multiple of a.
So, Np = (multiple of a) + rp
Therefore, rp divided by a will give the same remainder as when Np is divided by a. *
i.e. R(rp) = R(Np) ---- (2)

Now let us prove something first:
If R(rx) = R(ry)
Then R(rx+1) = R(ry+1)

Say R(rx) = R(ry) = R' 
rx = nxa + R'
rx+ 1 = rx . r 
Thus, rx+1 = (nxa + R')r = r nxa + R'r
Similarly, ry = nya + R'
ry+1 = ry . r
ry+1 = (nya + R')r = r nya + R'r
Then, both rx+1 and ry+1 are in the form (multiple of a) + R'r
So R'r divided by a gives the same remainder as rx+1 divided by a
R'r divided by a also gives the same remainder as ry+1  divided by a
=> rx+1 divided by a gives the same remainder as ry+1 divided by a
R(rx+1) = R(ry+1) Proved.

From (2),
If R(Nx) = R(Ny)
Then R(Nx+1) = R(Ny+1) ---- (3)

Take R(Np) as R. If R is not equal to 0, then R can go from 1, 2, 3, 4, … upto a-1. That is a maximum of a-1 possibilities for the value of R. If every next R is different, then we can have at most (a-1) different R’s, after which, R will repeat a value already obtained before, and the rule stated in (3) will cause R to cycle among its fixed values.
Therefore, in the series R(N), R(N2), R(N3), R(N4) etc., we need only find a single repetition in the value of R to ensure that R will repeat in the same fashion ad infinitum.





* Addendum: We can use the rule stated in (2) to simplify finding the remainder of powers of large numbers, for example: 8725 divided by 7.
We note that 87 = 12*7 + 3
Thus, the remainder gotten when 8725 is divided by 7 is the same as the remainder when 325 is divided by 7. Then,
1. 3 / 7 -> 3 ---(1)
2. 9 / 7 -> 2 ---(2)
3. 27 / 7 -> 6 ---(3)
4. 81 / 7 -> 4 ---(4)
5. 243 / 7 -> 5 ---(5)
6. 729 / 7 -> 1 ---(6)
7. 2187 / 7 -> 3 ---(1)
That’s where the repetition starts. So it starts at 3 and cycles every 6 powers. 25 = 6*4 + 1. Thus, the remainder when 325 is divided by 7 is 3, and consequently, the remainder when 8725 is divided by 7 is also 3.

1 comment:

  1. Comment: Ok, I realize that to get to part (3), I could have directly proved if R(N^x) = R(N^y) then R(N^(x+1)) = R(N^(y+1)) instead of going through all that about r, but hey, atleast I was able to use the stuffs about r in the addendum.

    ReplyDelete