Link back to Home page

HTML version


1. Introduction to Proofs and Logic

Definition A statement (or proposition) is an expression that can be assigned the value of true or false

Anything that’s a question is not a statement.
In the example below, it’s a statement as the variable is “used up”. We really need to specify what’s happening to the variable for it to be a statement.

i=14i=10

Definition A predicate is a ‘statement’ whose truth is dependent on one or more variables

i=1ni=10

Definition A variable is a placeholder which gives a name to some entity that we want to consider

We can turn a predicate into a statement by specifying the set of values it applies to. Consider the example below:
This is a predicate unless we specify n,Z

i=1ni=n(n+1)2

Definition A set is a collection of elements which can be any type of mathematical objects

Set notation

The notation xX means that x is an element of the set X.
Eg: nZ means n is an element of the set of integers

Building a subset:
If P(x) means x is even, then this subset below is just the set of even number

{xX:P(x)}

Axiom If all xA are also in B and all xB are also in A then A and B are the same set.

Quantifiers - they help us turn predicates into statements

P(n) Is a predicate
But nZ P(n) is a statement

Universal quantifier

nZ n20

The expression above in words means “for every integer n, n2 is greater than or equal to 0”

Existential quantifier

nZ n2=289

“There exists at least integer n such that n2 is 289

Logical operators

Probably the best way to think about these, is to form a truth table (warning: may trigger past CS trauma…) - think of True as 1 and False as 0, binary

Definition

  1. Conjunction - both statements are true - like the AND logic gate
PQ
P Q P Q
0 0 0
0 1 0
1 0 0
1 1 T
  1. Disjunction - at least one statement is true - like the OR logic gate
PQ
P Q P Q
0 0 0
0 1 1
1 0 1
1 1 1
  1. Negation - the statement is false - like the NOT logic gate
P ¬ P
0 1
1 0

Definition. Tautology: A statement that is always true
Definition Contradiction: A statement that is always false

Logical equivalent - two statements have the same truth table

PQ

Rules - flashback to AQA CS being actually useful

Proving the De Morgan’s Laws - on Anki

“Break the line, change the sign”

Think about this analogy, let P be the statement: “A in even” and Q be the statement: “Q is even”.

Then PQ would be the statement: A is even and B is even
If we were to negate that statement, i.e ¬(PQ) would be result in the statement: “Either one of A or B is not even”

So $$ \neg (P \wedge Q) = (\neg P) \vee (\neg Q)$$
Consider the absorption rule below

P(PQ)PP(PQ)P

But how can we prove this?
Think back to the identity rule where we had: $$ P \equiv P \wedge T $$
So we have

P(PQ)(PT)(PQ)

After substituting, we can use the distributive rule, to factorise this:

(PT)(PQ)P(TQ)

Note, TQT (annihilation rule), so we’re left with P given the identity rule
Another way to think about it: TQ(Q¬Q)Q
Then after using communicative and associate rules by moving the brackets around, we have: $$ (Q \vee Q) \vee (\neg Q) $$
Then by the idempotent rule: QQQ
And then Q¬QT
Look at the gold example on notes…

Negating quantifiers

Consider this statement below:

nZ n20

What does it mean for the statement to be false?
It means nZ s.t.n2<0

In general…

¬(n P(x))n ¬(P(x))

Implications

PQ(¬P)Q

If P is false, then the statement doesn’t tell us anything about Q, the latter can be true or false

If we know that PQ is true, then:

But.. if PQ is true and P is also true, then:

This principle above is called modus ponens

Definition - A counterexample is where the first statement is true, but the second statement is false, which makes the implication false

If we were to negate the implication, we’d get:

¬(PQ)¬(¬PQ)

Using De Morgan’s, we get

¬(¬P)¬QP¬Q

So a counterexample by definition is when P is true and Q is not true

¬(PQ)P¬Q

To claim that a statement is false is the same as claiming that its negation is true

Consider this example in words:
What’s the negation of pZ, p is prime 2p1 is prime

pZ¬()

So this would be pZ s.t.p is prime and 2p1 is not prime

Converse and Contrapositive

Definition Converse of an implication PQ is the reversed implication QP

Definition Equivalence PQ is the same as PQQP. It’s an if and only if statement

Definition Contrapositive of an implication PQ is the implication ¬Q¬P

PQ¬Q¬P

Proof by contrapositive can be useful in some case. Consider the proof, n2 is even n is even. The contrapositive version of this would be n is not even n2 is not even. So if we start by taking n to be odd and then proving that n2 is odd, we have our proof for the original statement.

When P is true, then Q must also be true, but this also means that Q is false could only happen when P is false
We can prove this using the commutative and double negation rule

PQ(¬P)Q

Using the commutative rule we get:

Q(¬P)

Then using the double negation rule we have:

¬(¬Q)¬P

Notice how this is the definition of implies:

¬Q¬P¬(¬Q)¬P

Modus ponens

P(PQ)PQ

Proofs

Definition A Proof is a sequence of steps used to demonstrate that a statement is true

Proofs begin with a premise, aka a collection of statements/predicates that we accept as true (axioms).

The result that we want to show is the conclusion

Rules of Equality

When we say a=b, it means that a and b refer to the same indistinguishable objects

Proof by contradiction

The idea behind this is to take our premise and negation of conclusion as the assumption
The formal justification is that if we show ¬P implies another false statement, then we have proved that:

¬PF

And by using our logical equivalences

¬PF¬(¬P)FPFP

So if we have problem that the negation is false, then we proven that the original statement is true

Example- proving 2 is irrational

