Skip to content

COMP 2711 - Discrete Mathematical Tools for Computer Science

This is the review notes for key concepts and theorems in discrete mathematics, particularly focusing on modular arithmetic, divisibility, and the properties of integers.

Modular Notation

Divisibility Notation

  • 312 (3 divides 12)
  • 311 (3 does not divide 11)

Euclid’s Division Theorem

For integers a and d:

a=dq+r
NoteNameNoteNameNoteNameNoteName
ddivisoradividendqquotientrremainder

Quotient Ring

The set of integers modulo m is defined as:

Zm={0,1,,m1}

Definition

For any a,bZm:

a,bZma+mb=(a+b)modmamb=(ab)modm

Properties

  • Closure: a,bZm,a+mbZm,ambZm
  • Associativity
    • (a+mb)+mc=a+m(b+mc)
    • (amb)mc=am(bmc)
  • Commutativity:
    • a+mb=b+ma
    • amb=bma
  • Distributivity
    • am(b+mc)=(amb)+m(amc)
  • Inverse: aZm,!bZm,a+mb=0,amb=1

Congruences

If

abmodm,cZ

then:

a+cb+cmodmacbcmodm

Greatest Common Divisor

The greatest common divisor is defined as:

gcd(a,b)=max({dZ| da,db})

Euclidean Algorithm

The process is as follows:

a=bq+r

Then:

gcd(a,b)=gcd(b,r)

Bézout’s Theorem

For all a,bZ+, there exist integers s and t such that:

gcd(a,b)=sa+tb

Extended Euclidean Algorithm

Example: express gcd(123,111) as a linear combination of 123 and 111

Step 1: find gcd()

123=1111+12111=912+312=43gcd(123,111)=3

Step 2: Rewrite

12=12311113=111912

Step 3: Substitute

3=111912=1119(123111)=9123+10111

Multiplicative Inverses

For all aZm,m>1 if gcd(a,m)=1, then:

!b,ab1modm

Example: a=4,m=9

Step 1: Linear Combination

1=924

Step 2:

27mod9

Linear Congruences

For axbmodm with gcd(a,m)=1:

a1axa1bmodm

If gcd(a,m)1, there may be multiple solutions or no solution.

Chinese Remainder Theorem

For x,y{m1,m2,,mn} such that gcd(x,y)=1:

xa1modm1xa2modm2xanmodmn

Let m=m1m2mn and define:

Mk=mmk,k=1,2,,n

If gcd(mk,Mk)=1, then:

ykMk1modmk

Finally, compute:

x=a1M1y1+a2M2y2++anMnynxa1m1m11+a2m2m21++anmnmn1modm

Repeated Squaring Method

Example: evaluate 204813mod2050

204820mod2050=2048204821mod2050=4204822mod2050=16204823mod2050=25613=20+22+232048132048232048222048202048162568mod2050

Fermat Little Theorem

For any prime p and integer a such that pa:

ap11modp