Well-Ordering Principle

An element of a subset is the first element of if for all . For example, has the first element .

The well-ordering principle is an axiom of mathematics (statement assumed to be true) that all non-empty subsets of non-negative integers contain a first element.

Division and Remainder

Let and be integers with . Then, there exists integers and () such that . For example, if , we would obtain since .

To prove this, we define a set . Clearly, is a non-empty subset of since we can select a sufficiently large (positively/negatively) to ensure that there exist positive integers in the set . By the well-ordering principle, there must be a first element which we will define as .

We know exists and that it belongs to the set , so it therefore takes some non-negative integer value. Since we have defined this as the first element, we can also say that .

For contradiction, we now assume that . This then gives that , and that . contradicts that is the first element, so we get .

Next, we prove that the decomposition of is unique (there can only be one and for any given and ). For contradiction, assume that this is not the case (they are not unique; for ).

so divides . Since both remainders are between and , their difference must also be between and , their difference must also be between and . The only value here divisible by is , and hence this contradicts the original assumption, so and .

Mathematical Induction

Used to prove a statement of the form is true for all natural numbers . It proves by showing two things:

  • Establishing
  • Establishing an initial term , for example or

Consider the partial sum of the geometric series for . We need to prove that:

Trivially, is true. Assume true for .

We now need to prove that .

\begin{eqnarray} S(n+1)=S(n)+Ar^{n+1} &=& A[\frac{1-r^{n+1}}{1-r}]+Ar^{n+1}\\ &=& A[\frac{1-r^{n+1}}{1-r}+r^{n+1}]\\ &=& A[\frac{1-r^{n+1}}{1-r}+\frac{r^{n+1}-r^{n-2}}{1-r}]\\ &=& A[\frac{1-r^{n+2}}{1-r}] \end{eqnarray}

Another Example

We’re trying to prove that the sum of the the first positive odd numbers is equal to . This is trivially true for (), so we assume true for : We are then going to prove : Which goes a little like:

\begin{eqnarray} \sum_{k=1}^{a+1}(2k-1) &=& [\sum_{k=1}^{a}(2k-1)] \ +2(a+1)-1 \\ &=& a^2 +2a +1 \\ &=& (a+1)^2 \\ && \therefore \text{proven true for all }n+1 \end{eqnarray}

Power Set

Correctness

We say a procedure is correct if it:

  • Stops after a finite number of steps, and
  • Produces an output which is what is claimed

Loop Invariance

A loop invariant is a property of a program loop that is true before and after each iteration of the loop. For example, consider the simple pseudocode:

Input integers m and n
While m + n < 996
	Replace m := m + 5
	Replace n := n - 1
Output m and n

The eventual output for will be . There are several loop invariants, such as , and . We can prove that is loop invariant. divides into , for example , and (the way that the loop is closed). Either and are unchanged (the loop never occurs), or is updated to

\begin{eqnarray} (m+5)+(n-1) &=& 2k+4 \\ &=& 2(k+2) \end{eqnarray}

…which is divisible by 2.

Euclidean Algorithm

Keep dividing the remainder of and (where ) until they cleanly divide.

”Motivating” (?) Problem (Extended / Reverse Euclidean Algorithm)

Consider the problem: finding a way of expressing an integer as a linear sum of (integer) multiples of other integers. For example, how would we find and such that ? In this case, however guessing solutions is not trivial, nor always possible. Euclidean’s algorithms calculates the greatest common divisor of any two non-zero integers, however we can reverse the process to find integers and such that where and are two known input integers. If the “target” value cannot be found such that , then no integer solutions can be found.

We take the second last row of the table (where the remainder is not ). We then represent rearrange so that the subject is the , so that . Whilst keeping the subject as the gcd, we can substitute values without expanding for the portion once keeping the remainder / as the subject (for example, which just needs rearranging, and then the same can be done for until the equation is in the form of ).