First we need by take our premise and the negation of our conclusion, i.e assuming that 2 is rational

2 rational a,b,Z s.t.a/b=2

And now we need to show that a,b,Z is false

So suppose a,b,Z, s.t.a2=2b2 - this is our premise

Let d be the greatest common divide of a,b (definition)

Then d is a divisor of a and d is a divisor of b (by defn of g.c.d)

uZ s.t.a=du
vZ s.t.b=dv

So we have (du)2=2(dv)2 (substitution)
After expanding an simplifying, we have:
(u2)=2v2
We’ve kind of got to where we started, but instead of having a and b, we have u and v, but instead this time, u and v cannot be even due to our introduction of the g.c.d.

But look again at our expression, u2 is even (defn of even), so u is even (previous result)
Therefore, kZ s.t.u=2k
So (2k)2=2v2 (substitution)

After some expanding and simplifying, we have that
(2k)2=v2
So this means that v2 is even (by defn of even) and v is even

So now lZ s.t.v=2l

And after we substitute back into the definitions of a and b, we get:

a=d(2k)$$$$b=d(2l)$$Westartedbyassumingthat$d$wastheg.c.dof$a$and$b$,buthere,$2d$istheg.c.dAs$d<2d$,$d$isnottheg.c.dof$a$and$b$,hence,wehavereachedacontradictionIfourstatement$P$was$d$istheg.c.dof$a$and$b$,then$¬P$was$d$isnotthegreatestg.c.dof$a$and$b$.Therefore,wehave$P¬P$,whichisacontradictionHence,ourpremiseisfalse,so$$a,bZ, a2b2

2. Integers

Axioms - set of properties that we accept without requiring a proof
How do we know that axioms are axioms?

There is a list of algebraic axioms and order axioms:

All of these axioms will hold true even if we work with the reals, naturals, and complex numbers, and that’s why we have the ordering axioms - which work for the set of integers.

For m,nZ, exactly one of the properties below hold:

Proof that 0<1 (proof by contradiction)

Our starting point to take the premise and negation of our conclusion as the assumption:

So suppose ¬(0<1)10

The scaling axiom says something about 0.

According to the shift axiom:

1+(1)0+(1)

Then using the negation, and identity axiom:

01

Scaling axiom, we can rescale by 1

1(1)0(1)

And by identity axiom:

10$$Thisisntapropercontradiction,eventhoughitmayfeellikeone,butfeelings,asweknow,arenotalwaysfacts.SoletskeepgoingBytheAntisymmetriccondition:$$0=1

Substitution:

0+1=1+1

By identity and negation

1=0

And by the identity axiom once again:

10

And hence we have contradiction

Note on the Well-ordering principle

Essentially, n is the least element of a set S if:

Proof of 1 being the least element of the set N1 of positive integers

Let n be least element of N1

We can say that

1n and n1

Assume 1n
But as n is the last element of N1 and 1N, so n=1

Now let’s assume that n1. What we’re trying to show that there are no elements between 0 and 1

We know that nN, so we can apply the scaling axiom to say that:

nn1n

So now is n2N?
We can use scaling axiom to say that:

0nnn

By the zero divisor axiom we have that nn=0n=0 or n=0
This is a contradiction as 0n

So we know that nnN

But we know that n is the lease element of N1

So nnn

nn+(1)n=1n+(1)n(n1)n=0n=0

So we have
n1=0 or n=0

So n=1

Proof by Induction

 If P(1)[n1,P(n)P(n+1)]P(n)T n1

Proof of the proof by induction

What we want to prove that is P(1) is true, then n1,P(n)P(n+1), then P(n) is true n1

And we'll prove it by contradiction. So we assume the conclusion is false, i.e. kN1 s.t.P(n)F

So if there exists at lease one number k where P(k) is false, we can collect all of them into a set:

S={kZ:k1:P(k)F}

This set S is non-empty, because we're assuming that there's at least one false case

By the W.O (well ordering) principle, every non-empty subset of N has a least (smallest) element, and since S is non-empty, there must be a smallest number, let that number be m.
This means that:

Now we have a few cases to consider:

If m is the smallest number where P fails, then consider n=m1, for which P(n) is true, by the inductive step we have:

P(m1)P(m)

So P(m) must be true, but as we've defined m to be the first case where P(m) is false as mS, this leads to a contradiction.

This means there are no numbers in the S which satisfy the property, so there is no point where induction fails.

Example

Suppose we want to prove that $$ \forall n \geq 1, n! \leq n^n$$
So we start with the base case, n=1

1!=1 and 11=1

Now for the inductive step, we want to prove the statement below:

n1,n!nn(n+1)!(n+1)n+1

We assume the statement holds for some n, and this is the induction hypothesis, so assume $$ P(n) = n! \leq n^n$$
And now we want to prove this for (n+1)

P(n+1)=(n+1)!(n+1)n+1

By the def. of factorial, we have

(n+1)!=(n+1)×n!

Now, using our scaling axiom and the inductive hypothesis (P(n)=n!nn), we have:

(n+1)×n!(n+1)×nn

As we know that n<n+1, we have that nn<(n+1)n. Using the scaling axiom again we have:

(n+1)×nn<(n+1)×(n+1)n=(n+1)n+1

Notice how this gives us the following:

(n+1)!<(n+1)n+1

Hence the result follows by mathematical induction

Weak vs Strong induction

In weak induction, we only look one step back, i.e. assume that P(n) is true and then use that to show that P(n+1).

Strong induction is slightly difference, as we assume all the past results to prove the next step in the induction step, i.e. use all P(1),P(2),...,P(n)P(n+1)

