# Comp 163 Week 7 notes

Discuss midterm: week of March 21

1 + 2 + 3 + ... + 100

Proof by induction: 1 + 2 + ... + N = N(N+1)/2

### 2.5: Mathematical Induction

Postage in Investigate!

Example 2.5.1: triangle numbers

Example 2.5.2: 6n-1 is divisible by 5

Example 2.5.3: n2 < 2n for n>=5

Warning: Canadians and false induction: The P(1)=>P(2) case fails.

Division algorithm theorem: for integers a and b<a, we can find q and r so a=qb+r and 0<=r<q.

Proof: Induction on a works. If a=qb+r, then either a+1 = qb + (r+1) or else r=q-1 and so a+1 = (q+1)b

Alternative proof: what is the minimum of {a-qb >=0 | q ∈ N}? Let it be r; we claim r<q.

### 5.2 Modular Arithmetic

An introduction to divisibility and congruence:

if a,b are in N, then a|b, or "a divides b" if ∃k∈N b=ak

b≡c mod a if a|(b-c)

Not actually done:

Fact: for all a,n∈N there is b so: 0≤b<n and b≡a (mod n). So modular arithmetic comes down to Zn = {0,1,...,n-1}

gcd theorem/algorithm

5x≡1 mod 13, 3x≡1 mod 13

#### Wednesday

Postage in Investigate!; show 8 cent and 5 cent stamps can make any amount greater than or equal to 28 cents. Proof on p 179

(by the way, there is no solution for 27 cents)

Solving 17x + 80y = 1

Solving 5x2 ≡ 1 mod 13     and 9x2 ≡ 1 mod 13

why is the first the same as solving x2 ≡ 8 mod 13?

Theorem: if p is prime, then for any x not congruent to zero, there exists y so x*y ≡ 1 (mod p).

Fermat's little theorem  ap-1 ≡ 1 (mod p)

Z13 example    3 has order 3, 5 has order 4

Binomial-theorem proof

`# returns the list a, a*a, a^3, ..., a^n, all mod ndef powerlist(a,n):    lis = [0]*n    lis[0] = a % n    for i in range(1,n):        lis[i] = a*lis[i-1] % n    return lis`

a*b ≡ 0 mod 15

a|bc, (a,b) = 1 => a|c

Proof: Note ∃k ka=bc. Also ∃x,y xa+yb=1. At this point c = cxa + cyb = a(cx + ky), so a|c

Group-theoretic proof of Fermat's "little" theorem ∀a≠0  ap-1 ≡ 1 (mod p)

The order of a ∈ Zp is the smallest k>0 such that ak ≡ 1 (mod p)

There always is such a k. The set {a, a2, a3, ... } cannot be infinite, so there are i and j, i<j, so ai ≡ aj. But then aj-i ≡ 1 mod p.

The next step is to prove that order(a) divides p-1. That's it!

Let A = {a, a2, a3, ... }. We show that we can partition {1,...,p-1} into multiple disjoint sets each the same size as A. That proves |A| divides p-1.

Z13 example    3 has order 3, 5 has order 4. A = A5 = {5, 12, 8, 1}.

2A = {10, 11,  3,  2}
3A = {2,  10, 11,  3}
4A = {7,   9,   6,   4}
5A = {12, 8,   1,  5}
6A = {4,   7,   9,  6}
7A = {9,   7,   4,  7}

Maybe:

straightenup(n) sequence. Plot for n=200, n=600, n=1000

fib(n): why is fib(40) slow?

nc(0)=nc(1)=1   For n>1, nc(n) = nc(n-1) + nc(n-2) + 1
prove by induction: nc(n) >= fib(n)