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.
Definition A predicate is a ‘statement’ whose truth is dependent on one or more variables
- For a predicate, the variable is not “used up”
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
Definition A set is a collection of elements which can be any type of mathematical objects
Set notation
The notation
Eg:
Building a subset:
If
Axiom If all
- Proper subset (
) - Every element of is also in but not equal to - Subset (
) - Set is a subset of if every element of is also in
Quantifiers - they help us turn predicates into statements
But
Universal quantifier
The expression above in words means “for every integer
Existential quantifier
“There exists at least integer
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
- Conjunction - both statements are true - like the AND logic gate
| P | Q | P |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | T |
- Disjunction - at least one statement is true - like the OR logic gate
| P | Q | P |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
- Negation - the statement is false - like the NOT logic gate
| 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
Rules - flashback to AQA CS being actually useful
- Idempotent - something that squares to itself
- Eg:
or
- Eg:
- Notice how there’s a difference between associative and distributive
- Associate - the symbol is the same all the way
- Distributive - it’s like mixing the signs for
and
Proving the De Morgan’s Laws - on Anki
“Break the line, change the sign”
- Well, you can do it using truth table, or Venn diagram probably
Think about this analogy, let
Then
If we were to negate that statement, i.e
So $$ \neg (P \wedge Q) = (\neg P) \vee (\neg Q)$$
Consider the absorption rule below
But how can we prove this?
Think back to the identity rule where we had: $$ P \equiv P \wedge T $$
So we have
After substituting, we can use the distributive rule, to factorise this:
Note,
Another way to think about it:
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:
And then
Look at the gold example on notes…
Negating quantifiers
Consider this statement below:
What does it mean for the statement to be false?
It means
In general…
Implications
If
If we know that
and can be both true is false and is true and can be both false
But.. if
is also true
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:
Using De Morgan’s, we get
So a counterexample by definition is when
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
So this would be
Converse and Contrapositive
Definition Converse of an implication
Definition Equivalence
Definition Contrapositive of an implication
Proof by contrapositive can be useful in some case. Consider the proof,
When
We can prove this using the commutative and double negation rule
Using the commutative rule we get:
Then using the double negation rule we have:
Notice how this is the definition of implies:
Modus ponens
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
- reflexive
- symmetric
- Transitive
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
And by using our logical equivalences
So if we have problem that the negation is false, then we proven that the original statement is true
Example- proving is irrational
First we need by take our premise and the negation of our conclusion, i.e assuming that
And now we need to show that
So suppose
Let
Then
So we have
After expanding an simplifying, we have:
We’ve kind of got to where we started, but instead of having
But look again at our expression,
Therefore,
So
After some expanding and simplifying, we have that
So this means that
So now
And after we substitute back into the definitions of
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:
-
[Operations (Op)] The integers are equipped with two binary operations addition and multiplication. These operations are denoted by the symbols
respectively. -
[Identity (Id)] Z contains two special elements, denoted
and , with such that for any integer and . -
[Negation (Neg)] For every integer
, there exists an integer denoted such that
We writeas a shorthand for -
[Commutative (Comm)] Addition and multiplication are commutative, i.e.
-
[Associative (As)] Addition and multiplication are associative, i.e.
and -
[Distributive (Dist)] Multiplication distributes over addition, i.e,
-
[Zero divisors (ZD)] If
then or . -
[Order relation (Ord)]
is equipped with a relation called “less than or equal to”. -
[Reflexive (Ref)] Every integer
satisfies . -
[Antisymmetric (ASy)] Given two integers
, if and then . -
[Transitive (Tr)] If
are integers with and then . -
[Comparability (Comp)] Given any two integers
, or . -
[Shift (Sh)] If
are integers with , then -
[Scale (Sc) ] If
are integers with and then . -
[Well ordering (WO)] The well ordering principle – any non-empty subset of non-negative integers has a unique least element.
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
We can prove the other inequalities from the properties above
Proof that (proof by contradiction)
Our starting point to take the premise and negation of our conclusion as the assumption:
So suppose
The scaling axiom says something about 0.
According to the shift axiom:
Then using the negation, and identity axiom:
Scaling axiom, we can rescale by
And by identity axiom:
Substitution:
By identity and negation
And by the identity axiom once again:
And hence we have contradiction
Note on the Well-ordering principle
Essentially,
This is just means thatis the smallest element in the set, and if there is a smaller element than , then that element just equals .
Proof of being the least element of the set of positive integers
Let
We can say that
Assume
But as
Now let’s assume that
We know that
So now is
We can use scaling axiom to say that:
By the zero divisor axiom we have that
This is a contradiction as
So we know that
But we know that
So
So we have
So
Proof by Induction
- The first step is called the base step where use a starting case for induction
- Second step is the inductive step
- The premise
in the inductive step is called the inductive hypothesis
Proof of the proof by induction
What we want to prove that is
And we'll prove it by contradiction. So we assume the conclusion is false, i.e.
So if there exists at lease one number
This set
By the W.O (well ordering) principle, every non-empty subset of
This means that:
is false as - Every smaller number has
True because is the first smallest number for which fails
Now we have a few cases to consider:
- If
, we've contradicted the premise, which says that is true, so this is a contradiction. So is true, because and all the numbers smaller than are true - The inductive steps means that if
is true, then is true
If
So
This means there are no numbers in the
Example
Suppose we want to prove that $$ \forall n \geq 1, n! \leq n^n$$
So we start with the base case,
Now for the inductive step, we want to prove the statement below:
We assume the statement holds for some
And now we want to prove this for
By the def. of factorial, we have
Now, using our scaling axiom and the inductive hypothesis (
As we know that
Notice how this gives us the following:
Hence the result follows by mathematical induction
Weak vs Strong induction
In weak induction, we only look one step back, i.e. assume that
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
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
Remainder Theorem
Useful for modular arithmetic which is useful for cryptography
Definition
If
It's
Consider two cases below:
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 - showing there are such integers
and that work - Show that the remainder
is less than - Uniqueness - showing they are the only such pair
Existence
Let's start with case 1:
The idea is that we keep subtracting
Formally, we define a set:
So
Consider case 2:
If
So the theorem works for all
Showing
Notice that
Let that smallest element be
Suppose for contradiction that
Then we can make a new remainder:
Notice that:
This means that
We've just shown that
Uniqueness
Suppose that there were two pairs:
We subtract one from the other to get:
This means that the left side is a multiple of
Now, if the left side is a non-zero multiple of
So
So the pair
3. Divisibility and Euclid’s Theorem
Definition An integer
Notation -
Fun fact - not every integer is a divisor of every other integer
Greatest Common Divisor
Definition The greatest common divisor of
and - If
and then so that no common divisor exceeds
Notation - the greatest common divisor of
Euclidean Algorithm
Essentially, the Euclidean Algorithm finds the gcd of two integers
Consider the example below:
We do repeated division:
When the remainder becomes
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
where
Each line
Divisors and Linear Combination
Cancellation Lemma - if
We can use this lemma and the linear combination to prove Eucledian's Algorithm
If
Now, if we can show that any common divisor of
Let the common divisor of
So if
Now, using the remainder theorem we have:
Hence
Now to prove the converse - if
Using the definition again we have:
Hence, by definition, we have
And therefore,
Proof of Euclid’s Algorithm
The Euclid algorithm is essentially the step above repeated
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:
By the rule, we've just proved that:
So when we finally hit
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
Bezout’s (Bucket) Identity
Definition If
And then
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
is non-empty - closed under addition and - closed under multiplication by any non-negative integer
Notice how this is similar to vector sub spaces in linear algebra.
For example:
- The set
is an ideal of - The set of even numbers is an ideal of
- The set of odd numbers is not an ideal as it’s not closed under addition nor multiplication by all other integers
Closed means that we don’t have to move outside the set if we apply an operation, i.e. if set
Proof of Bezout’s Identity
Lemma 3.14 Let
Is an ideal in
Now, let
Lemma 3.15
In other words, take any non-zero ideal
- Every element of
is a multiple of - Every multiple of
is in - Among all the elements of
, is the smallest
This means
What this basically means is that every ideal in
Why do we care? Because Bezout's identity is about showing that the
So we let
Now we want to show for the iff that:
2.Suppose
So
- Let
Then by the remainder theorem we have
We know thatas by definition, multiplies of are in as ideal is closed under multiplication
Now,
as
As
Hence, we have shown that
Now, all that remains is to show that
So let:
This is an ideal by Lemma 3.14, and so by Lemma 3.15,
Since
Now, we want to show that
Note that both
Therefore,
Let
- If
and , then divides any combination of - So
divides element of and in particular, divides
So any common divisor of
This means that
Therefore,
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
Definition Integers
Eg: integers
Two integers are co-prime
If
Where
Let
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
Linear Diophantine Equations
Let
Has integer solutions
Where
Proof
The if an only if part is just Bezout’s identity. Any common divisor of
So now we just need to prove what the general solution looks like
So assume we have one particular solution, so let
Let
Where
Now we put this in the
So this works for any integer
Now we need to show that these two are the only solutions, so we suppose that (
We subtract the two equations to get:
After substituting
After dividing through by
What this tells us that the difference between any two solutions is related by
Which is exactly the formula for the infinitely many solutions
4. Prime Numbers
Definition An integer
Definition An integer
For example, to prove that
By the remainder theorem,
So we have:
We also know that
As the remainder theorem only gives unique values:
Therefore,
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:
Now, I hope we can agree that
But
prime irreducible:
Assume
By definition,
WLOG (without loss of generality), assume that
By the cancellation lemma, we have
Irreducible prime
Note that this is not always true, as with our example in the ring, but in integers, this will work
So let
As
If the
On the other hand if the
Multiplying the entire equation by
By our assumption, as
Lemma 4.4: If
The Fundamental Theorem of Arithmetic
Each integer
Where
Say I wrote a prime factorisation of
The proof of this has two parts:
- Existence - every integer has a prime-power factorisation
- Uniqueness - this factorisation is the only one
Existence - using strong induction
Base case:
Induction hypothesis: assume every integer strictly between
Inductive step: prove it for
1 -
2 -
In case 2, let
Now both
Uniqueness
This will also be done by strong induction.
Base case: Suppose
Then by definition each prime
Hence the only factorisation of
Induction step: assume that
Now suppose we had two different factorisation:
Where all
From the first factorisation, we have that:
So in the second factorisation, by Lemma 4.4 earlier, we know that:
Since
This essentially allows us to match up one prime from each factorisation. WLOG, we can order the primes so that:
Now we have that
We can cancel
And this new number is strictly smaller than
If this new number is
Otherwise,
Hence by induction, this holds
We can how take this theorem and show that if a positive integer
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 that we have a finite number of primes
- Use them to build a new prime number that cannot be divisible by any of them
- So we've missed at least one prime
- Therefore, there must be infinitely many
Assume we have all the primes are:
Now we define a new number:
Now we look at the product of the primes in
So none of the primes
By the fundamental theorem of arithmetic that we proved earlier, every integer has a unique prime factorisation, so
But since none of the primes in our list can divide
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 Prime Number Theorem however, is more of the interesting side of things, which uses this function:
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
Definition Let
If
There is more than one way to think about congruence, the following are equivalent:
What the above essentially means is that is a divide
Proving the next statement is just a rearrange to get:
so
The properties of reflexive, symmetric and transitivity can also be seen for congruence:
Modular Arithmetic
We can also think of modular arithmetic as the arithmetic in the quotient ring
Another intuition is to think of digits in base
Arithmetic of Congruences
For any
Now, if
However, it’s important to note that if
A simple example is that,
Cancelling factors in congruences
Suppose
Now, we want to cancel out
Now, cancellation is allowed
Once again, notice the pattern, happens to links back to primes and composites and irreducibility
Multiplicative Inverses
A multiplicative inverse modulo
And this inverse exists
We can notice that this comes directly from Bezout's Identity, as if
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:
So if
For example, consider want to prove that
We can use the fact above to rewrite this as:
Now, instead of trying to expand the expression, we can see that integer is congruent to one of
Another example is suppose we want to show that:
Now we don't need to test this for all the integers, all we need to do is test this for
So to prove something for all integers, we can only check for possible remainders, because modulo
Theorem 5.17
If
What this basically means is that to check divisibility by
This works as
Residues
A complete set of resides modulo
What this means is that every integer
By the remainder theorem, we have that every integer
So
And then, two numbers are congruent
The least non-negative residues of any number then is just the remainder when we divide by
And then least absolute residues just allows us to work with both positive and negative residues. Sometimes, the usual residues are to big. Consider
So when
And when
Polynomials over
If
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
Showing that a polynomial has no integer roots
First, to show that a polynomial has a root, say
However, we cannot test infinitely many integers, so instead we pick a modulus
The reason is this works is because if a polynomial has an integer root, then it must have a root
Consider the example: show that
We can do a proof by contrapositive to show that if
Now, choosing a value for
- If a polynomial has even/odd patterns -
- Sums like
- - Squares or cubes -
- Constant term is small - try a divisor of it
So for the example, we can try
So for both residuals, we don't have a
Congruence Classes
Using the property of equalities, we define an equivalence relation
(reflexive) (symmetric) (transitive)
Equivalence class
Let's start with a simple question: how many different types of integers are there
Every integer is either something that leaves remainder
So an equivalence class is just the set of all integers that are equivalent under some rule
So the equivalence class of
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:
- The set is disjoint
- The union is the whole set
Congruence classes form a partition has every integer is congruent to exactly one remainder
No two integers can have two different remainders
So the congruence classes form a partition in
This is also a set of sets of numbers
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
Linear Congruences
The process for solving linear congruences is very much the same as for solving linear diophantine equations:
If
And if
And like mentioned before, the solutions form exactly
Congruence class of solutions
Consider the congruence
And this set is another way of all the numbers in the form of:
Simplifying congruences
Now, say we want to simplify a congruence like
Recall that division
There are essentially to cases we need think about when dealing with simplification
Case 1: general case
Suppose
And
So if everything has a common factor of
Case 2: coprime case
If
So if
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:
What this is asking is essentially, which integer
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
The
Step 2: Simplify the congruence
Since the
This essentially makes the numbers smaller and ensures that the new coefficients and modulus are coprime
Then we check the
We can see that
So we can multiply both sides by
The LHS becomes:
Therefore:
So
Simultaneous Linear Congruences
If we think of congruence like clock arithmetic, then simultaneous congruence is just finding a value for
Chinese Remainder Theorem (CRT)
Imagine we want to solve the congruence:
Intuitively, we want to think of numbers have coordinates modulo primes. So take
- Its
coordinate - Its
coordinate
So with the original problem we're looking for a number
So we can check the numbers
As if
So what the CRT tells us is that every pair of these coordinates corresponds to exactly one number
We can also think of uniqueness as a bijection, since
Formally, the CRT gives us a complete solution to such problems:
Definition
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
- Every non-zero element has a multiplicative inverse
If
Lagrange's Theorem
Definition
If
- ... + a_1x + a_0$ is a polynomial with integer coefficients and at least one coefficient is not
, then then congruence has at most solutions in
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
This is just the modular version of the factor theorem:
So every single root takes out one factor, and if we had more than
Fermat's Little Theorem
There are a few ways of proving this, without any knowledge of group theory, we think of multiplying all non-zero residues
Then:
And since
This helps us finding roots of polynomials congruent to polynomials mod primes
Wilson's Theorem
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
So if
For instance, take
This gives us the pairings:
This gives us:
It's important to think for understanding why this won't work for composite numbers, because if
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
Let
Instead of thinking of this as a new theorem, consider the question that for
We want a formula for square roots:
Using FilT, we have that
And if
So we have that
Linking back to Wilson's theorem, we have that:
Now, if
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
Euler’s Theorem
When
So
And by Euler's theorem, we have that:
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
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:
- Easy to compute
- Hard to reverse unless we know something
And exponentiation
We already know that computing
Suppose we choose two exponents
Now take any message
Euler's theorem gives us:
What this tells us that we can encrypt with
If we want to apply Euler's Theorem, we need control over
So to summarise, it's easy to:
- Multiply two big primes
- this is public - Compute
And it's hard to:
- Factor
back into - Compute
from - Find the inverse of
Therefore the public key in RSA is