Decimal expansions, as covered in the next section, are an application of strong induction as we need the fact that every smaller number has a representation.

Decimal Expansions

#finishexplaination

Remainder Theorem

Useful for modular arithmetic which is useful for cryptography

Definition
If a and b are integers with b0, then there is a unique pair of integers q (quotient) and r (remainder) such that $$a = qb +r , \quad 0 \leq r < |b|$$
It's |b| because the absolute value makes it work whether b is positive or negative
Consider two cases below:

10=3×3+110=0×3+10

The second case is wrong because we can still take away 3 from 10. So that’s the idea of the proof, just keep taking away from the remainder until we’re left with a negative number as the remainder must be positive

Proof of the remainder theorem

The proof has few parts

Existence

Let's start with case 1: a0

The idea is that we keep subtracting |b| from a until what's less is less than |b|
Formally, we define a set:

S={rZ:r0 and qZ,a=q|b|+r}

So S is essentially the set of all non-negative remainders we can get when subtracting multiples of |b| from a

Consider case 2: a<0

If a is negative, we just flip the sign:

a=q|b|+ra=(q)|b|r

So the theorem works for all a, positive and negative

Showing r<|b|

Notice that S is non-empty as for q=0,a0|b|=a0 , so by the well-ordering, every non-empty set of non-negative integers has a smallest element

Let that smallest element be r.
Suppose for contradiction that r|b|
Then we can make a new remainder: r=r|b|

Notice that:

a=q|b|+r=(q+1)|b|+(r|b|)=(q+1)|b|+r

This means that r=r|b|0, so rS

We've just shown that r<r which leads to a contradiction as r is meant to be the smallest element, so rS, which means that r<|b|

Uniqueness

Suppose that there were two pairs:

a=q1|b|+r1=q2|b|+r2,0r1,r2<|b|

We subtract one from the other to get:

(q1q2)|b|=r2r1

This means that the left side is a multiple of b, but the right side is smaller than |b| as both remainders are between 0 and |b|

Now, if the left side is a non-zero multiple of b, then its absolute value must at least be b, but the right side is strictly less than b. So the only way this equality can hold true is if the right side is 0

So r1=r2 and therefore q1=q2

So the pair (q,r) is unique

3. Divisibility and Euclid’s Theorem

Definition An integer d is a divisor of the integer a iff there is an integer b such that db=d

Notation - d|a means d is the divisor of a (i.e ad is a integer but we’re not allowed to write it in division/fraction form)

Fun fact - not every integer is a divisor of every other integer

Greatest Common Divisor

Definition The greatest common divisor of a and b is the unique integer d satisfying:

Notation - the greatest common divisor of a and b is given by: gcd(a,b)

Euclidean Algorithm

Essentially, the Euclidean Algorithm finds the gcd of two integers a and b

Consider the example below: a=252 and b=105

We do repeated division:

252=2×105+42 remainder 42105=2×42+21 remainder 2142=2×21+0

When the remainder becomes 0, the last non-zero remainder is the greatest common divisor. Hence gcd(252,105)=21

Basically, we repeatedly apply the remainder theorem on numbers and do some shifting until the remainder is 0. The proof of the Euclidean will be covered later in the module

a=q0b+r0,0r0<bb=q1r0+r1,0r1<r0r0=q2r1+r2,0r2<r1ri=qi+2ri+1+ri+2,0ri+2<ri+1rn2=qnrn1+rn,0rn<rn1rn1=qn+1rn+0,00<rn

where rn=gcd(a,b)

Each line a=qb+r says the same common divisor that divide a and b will also divide r. And this is where the linear combination in the section will come in.

Divisors and Linear Combination

Cancellation Lemma - if m,b,pZ s.t. mpnp and p0, then m=n

We can use this lemma and the linear combination to prove Eucledian's Algorithm

If a,b are integers with a=qb+r then gcd(a,b)=gcd(b,r)

Now, if we can show that any common divisor of (a,b) also divides (b,r) and any common divisor of (b,r) also divides (a,b), this is means common divisors are the same, so their greatest common divisor must be the same, i.e. gcd(a,b)=gcd(b,r)

Let the common divisor of (a,b) and (b,r) be d. And we want to show that d|r and d|a. It's like showing that two subsets are equal, which means they are the same set.

So if d|a and d|b, then a=dk1 and b=dk2, kZ

Now, using the remainder theorem we have:

dk1=q(dk2)+rdk1qdk2=rd(k1qk2)=r

Hence d|r

Now to prove the converse - if d|bd|rb|a

b=dk3 and r=dk4 kZ

Using the definition again we have:

a=q(dk3)+dk4=d(qk3+k4)

Hence, by definition, we have d|a

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

Proof of Euclid’s Algorithm

The Euclid algorithm is essentially the step above repeated

a=q1b+rb=q2r1+r2r1=q3r2+r3

until the remainder becomes 0:

There's a nice proof by contradiction to show that this process does not go on forever. So assume this goes on forever, then the set containing all the remainders is: S={r1,r2rn} will have no least element-- which contradicts the W.O axiom, so there must be a least element, which is rn=0

By the rule, we've just proved that:

gcd(a,b)=gcd(b,r1)=gcd(r1,r2)==gcd(rn1,rn)

So when we finally hit rk=0, the gcd is the last non-zero remainder:

gcd(a,b)=rn1

Euclid’s Algorithm for Polynomials

The operation on polynomials satisfy all of the algebra axioms as the integers do, so they are an example of a commutative ring. But matrices are an example of non-commutative ring as they don’t saying the commutativity axiom

