Jump to content

Modular Arithmetic

From UBC Wiki

Modular arithmetic is a system of arithmetic that concerns remainders. Instead of mainstream notation, I have introduced a new notation. I will provide examples to clarify. For the duration of this text, variables are denoted by italicized lowercase letters, and can represent any integer, unless restrictions are specified. n, however, is always positive.

Axioms

Remainders

Define

Rn(a)

to be the remainder when a is divided by n.

Example:

R5(13)=3

Define the axiom

a=kn+Rn(a)

for some k.

Example:

13=5k+R5(13)=5(2)+3

Congruence

Define the relation

Cn(a,b)Rn(a)=Rn(b)

Example:

R5(8)=R5(13)3=3C5(8,13)

Define the axioms

Cn(a,a)
Cn(a,Rn(a))
Cn(a1,a)
Cn(kn+a,a)

Define the axioms

Cn(a,b)Cn(b,a)Cn(a,b),Cn(b,c)Cn(a,c)

Define the axiom

Cn(a1,a2),Cn(a2,a3)Cn(ai1,ai)Cn(a1,a2,a3ai1,ai)

where i is any positive integer.

Theorems

Additive Property

Define the relationship

Cn(a+b,Rn(a)+Rn(b))

Proof:

Let

a=cn+Rn(a)b=dn+Rn(b)

Then

Cn(a+b,cn+Rn(a)+dn+Rn(b),n(c+d)+Rn(a)+Rn(b),Rn(a)+Rn(b))

Corollary:

Cn(a,b)Cn(a+c,b+c)

Multiplicative Property

Define the relationship

Cn(ab,Rn(a)Rn(b))

Proof:

Let

a=cn+Rn(a)b=dn+Rn(b)

Then

Cn(ab,cndn+cnRn(b)+Rn(a)dn+Rn(a)Rn(b),n(cdn+cRn(b)+Rn(a)d)+Rn(a)Rn(b),Rn(a)Rn(b))

Corollary:

Cn(a,b)Cn(ac,bc)

Exponential Property

Define the relationship

Cn(ab,(Rn(a))b)

where b is positive.

Proof:

Assume this relation holds for some b. Then

Cn(ab+1,aba,Rn(ab)Rn(a),(Rn(a))bRn(a),(Rn(a))b+1)

Therefore, it follows that if this relation holds for b, it also holds for b + 1. Let b = 1. Then

Cn(a1,(Rn(a))1)
Cn(a,(Rn(a)))

This holds true. Therefore, this relation holds true for any positive b.

Corollary:

Cn(a,b)Cn(ac,bc)

where c is positive.

Divisor Rule

Define the relationship

Cxy(a,b)Cx(a,b),Cy(a,b)

where x and y are positive.

Proof:

Cxy(a,b)Rxy(a)=Rxy(b)=r

for some r. Let

a=cxy+rb=dxy+r

Then, it follows that

a=jx+rb=kx+r

And

Cx(a,jx+r,r)
Cx(b,kx+r,r)

Therefore

Cx(a,b)

Similarly for y.

Product Rule

Define the relationship

Cx(a,b),Cy(a,b),gcd(x,y)=1Cxy(a,b)

where x and y are positive, and gcd is the greatest common divisor function.

Proof:

Let

a=b+k1xa=b+k2yk1x=k2y

Then, by gcd(x, y) = 1,

k1=lyk2=lxa=b+lxy

Therefore

Cxy(a,b)

Exponential Identity

Define the relationship

Caq((a+b)p,i=0q1(pi)aibpi)

where

1<q<b

Proof:

This directly follows from the binomial theorem.

Exponential Congruence Theorem

If gcd(n, a) = 1, then there exists p such that

Cn(ap,1)

Proof:

Assume there does not exist such p. By the Pigeonhole Principle, there exist p1 and p2 such that

p1>p2>0,Cn(ap1,ap2)

Then, it must be the case that either

Cn(ap1p2,1)

or

Cn(ap1,0)

But since p1 - p2 > 0, this case contradicts the assumption. Then, the second case must be true.

But

Cn(ap1,0)ap1=kn

which is not satisfied since gcd(n, a) = 1. Therefore, the assumption is false, and the theorem is proven.

Examples

Problem 1

Does there exist a number that is a perfect square, a multiple of 2 but not a multiple of 4?

Solution:

This is equivalent to finding n such that

n=4x+2=y2

Then, if such n exists,

C4(2,y2)

Clearly, y = 2k. But

C4(2,(2k)2,4k2,0)

which is impossible. Therefore, n does not exist.

Problem 2

Given the function

f(x)={1,if x=1xf(x1),if x>1

find

R100(f(2009))

Note: this is equivalent to the last 2 base 10 digits of

200920082007321

Solution:

C100(f(2009),2009f(2008),9f(2008))

To simplify this, we look for simpler congruences. By the exponential identity, we get

C100(81p,1+80p,1)

if p = 5k. Therefore

C100(9f(2008),9R10(f(2008))910k,9R10(f(2008)))

To proceed, we use the product rule to split up 10 into 2 and 5, getting

C2(f(2008),2008f(2007),0)
C5(f(2008),2008f(2007),3R4(f(2007))34k,3R4(f(2007))81k,3R4(f(2007)))

for some k. To proceed, we evaluate

C4(f(2007),2007f(2006),3f(2006),32k,9k,1)

for some k. Then

C5(f(2008),3,8)
C2(f(2008),0,8)

Putting the product back together, we get

C10(f(2008),8)
R10(f(2008))=8
C100(f(2009),9f(2008),9R10(f(2008)),98,814,612,21)

Therefore, our desired result is

R100(f(2009))=21