Definition A commutative ring is a set R equipped with two binary operations: +, and satisfying the axioms Op, Id, Neg, Comm, As, Dist

Bezout’s (Bucket) Identity

Definition If a and b are integers, then u and v s.t.

gcd(a,b)=au+bv

And then gcd(a,b) is the least positive integers of the form of au+bv(u,v)Z

Consider two buckets, one 4 litre and one 7 litre, now, can we measure 1 litre using those two?
Well, fill up the 4l twice and then pour it in the 7l, whatever’s left in the 4l is 1l, and that’s what Bezout’s Identity is telling us - we can solve the bucket problem when the gcd is what we’re trying to measure.

Ideals

The proof of Bezout’s Identity involves a set called ideals

Definition Let R be a ring, then the subset of I in R is an ideal if:

Notice how this is similar to vector sub spaces in linear algebra.

For example:

Closed means that we don’t have to move outside the set if we apply an operation, i.e. if set S has an operation , then S is closed under if

S1,S2S1S2S

Proof of Bezout’s Identity

Lemma 3.14 Let a,bZ, then the set:

I={au+bv:u,vZ}

Is an ideal in Z as it's is non-empty because we can have a(1)+b(0)I and it's is closed under addition and multiplication

Now, let I be a non-zero ideal in Z, then dI s.t.:
Lemma 3.15

xId|x

In other words, take any non-zero ideal IZ, then dZ s.t.

This means I has the form:

I={nd:nZ}

What this basically means is that every ideal in Z is made of all the multiples of one single number. And that one number is the smallest positive element in that ideal.
Why do we care? Because Bezout's identity is about showing that the gcd of this idea is the smallest positive element in that ideal. In other words, for any ideal IZ, when we input the ideal of all linear combinations a,b, the the output d gives us exactly gcd(a,b) -- which is very cool!!

So we let d be the least positive element of I (W.O principle)

Now we want to show for the iff that:

  1. xId|x
  2. d|xxI

2.Suppose d|x
qZ s.t.x=qd
dI by definition
qZ
I is an ideal
So x=qdI because by definition an ideal is closed under multiplication by any integer, all multiples of dI

  1. Let xI
    Then by the remainder theorem we have x=qd+rq,rZ0r<|d|
    We know that dI(q)dI as by definition, multiplies of d are in I as ideal is closed under multiplication

Now, r=xqd=x+(q)d
as xI and (q)dI x+(q)dIrI
As r<d by definition of the remainder theorem, and d is the least a positive positive element of I, r is not positive r0, but as we have that r>0r=0

Hence, we have shown that x=qd+0=qd, so every element of I is in fact a multiple of d

Now, all that remains is to show that d is the gcd(a,b)

So let:

I={au+bv:u,vZ}

This is an ideal by Lemma 3.14, and so by Lemma 3.15, dI s.t. d|x xI

Since dI, by definition, u,v s.t. d=au+bv

Now, we want to show that d divides both a and b.
Note that both a and b are in I, so:

Therefore, d is a common divisor of (a,b)

Let c be any common divisor of (a,b)

So any common divisor of c of (a,b) satisfies:

c|d|c||d|

This means that d is at least as big as any other common divisor, but since d is positive, we have:

c|c|d

Therefore, d=gcd(a,b)

Lamé’s Theorem

Definition
The number of steps in the Euclidean algorithm does not exceed 5 times the number of decimal digits in the smaller of the two numbers.

Eg: if we apply the Eucledian algorithm to integers with 100 digits, then we require no more than 500 steps in the algorithm.

The proof of this beautifully involves the Fibonacci and the golden ratio.

Co-prime integers

Definition Two integers a and b are co-prime if gcd(a,b)=1

Definition Integers a1,a2,,an are mutually co-prime if gcd(ai,aj)=1,ij

Eg: integers 6,10,15 are co-prime but not mutually co-prime

Two integers are co-prime x,y s.t. ax+by=1

If gcd(a,b)=d, then

gcd(ma,mb)=mdm>0gcd(u,v)=1

Where a=ud and b=vd

Let a and b be co-prime, then:

a|cb|cab|ca|bca|c

Note how this only works if the numbers are co-prime. The proof of both of them are in in notes.

Least Common Multiple

Pretty much self-explanatory, the lowest common multiple of two numbers is just the product of those numbers divided by the greatest common divisors of two numbers
If a,bZ and if d=gcd(a,b) and l=lcm(a,b) . Then:

dl=abl=abgcd(a,b)

Linear Diophantine Equations

Let a,b,cZ and a,b0, let d=gcd(a,b). Then the equation

ax+by=c

Has integer solutions gcd(a,b)|c and if it does, then there are infinitely many solutions:

x=x0+qn,y=y0pn(nZ)

Where a=pd,b=qd and (x0,y0) is any particular solutions. It’s a bit like doing differential equations.

Proof

The if an only if part is just Bezout’s identity. Any common divisor of a and b divides every intger linear combination of a and b

So now we just need to prove what the general solution looks like

So assume we have one particular solution, so let (x0,y0) satisfy ax0+by0=c. And now we want to find out all the other pairs (x,y) that also make ax+by=c

Let nZ s..t

x=x0+qn,y=y0pn

Where a=pd and b=qd

Now we put this in the ax+by=c to get:

a(x0+qn)+b(y0pn)=ax0+by0+aqnbpn=c+d(pqqp)n=c

So this works for any integer n

Now we need to show that these two are the only solutions, so we suppose that (x,y) is any integer solutions

We subtract the two equations to get:

a(xx0)+b(yy0)=0

After substituting a=pd and b=qd we get:

pd(xx0)+qd(yy0)=0

After dividing through by d (the cancellation lemma), we have:

p(xx0)=q(yy0)

What this tells us that the difference between any two solutions is related by p and q. And since p and q are co-prime, because that’s what happens when we divide by the gcd, the only way this equality holds in integers is if:

xx0=qn,yy0=pn,nZ

Which is exactly the formula for the infinitely many solutions

4. Prime Numbers

Definition An integer p>1 is irreducible if the only positive divisors of p are 1 and itself

Definition An integer p>1 is prime if a,bZ, whenever p|ab either p|a or p|b

For example, to prove that 2 is a prime number, we need to show that 2|ab2|a or 2|b

By the remainder theorem, qiri s.t. a=2q1+r1, b=2q2+r2,0r<2

So we have:

ab=(2q1+r1)(2q2+r2)=2(2q1q2+q1r2+r1q2)+r1r2

We also know that ab is even, so ab=2k+0
As the remainder theorem only gives unique values:

r1r2=0r1=0 or r2=0 by Z.D2|a2|b

Therefore, 2 is a prime number

Primes and Irreducible

Prime and irreducible really mean the same thing, at least for the integers.

Fermat was said to be confused about this difference too. If factorisation of irreducible numbers was unique, then Fermat’s last Theorem would’ve been a lot easier (why?) In other things however, this is not always true. For instance, consider the ring:

R={a+b5,a,b,Z}

Now, I hope we can agree that

2|4=(5+1)(51)

But 2 does not divide 5+1, so by definition of a prime, 2 is not prime

prime irreducible:

Assume p is prime and p=ab,b>0 (premise)
By definition, p|a or p|b.
WLOG (without loss of generality), assume that a=pk,kZ Then:

p=ab=pk(b)=p(kb)

By the cancellation lemma, we have 1=kb so b1. But as b>0b=1a=p. Therefore, 1,p are the only positive divisors of p, so p is irreducible

Irreducible prime

Note that this is not always true, as with our example in the ring, but in integers, this will work
So let p be irreducible and suppose p|ab. Then we want to show that p|a or p|b

As p is irreducible and since gcd(a,p) is a positive divisor of p, then gcd(a,p) must be 1 or p

If the gcd(a,p)=p, then as gcd(a,p) also divides a, it follows that p|a

On the other hand if the gcd(a,p)=1, then by definition a and p are co-prime and by Bezout's identity, we have that:

1=px+ay

Multiplying the entire equation by b we have:

b=pbx+aby

By our assumption, as p|abp|aby and p|abx. Therefore the RHS is divisible by p and therefore p|b

Lemma 4.4: If p is prime and p|a1,akp|ai for some i - this can be proved by induction, which is in the notes

The Fundamental Theorem of Arithmetic

Each integer n>1 has prime-power factorisation:

n=p1e1pkek

Where p1,,pk are distinct primes and e1,ek are positive integers. The factorisation is unique, apart from permutation of the factors

Say I wrote a prime factorisation of 12, how can I know that the prime factorisation is unique? That's exactly what the fundamental theorem of arithmetic allows us to do - every integer n>1 is can be written as a product of primes, and this factorisation is unique up to reordering.

The proof of this has two parts:

Existence - using strong induction

Base case: n=2. We proved earlier that 2 is prime, so its factorisation is simply: 2=21

Induction hypothesis: assume every integer strictly between 1 and n already has a prime-power factorisation.

Inductive step: prove it for n. There are two cases here:

1 - n is prime, which case n=n1 and we're done
2 - n is composite

In case 2, let n=ab,1<a,b<n

Now both a,b have prime power decomposition by the induction hypothesis, so by substituting these into the equation n=ab, and then collecting powers of each prime pi, we get a prime-power factorisation for n

Uniqueness

This will also be done by strong induction.

Base case: Suppose n=2 has factorisation 2=p1e1p2e2pkek

Then by definition each prime pi2. If there is any prime p1>2 contradicts p1e1p2e2pkek=2
Hence the only factorisation of 2 is 21

Induction step: assume that n>2 and that for every integer strictly between 1 and n has a unique prime factorisation up to ordering

Now suppose we had two different factorisation:

n=p1e1p2e2pkek=q1f1q2f2qlfl

Where all pi and qi are primes. Then our aim to show that these two sets of distinct primes are the same, up to reordering

From the first factorisation, we have that: p1|n
So in the second factorisation, by Lemma 4.4 earlier, we know that:

p1|q1f1q2f2qlfl

Since p1 is prime, it must divide one of the qj, but each qj is prime too. So the only possibility is that: p1=qj

This essentially allows us to match up one prime from each factorisation. WLOG, we can order the primes so that: p1=q1

Now we have that

p1e1p2e2pkek=q1f1q2f2qlfl

We can cancel p1=q1 from both sides to get:

p1e11p2e2pkek=q1f11q2f2qlfl

And this new number is strictly smaller than n.

If this new number is 1, the k=l=1,e1=f1,p1=q1, so the two factorisation were the same.

Otherwise, p1e11p2e2pkek is strictly between 1 and n so by the induction hypothesis, it has a unique prime factorisation up to reordering. So k=l,e11=f11 and p2e2pkek=q2f2qlfl up to reordering.

Hence by induction, this holds n>1

We can how take this theorem and show that if a positive integer n is not a perfect square, then n is irrational, i.e. if n is not a perfect square, then there are no non-zero integers s.t. b2n=a2
This can be done by a proof by contrapositive, look at the notes for this.

Distribution of Primes

Euclid’s Proof of Infinitely Many Primes

Our strategy here is fairly simple:

Assume we have all the primes are:

p1,p2,pk

Now we define a new number:

N=p1p2pk+1

Now we look at the product of the primes in N. We can notice that every prime pi divides that product, but N is exactly 1 more than the product of all the primes.

So none of the primes p1...pk divide N

By the fundamental theorem of arithmetic that we proved earlier, every integer has a unique prime factorisation, so N must have at least one prime divisor, say q

But since none of the primes in our list can divide N, this new prime q cannot be one of the primes in p1,...pk, therefore q is another prime, which contradicts the assumption that we had all the primes

Estimating Distributions

I won't go into a lot of detail for this section, mostly because it's explained in the notes, but there are few decent, and not so decent, ways of estimating primes which can be proved by strong induction.

A very weak estimation is given by:

 The nth prime pn satisfies pn22n1  n1

The Prime Number Theorem however, is more of the interesting side of things, which uses this function:

 li x=2xdtlnt

It tells us how the proportion of primes goes, something else which might be of interest is to look up Skewe's number

5. Congruences

Fun fact: a perfect square must leave a remainder 0 or 1 when divided by 4

Definition Let n be a positive integer, and let a and b any integers, we say that a is congruent to bmodn written as:

abmodn

If a and b leave the same remainder when divided by n, then the remainder if the residue of a (or b) module n And the number n is the modulus

There is more than one way to think about congruence, the following are equivalent:

What the above essentially means is that is a divide a or b by n, then both of those remainders are the same. So a=q1n+r and b=q2n+r and when we rearrange, we get: a=b+(q1q2)n

abmodnkZ s.t. a=b+kn

Proving the next statement is just a rearrange to get: (ab)=kn which is the same as:

abmodnn|(ab)

so abmod2 means both a and b have the same parity, either they’re both even or both odd

The properties of reflexive, symmetric and transitivity can also be seen for congruence:

aa aZabbaabbcac

Modular Arithmetic

We can also think of modular arithmetic as the arithmetic in the quotient ring Z/(n). It's like all the numbers that differ by a multiple of n where n is the ideal (n)={nk:kZ}

Another intuition is to think of digits in base n, so working on mod7 is like throwing away full multiples of 7 and only taking the last digit.

Arithmetic of Congruences

For any n1, if abmodn uvmodn:

a+bu+vmodnabuvmodn

Now, if abmodn and iN0, then

aibimodn

However, it’s important to note that if a,bZ and ijmodn, then:

aiajmodn

A simple example is that, 21210mod9 even though 110mod9

Cancelling factors in congruences

Suppose axaymodn

Now, we want to cancel out a, but can we do that? By using another equivalent definition we get that:

axaymodnn|a(xy)

Now, cancellation is allowed gcd(a,n)=1, i.e. a,n are co-prime. This is because then the only way for n to divide a(xy) is for it to divide (xy)xymodn

Once again, notice the pattern, happens to links back to primes and composites and irreducibility

Multiplicative Inverses

Definition

A multiplicative inverse modulo n for a number aZ is a number xZ s.t. ax1modn

And this inverse exists gcd(a,n)=1

We can notice that this comes directly from Bezout's Identity, as if gcd(a,n)=1, then x,yZ s.t. ax+ny=1. So solving a multiplicative inverse is the same as finding solution to linear Diophantine equation, which we have proved before.

And similar to linear Diophantine equations, if it has one solution, then it has infinitely many solutions, form a congruence class (more on this in the later section)

Divisibility

If one number divides another, then we can say that:

n|mm0modn

So if n divides m, then m leaves remainder 0 when divided by n

For example, consider want to prove that 6|a(a+1)(2a+1)
We can use the fact above to rewrite this as:

a(a+1)(2a+1)0mod6

Now, instead of trying to expand the expression, we can see that integer is congruent to one of 0,1,2,3,4,5mod6, i.e. a0,1,2,3,4,5mod6. It's like the remainder theorem. So by checking those 6 cases proves the statement for all integers

Another example is suppose we want to show that:

a2amod2

Now we don't need to test this for all the integers, all we need to do is test this for a=0,1 and we're done. Because when we divide by 2, we only have 2 possible remainders.

So to prove something for all integers, we can only check for possible remainders, because modulo n every integer behaves like its remainder.

Theorem 5.17
If p and q are co-prime, then a,bZ,

abmod(p1)abmod(p)abmod(q)

What this basically means is that to check divisibility by pq, it's enough to check divisibility by p and q when p and q are co-prime. And so with our previous example, we can say that:

6|a(a+1)(2a+1)2|a(a+1)(2a+1)3|a(a+1)(2a+1)

This works as 2,3 are co-prime

Residues

A complete set of resides modulo n is a set of n integers containing a unique element from each congruence class modn.

What this means is that every integer m is congruent to exactly one residue:

mrmod(n) for a unique r{0,1,...n1}

By the remainder theorem, we have that every integer a can be written in the form of:

a=qn+r0r<n

So r in this cases it the residue of amodn. It's the remainder theorem rephrased.

And then, two numbers are congruent modn if they give the same residue

The least non-negative residues of any number then is just the remainder when we divide by n

And then least absolute residues just allows us to work with both positive and negative residues. Sometimes, the usual residues are to big. Consider mod100, the residue of a number might be 99, but it would be nice to work with 1 because 991mod100. So instead of choosing a remainder between 0,n1, we just choose the one closest to 0

So when n is odd:

r=0,±1,±2±n+12

And when n is even:

r=0,±1,±2±n21,+n2

Polynomials over Zn

If f(x) is a polynomial with integer coefficients, and n1, then if

abmod(n)f(a)f(b)mod(n)

The proof of this is fairly trivial, as using the previous lemma we can show that all powers can be written using powers which work with the congruence rules of addition and multiplication. So Zn is just a ring

Showing that a polynomial has no integer roots

First, to show that a polynomial has a root, say f(x)=anxn+...+a1x+0, we have to show that rZ s.t. f(r)=0. Therefore, to show a polynomial has no integer roots, we're essentially trying to show that f(r)0 rZ

However, we cannot test infinitely many integers, so instead we pick a modulus n and show that for every possible residual class modn,f(r)0modn. This works well because every integer is congruent to exactly one residual class.

The reason is this works is because if a polynomial has an integer root, then it must have a root modn, so a proof by contrapositive means that if an integer has no root modn, then it cannot have integer root.

Consider the example: show that f(x)=x2+x+1 has no integer roots

We can do a proof by contrapositive to show that if f(x) has no root modn, then f(x) has no integer root. We need to find an n s.t. for all resides r, f(r)0modn

Now, choosing a value for n is trial-and-error.

So for the example, we can try mod2, which has only two resides: 0,1

r=0:f(0)=0+0+1=11mod2r=1:f(1)=1+1+1=31mod2

So for both residuals, we don't have a 0mod2, and therefore by proof by contrapositive, f(x) has no integer solutions.

Congruence Classes

Using the property of equalities, we define an equivalence relation if:

Equivalence class

Let's start with a simple question: how many different types of integers are there mod4?
Every integer is either something that leaves remainder 0,1,2,3 when divided by 4, so there are only 4 kinds of integers mod4.

So an equivalence class is just the set of all integers that are equivalent under some rule

So the equivalence class of x0 is just the set of all integers that give the same remainder as x0 when divided by n

[x0]={xX:xx0modn}

The class are disjoint, i.e. each integer belongs to exactly one class and this is what makes a partition

Partitions

A partition is just a collection of subsets that satisfy:

Congruence classes form a partition has every integer is congruent to exactly one remainder
No two integers can have two different remainders modn

So the congruence classes form a partition in Z, and each equivalence class is one pieces in that partition:

[a]={bZ|bamodn}={a+kn:kZ}{...,a2n,an,a,a+n,a+2n,...}

This is also a set of sets of numbers

Zn is a ring

Things being well-defined is just about addition and multiplication giving the same equivalence class when working with congruences. And once both of those operations are well-defined, then Zn by definition is a ring.

Linear Congruences

The process for solving linear congruences is very much the same as for solving linear diophantine equations:

If d=gcd(a,n) then the linear congruence

axbmodn has a solution d|b

And if d does divide b and if x0 is any solution, then the general solution is given by:

x=x0+ndt

And like mentioned before, the solutions form exactly d congruence classes modn with representatives:

x=x0,x0+ndt,x+2ndt,x0+(d1)ndt

Congruence class of solutions

Consider the congruence x3mod7. What this means is that x leaves a remainder 3 when divided by 7, so the solutions to all such values of x is the set of all numbers which we call a congruence class:

[3]7={3,10,17,244,11,18}

And this set is another way of all the numbers in the form of: x=3+7k

Simplifying congruences

Now, say we want to simplify a congruence like axbmodn

Recall that division modn is not always allowed, so we need to be careful when simplifying or cancelling factors. Look up Lemma 5.40 for a more concise explanation.

There are essentially to cases we need think about when dealing with simplification

Case 1: general case

Suppose m divides a,b and n, then

a=am,b=bm,n=nm

And

axbmodnaxbmodn

So if everything has a common factor of m, then we can cancel that factor from the congruence exactly as we do in normal arithmetic

Case 2: coprime case

If a,n are coprime, and m divides a,b, then

axbmodnaxbmodn

So if a,n share no common factors, we can divide by any common factor of a and b without changing the modulus.

It's important to keep the two cases above in mind when solving congruences in the next section

Algorithm to solve congruences

Suppose we have the congruence: 10x6mod14

What this is asking is essentially, which integer x produces a number that has a remainder 6 when multiplied by 10 and then divided by 14. i.e. we want to find all values of x s.t. 14|10x6 which is equivalent to solving:

10x6=14k

It's important to point out that congruences themselves are not equations, they describe a pattern of remainders. So when we're solving a congruence, we're not looking for a single number, but rather finding a whole equivalence class.

Step 1: check whether a solutions exists

A congruence axbmodn has a solution gcd(a,n)|d

The gcd(10,6)|14 so a solution exists

Step 2: Simplify the congruence

Since the gcd is 2, we can divide everything by 2 using Case 1

10x6mod145x3mod7

This essentially makes the numbers smaller and ensures that the new coefficients and modulus are coprime

Then we check the gcd(5,7)=1 which means 5 and 7 and now we can solve the congruence by finding a multiplicative inverse

We can see that 53=151mod7, so 513mod7

So we can multiply both sides by 3 to get:

3(5x)33mod7

The LHS becomes: (35)x1x and the RHS is: 33=92mod7

Therefore:

5x3mod7x2mod7

So x0 is a particular solution, so the general solution has the form: x=2+7t

Simultaneous Linear Congruences

If we think of congruence like clock arithmetic, then simultaneous congruence is just finding a value for x that satisfies more than one 'clock condition' simultaneously

Chinese Remainder Theorem (CRT)

Imagine we want to solve the congruence:
x4mod5
x2mod3

Intuitively, we want to think of numbers have coordinates modulo primes. So take mod3 and mod5 for example. A number x can be described by:

So with the original problem we're looking for a number x s.t. when we divide it by 5, we get remainder 4 and when we divide it by 3, we get a remainder of 2

So we can check the numbers 014 and see that the solution is x=14
As if x=14, then

So what the CRT tells us is that every pair of these coordinates corresponds to exactly one number mod15. The lecture notes explain this intuition fairly well with the grid

We can also think of uniqueness as a bijection, since mod3 gives up 3 options and mod5 gives us 5 options. So a total of 15 possible pairs and each pair corresponding to one xmod15

Formally, the CRT gives us a complete solution to such problems:
Definition

 Let n1,n2nkZ+ with gcd(ni,nj)=1,ij, Let a1,a2akZ. Then xa1mod(n1),xa2mod(n2),...,xakmod(nk) form a single congruence class modn,n=n1,n2nk

6. Lagrange's Theorem and Fermat's Little Theorem

Before we introduce Lagrange's Theorem it's important to know that it works only for congruence class of Zp where p is prime. This means Zp is a field, where:

If p was not prime, then polynomials would have more than d roots, eg: x21 has 4 congruence class roots mod8

Lagrange's Theorem

Definition
If p is prime and $f(x) = a_d x

The proof is given in notes and it pretty good, so I won't bother rewriting it here, but I will convey the general idea.

Say u was a root, then f(u)0 and (xu) would divide f(x)modp

This is just the modular version of the factor theorem:

f(u)=0(xu) is a factor of f(x)

So every single root takes out one factor, and if we had more than d roots, then we'd get more than d factors of the form (xui) which is not possible for a degree d polynomial

Fermat's Little Theorem

ap11modp,a0modp

There are a few ways of proving this, without any knowledge of group theory, we think of multiplying all non-zero residues modp

12p1

Then:

(p1)!(p1)! ap1modp(p1)!(1ap1)0modp

And since p and (p1)! are coprime, we have that ap1modp1

This helps us finding roots of polynomials congruent to polynomials mod primes

Wilson's Theorem

Definition

 An integer n>1 is prime(n1)!1modn

This is an application of Fermat's Little Theorem, and it was first actually proved by Lagrange.

What this means is that when we are working modp, we multiply all the nonzero elements: 1,2,3...p1

So if p is prime, that means everything cancels except 1, so all the elements have a multiplicative inverse. i.e. in the set {1,2...p1} every element can be paired with its inverse so they cancel out

For instance, take p=7, and then take all the set of numbers mod 7: {1,2,3,4,5,6}

This gives us the pairings: (24)(35)(1)(6)111(1)

This gives us:
6!1mod7

It's important to think for understanding why this won't work for composite numbers, because if n was composite, then not every nonzero element would have any inverse, so we wouldn't have the pairings that lead to the cancellations.

For some supplementary resources/notes, I highly recommend watching Michael Penn videos which go through the proof of CRT, and everything else below.

Square roots modpq

Let p be an odd prime, then:

x21modp has a solution p1mod4

Instead of thinking of this as a new theorem, consider the question that for x2amodp to have solutions, we want to know if a is a square in the multiplicative system mod p

We want a formula for square roots: x2amodp
Using FilT, we have that ap11modp

And if a is a square, we have that

ap121ap+12a(ap+14)2=ap+12

So we have that ap+12 is a square root of a only if p+14 is an integer, and this only happens when p3mod4

Linking back to Wilson's theorem, we have that:

(p1)!1(1)p121modp

Now, if x21x41. So the order of x divides 4 which can only happen if:

4|(p1)p1mod4

7. Euler's Function

This section does not contain any proofs as they were covered in good detail in the lectures notes.

Euler’s Totient Function

When working modn, we want to know how many of those numbers are coprime to n, because those numbers behave nicely under multiplication. And all Euler's function does is count how many of such numbers exist:

ϕ(n)= number of integers 1kn that are co-prime to n

Euler’s Theorem

gcd(a,n)=1aϕ(n)1modn

When n=p is prime, we can see that every 1ap1 is co-prime to p
So ϕ(p)=p1

And by Euler's theorem, we have that: ap11modp

Which is just Fermat's Little Theorem! So FLT is just a special case of Euler's

Euler’s Product Formula

This formula tells us how to compute ϕ(n)

n=p1k1prkrϕ(n)=np|n(11p)

m,n coprime ϕ(mn)=ϕ(m)ϕ(n)

8. Applications to Cryptography

RSA is a type of encryption which is essentially solving the problem of - how can two people communicate using only public information. You might've heard that RSA works well assuming that it's really hard to factorise really large prime numbers.

We we want to a function that is:

And exponentiation modn is the perfect solution for this

We already know that computing xkmodn is easy, and with Euler's Theorem, we know that exponents cycle modulo ϕ(n)

Suppose we choose two exponents e and d such that:

ed1modϕ(n)ed=1+kϕ(n)

Now take any message m with gcd(m,n)=1 and compute:

(me)d=med=m1+kϕ(n)m(mϕ(n))k

Euler's theorem gives us:

mϕ(n)1modnmedmodn

What this tells us that we can encrypt with e and decrypt with d

If we want to apply Euler's Theorem, we need control over ϕ(n), and the invertibility of exponents modϕ(n), therefore, we must choose n=pq with p,q being prime numbers as then:

ϕ(n)=(p1)(q1)

So to summarise, it's easy to:

And it's hard to:

Therefore the public key in RSA is (n,e) is the private key is d or equivalently (p,q)