web.stanford.edu · Injective Functions A function f : A → B is called injective (or one-to-one)...

Post on 05-Mar-2020

11 views 0 download

Transcript of web.stanford.edu · Injective Functions A function f : A → B is called injective (or one-to-one)...

Cardinality

Recap from Last Time

Domains and Codomains

● Every function f has two sets associated with it: its domain and its codomain.

● A function f can only be applied to elements of its domain. For any x in the domain, f(x) belongs to the codomain.

● We write f : A → B to indicate that f is a function whose domain is A and whose codomain is B.

Domain Codomain

Function Composition

● Let f : A → B and g : B → C be arbitrary functions.

● The composition of f and g, denoted g ∘ f, is a function● whose domain is A,● whose codomain is C, and● which is evaluated as (g ∘ f)(x) = g(f(x)).

Injective Functions

● A function f : A → B is called injective (or one-to-one) if each element of the codomain has at most one element of the domain that maps to it.

● A function with this property is called an injection.● Formally, f : A → B is an injection if this statement is true:

∀a₁ ∈ A. ∀a₂ ∈ A. (a₁ ≠ a₂ → f(a₁) ≠ f(a₂))

(“If the inputs are different, the outputs are different”)

● Equivalently:

∀a₁ ∈ A. ∀a₂ ∈ A. (f(a₁) = f(a₂) → a₁ = a₂)

(“If the outputs are the same, the inputs are the same”)

● Theorem: The composition of two injections is an injection.

Surjective Functions

● A function f : A → B is called surjective (or onto) if each element of the codomain is “covered” by at least one element of the domain.

● A function with this property is called a surjection.

● Formally, f : A → B is a surjection if this statement is true:

∀b ∈ B. ∃a ∈ A. f(a) = b

(“For every possible output, there's at least one possible input that produces it”)

● Theorem: The composition of two surjections is a surjection.

New Stuff!

Injections and Surjections

● An injective function associates at most one element of the domain with each element of the codomain.

● A surjective function associates at least one element of the domain with each element of the codomain.

● What about functions that associate exactly one element of the domain with each element of the codomain?

Katniss Everdeen

Elsa

Hermione Granger

Bijections

● A function that associates each element of the codomain with a unique element of the domain is called bijective.● Such a function is a bijection.

● Formally, a bijection is a function that is both injective and surjective.

● Bijections are sometimes called one-to-one correspondences.● Not to be confused with “one-to-one functions.”

Bijections and Composition

● Suppose that f : A → B and g : B → C are bijections.

● Is g ∘ f necessarily a bijection?● Yes!

● Since both f and g are injective, we know that g ∘ f is injective.

● Since both f and g are surjective, we know that g ∘ f is surjective.

● Therefore, g ∘ f is a bijection.

Inverse Functions

Katniss Everdeen

Elsa

Hermione Granger

Mercury

Venus

Earth

Mars

Jupiter

Saturn

Uranus

Neptune

♀☿

♂♃♄♅♆

Mercury

Venus

Earth

Mars

Jupiter

Saturn

Uranus

Neptune

♀☿

♂♃♄♅♆

Mercury

Venus

Earth

Mars

Jupiter

Saturn

Uranus

Neptune

♀☿

♂♃♄♅♆

Mercury

Venus

Earth

Mars

Jupiter

Saturn

Uranus

Neptune

♀☿

♂♃♄♅♆

Front Door

BalconyWindow

BedroomWindow

Front Door

BalconyWindow

BedroomWindow

Front Door

BalconyWindow

BedroomWindow

Inverse Functions

● In some cases, it's possible to “turn a function around.”

● Let f : A → B be a function. A function f-1 : B → A is called the inverse of f if the following is true:

∀a ∈ A. ∀b ∈ B. (f(a) = b ↔ f-1(b) = a) ● In other words, if f maps a to b, then f-1 maps b back

to a and vice-versa.● Not all functions have inverses (we just saw a few

examples of functions with no inverse).● If f is a function that has an inverse, then we say that

f is invertible.

Inverse Functions

● Theorem: Let f : A → B. Then f is invertible if and only if f is a bijection.

● To prove this result, we need to prove that● if f : A → B is invertible, then f is a bijection,

and● if f : A → B is a bijection, then f is invertible.

● These proofs are in the course reader. Feel free to check them out if you'd like!

Where We Are

● We now know● what an injection, surjection, and bijection are;● that the composition of two injections,

surjections, or bijections is also an injection, surjection, or bijection, respectively; and

● that bijections are invertible and invertible functions are bijections.

● You might wonder why this all matters. Well, there's a good reason...

Cardinality Revisited

Cardinality

● Recall (from our first lecture!) that the cardinality of a set is the number of elements it contains.

● If S is a set, we denote its cardinality by |S|.● For finite sets, cardinalities are natural numbers:

● |{1, 2, 3}| = 3● |{100, 200}| = 2

● For infinite sets, we introduced infinite cardinals to denote the size of sets:

|ℕ| = ℵ₀

Defining Cardinality

● It is difficult to give a rigorous definition of what cardinalities actually are.● What is 4? What is ₀?ℵ● (Take Math 161 for an answer!)

● Idea: Define cardinality as a relation between two sets rather than an absolute quantity.

Comparing Cardinalities

● Here is the formal definition of what it means for two sets to have the same cardinality:

|S| = |T| if there exists a bijection f : S → T

, , ,

, ,,

Comparing Cardinalities

● Here is the formal definition of what it means for two sets to have the same cardinality:

|S| = |T| if there exists a bijection f : S → T

, , ,

, ,,

Properties of Cardinality

● For any sets A, B, and C, the following are true:● |A| = |A|.

– Define f : A → A as f(x) = x.● If |A| = |B|, then |B| = |A|.

– If f : A → B is a bijection, then f-1 : B → A is a bijection.

● If |A| = |B| and |B| = |C|, then |A| = |C|.– If f : A → B and g : B → C are bijections, then

g ∘ f : A → C is a bijection.

Fun with Cardinality

Infinite Cardinalities

0 1 2 3 4 5 6 7 8 ...

... -3 -2 -1 0 1 2 3 4 ...

Infinite Cardinalities

0 1 2 3 4 5 6 7 8 ...

... -3 -2 -1 0 1 2 3 4 ...

Infinite Cardinalities

0 1 2 3 4 5 6 7 8 ...

... -3 -2 -1

ℤ 0 1 2 3 4 ...

Infinite Cardinalities

0 1 2 3 4 5 6 7 8 ...

... -3 -2 -1

ℤ 0 1 2 3 4 ...

Infinite Cardinalities

0 1 2 3 4 5 6 7 8 ...

-3-2-1

ℤ 0 1 2 3 4 ...-4

Infinite Cardinalities

0 1 2 3 4 5 6 7 8 ...

-3-2-1

ℤ 0 1 2 3 4 ...-4

Infinite Cardinalities

0 1 2 3 4 5 6 7 8 ...

-3-2-1

ℤ 0 1 2 3 4 ...-4

Define f : ℕ → ℤ as follows:

f (n)={ n /2 if n≥0−(n+1)/2 otherwise

Infinite Cardinalities

0 1 2 3 4 5 6 7 8 ...

-3-2-1

ℤ 0 1 2 3 4 ...-4

Define f : ℕ → ℤ as follows:

f (n)={ n /2 if n is even−(n+1)/2 otherwise

Infinite Cardinalities

0 1 2 3 4 5 6 7 8 ...

-3-2-1

ℤ 0 1 2 3 4 ...-4

Define f : ℕ → ℤ as follows:

f (n)={ n /2 if n is even−(n+1)/2 otherwise

Infinite Cardinalities

0 1 2 3 4 5 6 7 8 ...

-3-2-1

ℤ 0 1 2 3 4 ...-4

Define f : ℕ → ℤ as follows:

f (n)={ n /2 if n is even−(n+1)/2 otherwise

Infinite Cardinalities

0 1 2 3 4 5 6 7 8 ...

-3-2-1

ℤ 0 1 2 3 4 ...-4

Define f : ℕ → ℤ as follows:

Infinite Cardinalities

0 1 2 3 4 5 6 7 8 ...

-3-2-1

ℤ 0 1 2 3 4 ...-4

f (n)={ n /2 if n is even−(n+1)/2 otherwise

Define f : ℕ → ℤ as follows:

Home on the Range

0 1

0 2

f : [0, 1] → [0, 2]f(x) = 2x

|[0, 1]| = |[0, 2]|

Home on the Range

0 1

0 k

f : [0, 1] → [0, k]f(x) = kx

|[0, 1]| = |[0, k]|

Home on the Range

0 1

a b

f : [0, 1] → [a, b]f(x) = (b – a)x + a

|[0, 1]| = |[a, b]|

Put a Ring On It

0

f : (-π/2, π/2) → ℝf(x) = tan x

|(-π/2, π/2)| = |ℝ|

+π/2-π/2

Ranking Cardinalities

● We define |A| ≤ |B| as follows:

|A| ≤ |B| if there is an injection f : A → B

Ranking Cardinalities

● We define |A| ≤ |B| as follows:

|A| ≤ |B| if there is an injection f : A → B

Ranking Cardinalities

● We define |A| ≤ |B| as follows:

|A| ≤ |B| if there is an injection f : A → B● For any sets A, B, and C:

● |A| ≤ |A|.

– Let f : A → A be f(x) = x.● If |A| ≤ |B| and |B| ≤ |C|, then |A| ≤ |C|.

– The composition of two injections is an injection.

● Either |A| ≤ |B| or |B| ≤ |A|.

– This one is harder and requires the axiom of choice. We'll just take it on faith. ☺

Theorem (Cantor-Bernstein-Schroeder): If A and B are sets where |A| ≤ |B| and |B| ≤ |A|, then |A| = |B|

(This was first proven by Richard Dedekind.)

The CBS Theorem

● Theorem: If |A| ≤ |B| and |B| ≤ |A|, then|A| = |B|.

● Isn't this, kinda, you know, obvious?● Look at the definitions. What does the above

theorem actually say?

If there is an injection f : A → B and an injection g : B → A, then there must be

some bijection h : A → B.● This is much less obvious than it looks.

Why CBS is Tricky

0 1

0 1

The open interval (0, 1)

The closed interval [0, 1]

f(x) = x

Why CBS is Tricky

0 1

0 1

The open interval (0, 1)

The closed interval [0, 1]

g(x) = (x / 2) + ¼

Why CBS is Tricky

0 1

0 1

The open interval (0, 1)

The closed interval [0, 1]

There has to be a bijection between these two sets... so what is it?

There has to be a bijection between these two sets... so what is it?

Proving CBS

● The proof of the CBS theorem is tricky but really quite beautiful.

● I've included an appendix to this slide deck that outlines the proof.

● Curious? Check it out!

An Application

The Cartesian Product

● The Cartesian product of A × B of two sets is defined as

A × B = { (a, b) | a ∈ A and b ∈ B }

The Cartesian Product

● The Cartesian product of A × B of two sets is defined as

A × B = { (a, b) | a ∈ A and b ∈ B }

0, 1, 2 a, b, c

A B

The Cartesian Product

● The Cartesian product of A × B of two sets is defined as

A × B = { (a, b) | a ∈ A and b ∈ B }

=0, 1, 2 a, b, c

A B

×

The Cartesian Product

● The Cartesian product of A × B of two sets is defined as

A × B = { (a, b) | a ∈ A and b ∈ B }

=0, 1, 2 a, b, c

A B

×012

a b c

The Cartesian Product

● The Cartesian product of A × B of two sets is defined as

A × B = { (a, b) | a ∈ A and b ∈ B }

012

a b c (0, a), (0, b), (0, c),

(1, a), (1, b), (1, c),

(2, a), (2, b), (2, c),=0, 1, 2 a, b, c

A B

×

The Cartesian Product

● The Cartesian product of A × B of two sets is defined as

A × B = { (a, b) | a ∈ A and b ∈ B }

=0, 1, 2 a, b, c

A B

×(0, a),(0, b),(0, c),

(1, a),(1, b),(1, c),

(2, a),(2, b),(2, c)

The Cartesian Product

● The Cartesian product of A × B of two sets is defined as

A × B = { (a, b) | a ∈ A and b ∈ B }

● We denote A2 = A × A

0, 1, 2 a, b, c

A B

× =(0, a),(0, b),(0, c),

(1, a),(1, b),(1, c),

(2, a),(2, b),(2, c)

The Cartesian Product

0, 1, 2 0, 1, 2

A A

× =(0, 0),(0, 1),(0, 2),

(1, 0),(1, 1),(1, 2),

(2, 0),(2, 1),(2, 2)

● The Cartesian product of A × B of two sets is defined as

A × B = { (a, b) | a ∈ A and b ∈ B }

● We denote A2 = A × A

The Cartesian Product

2

=(0, 0),(0, 1),(0, 2),

(1, 0),(1, 1),(1, 2),

(2, 0),(2, 1),(2, 2)

0, 1, 2A2

● The Cartesian product of A × B of two sets is defined as

A × B = { (a, b) | a ∈ A and b ∈ B }

● We denote A2 = A × A

The Cartesian Product

2

=(0, 0),(0, 1),(0, 2),

(1, 0),(1, 1),(1, 2),

(2, 0),(2, 1),(2, 2)

0, 1, 2A2

● The Cartesian product of A × B of two sets is defined as

A × B = { (a, b) | a ∈ A and b ∈ B }

● We denote A2 = A × A

If you've taken Math 51, this is where we get

the notation ℝ2 and ℝ3 from!

If you've taken Math 51, this is where we get

the notation ℝ2 and ℝ3 from!

What is |ℕ2|?

0 1 2 3 4 5 6 …ℕ

0 1 2 3 4 5 6 …ℕ

(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6) (0, …)

(1, 0) (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, …)

(2, 0) (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, …)

(3, 0) (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, …)

(4, 0) (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, …)

(5, 0) (5, 1) (5, 2) (5, 3) (5, 4) (5, 5) (5, 6) (5, …)

(…, 0) (…, 1) (…, 2) (…, 3) (…, 4) (…, 5) (…, 6) …

ℕ2

0 1 2 3 4 5 6 …ℕ

(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6) (0, …)

(1, 0) (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, …)

(2, 0) (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, …)

(3, 0) (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, …)

(4, 0) (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, …)

(5, 0) (5, 1) (5, 2) (5, 3) (5, 4) (5, 5) (5, 6) (5, …)

(…, 0) (…, 1) (…, 2) (…, 3) (…, 4) (…, 5) (…, 6) …

ℕ2

|ℕ| ≤ |ℕ2|

0 1 2 3 4 5 6 …ℕ

(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6) (0, …)

(1, 0) (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, …)

(2, 0) (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, …)

(3, 0) (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, …)

(4, 0) (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, …)

(5, 0) (5, 1) (5, 2) (5, 3) (5, 4) (5, 5) (5, 6) (5, …)

(…, 0) (…, 1) (…, 2) (…, 3) (…, 4) (…, 5) (…, 6) …

ℕ2

|ℕ| ≤ |ℕ2| Find an injection f : ℕ → ℕ2

0 1 2 3 4 5 6 …ℕ

(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6) (0, …)

(1, 0) (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, …)

(2, 0) (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, …)

(3, 0) (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, …)

(4, 0) (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, …)

(5, 0) (5, 1) (5, 2) (5, 3) (5, 4) (5, 5) (5, 6) (5, …)

(…, 0) (…, 1) (…, 2) (…, 3) (…, 4) (…, 5) (…, 6) …

ℕ2

|ℕ| ≤ |ℕ2| Find an injection f : ℕ → ℕ2

0 1 2 3 4 5 6 …ℕ

(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6) (0, …)

(1, 0) (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, …)

(2, 0) (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, …)

(3, 0) (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, …)

(4, 0) (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, …)

(5, 0) (5, 1) (5, 2) (5, 3) (5, 4) (5, 5) (5, 6) (5, …)

(…, 0) (…, 1) (…, 2) (…, 3) (…, 4) (…, 5) (…, 6) …

ℕ2

|ℕ| ≤ |ℕ2| Find an injection f : ℕ → ℕ2

0 1 2 3 4 5 6 …ℕ

(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6) (0, …)

(1, 0) (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, …)

(2, 0) (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, …)

(3, 0) (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, …)

(4, 0) (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, …)

(5, 0) (5, 1) (5, 2) (5, 3) (5, 4) (5, 5) (5, 6) (5, …)

(…, 0) (…, 1) (…, 2) (…, 3) (…, 4) (…, 5) (…, 6) …

ℕ2

|ℕ| ≤ |ℕ2| Find an injection f : ℕ → ℕ2 f(n) = (0, n)

0 1 2 3 4 5 6 …ℕ

(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6) (0, …)

(1, 0) (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, …)

(2, 0) (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, …)

(3, 0) (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, …)

(4, 0) (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, …)

(5, 0) (5, 1) (5, 2) (5, 3) (5, 4) (5, 5) (5, 6) (5, …)

(…, 0) (…, 1) (…, 2) (…, 3) (…, 4) (…, 5) (…, 6) …

ℕ2

|ℕ| ≤ |ℕ2| Find an injection f : ℕ → ℕ2 f(n) = (0, n)

0 1 2 3 4 5 6 …ℕ

(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6) (0, …)

(1, 0) (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, …)

(2, 0) (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, …)

(3, 0) (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, …)

(4, 0) (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, …)

(5, 0) (5, 1) (5, 2) (5, 3) (5, 4) (5, 5) (5, 6) (5, …)

(…, 0) (…, 1) (…, 2) (…, 3) (…, 4) (…, 5) (…, 6) …

ℕ2

|ℕ| ≤ |ℕ2| Find an injection f : ℕ → ℕ2 f(n) = (0, n)|ℕ2| ≤ |ℕ|

0 1 2 3 4 5 6 …ℕ

(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6) (0, …)

(1, 0) (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, …)

(2, 0) (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, …)

(3, 0) (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, …)

(4, 0) (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, …)

(5, 0) (5, 1) (5, 2) (5, 3) (5, 4) (5, 5) (5, 6) (5, …)

(…, 0) (…, 1) (…, 2) (…, 3) (…, 4) (…, 5) (…, 6) …

ℕ2

|ℕ| ≤ |ℕ2| Find an injection f : ℕ → ℕ2 f(n) = (0, n)|ℕ2| ≤ |ℕ| Find an injection f : ℕ2 → ℕ

(0, 0) (0, 1) (0, 2) (0, 3) (0, 4) (0, 5) (0, 6) (0, …)

(1, 0) (1, 1) (1, 2) (1, 3) (1, 4) (1, 5) (1, 6) (1, …)

(2, 0) (2, 1) (2, 2) (2, 3) (2, 4) (2, 5) (2, 6) (2, …)

(3, 0) (3, 1) (3, 2) (3, 3) (3, 4) (3, 5) (3, 6) (3, …)

(4, 0) (4, 1) (4, 2) (4, 3) (4, 4) (4, 5) (4, 6) (4, …)

(5, 0) (5, 1) (5, 2) (5, 3) (5, 4) (5, 5) (5, 6) (5, …)

|ℕ| ≤ |ℕ2| Find an injection f : ℕ → ℕ2 f(n) = (0, n)|ℕ2| ≤ |ℕ| Find an injection f : ℕ2 → ℕ f(a, b) = 2a3b

(…, 0) (…, 1) (…, 2) (…, 3) (…, 4) (…, 5) (…, 6) …

0 1 2 3 4 5 6 …ℕ

ℕ2

Counterintuitive result: |ℕ| = |ℕ2|

Time-Out for Announcements!

Problem Set Three

● Problem Set Two was due at 3:00PM today. Feel free to use late days if you'd like!

● Problem Set Three goes out today.● The checkpoint is due on Monday of next week.● Remaining problems due on Friday.

● Explore properties of functions, cardinality, and equivalence relations!

● Two questions will require topics from next lecture. They're clearly marked as such.

Undergraduate Research Panel

● The CS Course Advisor is organizing an undergraduate research panel next Tuesday, January 26 at 5:30PM in Gates 219.

● Interested in getting involved in research? Curious about CURIS? Stop on by!

● Please RSVP using this link so they know how much food to get.

Your Questions

“How do you get started on a side project?”

It really depends on the project! The first step is figuring out what you want to make. I find it hard to just say “I want to make X” in isolation; there usually needs to be a good reason to make thing X.

For technical projects, getting the environment set up is often the first step. Keep an eye out for HackOverflow later this year as a great way to learn how to do this, or search online for tips on how to get set up. Alternatively, consider taking CS108!

Also, keep in mind that you're not expected to be working on side projects all the time! You've got enough on your plate as is. Do what you think is going to be the most fun, not what you think other people want you to do.

It really depends on the project! The first step is figuring out what you want to make. I find it hard to just say “I want to make X” in isolation; there usually needs to be a good reason to make thing X.

For technical projects, getting the environment set up is often the first step. Keep an eye out for HackOverflow later this year as a great way to learn how to do this, or search online for tips on how to get set up. Alternatively, consider taking CS108!

Also, keep in mind that you're not expected to be working on side projects all the time! You've got enough on your plate as is. Do what you think is going to be the most fun, not what you think other people want you to do.

“What are your long term goals?”

Professionally, there are a few areas I want to continue to focus on (making CS accessible and

welcoming to everyone, making CS theory interesting and exciting to a broad audience, etc.), though the specific ways I'm working on

those goals change and morph over time.

Professionally, there are a few areas I want to continue to focus on (making CS accessible and

welcoming to everyone, making CS theory interesting and exciting to a broad audience, etc.), though the specific ways I'm working on

those goals change and morph over time.

Back to CS103!

Unequal Cardinalities

● Recall: |A| = |B| if the following statement is true:

There exists a bijection f : A → B ● What does it mean for |A| ≠ |B| to be true?

Every function f : A → B is not a bijection.● This is a strong statement! To prove |A| ≠ |B|,

we need to show that no possible function from A to B can be injective and surjective.

Comparing Cardinalities

● Formally, we define < on cardinalities as

|A| < |B| if |A| ≤ |B| and |A| ≠ |B|

● In other words:● There is an injection from A to B.● There is no bijection between A and B.

Comparing Cardinalities

● Formally, we define < on cardinalities as

|A| < |B| if |A| ≤ |B| and |A| ≠ |B|

● In other words:● There is an injection from A to B.● There is no bijection between A and B.

● Theorem: For any sets A and B, exactly one of the following is true:

|A| < |B| |A| = |B| |A| > |B|

Putting it Together: Cantor's Theorem

Cantor's Theorem

● Cantor's Theorem is the following:

If S is a set, then |S| < | (℘ S)| ● This is how we concluded that there are

more problems to solve than programs to solve them.

● We informally sketched a proof of this in the first lecture.

● Let's now formally prove Cantor's Theorem.

The Key Step

● We need to show the following:

If S is a set, then |S| ≠ | (℘ S)|. ● To do this, we need to prove this

statement:

Given any set S and any functionf : S → (℘ S), the function f is not a

bijection.

x0

x2

x3

x4

x5

x1

...

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ x0, x2, x4, ... }

{ x0, x3, x4, ... }

{ x4, ... }

{ x1, x4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ “b”, “ab”, ... }

{ x0, x1, x2, x3, x4, x5, ... }

...

{ x0, x5, ... }

x0

x2

x3

x4

x5

x1

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ x0, x2, x4, ... }

{ x0, x3, x4, ... }

{ x4, ... }

{ x1, x4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ “b”, “ab”, ... }

{ x0, x1, x2, x3, x4, x5, ... }

...

{ x0, x5, ... }

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ x0, x2, x4, ...}

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ x0, x3, x4, ... }

{ x4, ... }

{ x1, x4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ “b”, “ab”, ... }

{ x0, x1, x2, x3, x4, x5, ... }

...

{ x0, x5, ... }

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

Y Y YN N N …

{ x0, x3, x4, ...}…

{ x4, ... }

{ x1, x4, ... }

{ x0, x1, x2, x3, x4, x5, ... }

...

{ x0, x5, ... }

Y Y YN N N …x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

Y Y Y NN N

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ x0, x2, x4, ... }

{ x0, x3, x4, ... }

{ x4, ... }

{ x1, x4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ “b”, “ab”, ... }

{ x0, x1, x2, x3, x4, x5, ... }

...

{ x0, x5, ... }

Y Y YN N N …

Y Y Y NN N …

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ x0, x2, x4, ... }

{ x0, x3, x4, ... }

{ x4, ... }

{ x1, x4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ “b”, “ab”, ... }

{ x0, x1, x2, x3, x4, x5, ... }

...

{ x0, x5, ... }

Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ x0, x2, x4, ... }

{ x0, x3, x4, ... }

{ x4, ... }

{ x1, x4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ “b”, “ab”, ... }

{ x0, x1, x2, x3, x4, x5, ... }

...

{ x0, x5, ... }

Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ x0, x2, x4, ... }

{ x0, x3, x4, ... }

{ x4, ... }

{ x1, x4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ “b”, “ab”, ... }

{ x0, x1, x2, x3, x4, x5, ... }

...

{ x0, x5, ... }

Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ x0, x2, x4, ... }

{ x0, x3, x4, ... }

{ x4, ... }

{ x1, x4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ “b”, “ab”, ... }

{ x0, x1, x2, x3, x4, x5, ... }

...

{ x0, x5, ... }

Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y NN …N YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ x0, x2, x4, ... }

{ x0, x3, x4, ... }

{ x4, ... }

{ x1, x4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ “b”, “ab”, ... }

{ x0, x1, x2, x3, x4, x5, ... }

...

{ x0, x5, ... }

Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y Y Y Y Y …

Y NN …N YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ x0, x2, x4, ... }

{ x0, x3, x4, ... }

{ x4, ... }

{ x1, x4, ... }

{ 0, 2, 4, ... }

{ 0, 2, 4, ... }

{ “b”, “ab”, ... }

{ x0, x1, x2, x3, x4, x5, ... }

...

{ x0, x5, ... }

Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y Y Y Y Y …

Y NN …N YN

… … … … … … …

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ 0, 2, 4, ... }

...

Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

{ 0, 2, 4, ... }{ “b”, “ab”, ... }Y NYN N …N YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ 0, 2, 4, ... }

...

Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

{ 0, 2, 4, ... }{ “b”, “ab”, ... }Y NYN N …N YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

Y NN N N

YN NN

Y Y Y NN N …

Y NN N N N …

Y N …

N N NNN …

Y Y Y Y Y Y …

… … … … … …

…Y N N N N Y

…...

Y …

x0, x5, …

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

Y Y YN N N

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y Y Y Y Y …

… … … … … …

…Y N N N N Y

…...

Flip all Y's to N's and vice-versa to get a

new set

Flip all Y's to N's and vice-versa to get a

new set

N Y Y Y N ...Y

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

Y NN N YN

Y Y YN N N

Y …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y Y Y Y Y …

… … … … … … …...

Flip all Y's to N's and vice-versa to get a

new set

Flip all Y's to N's and vice-versa to get a

new set

N Y Y Y N ...Yx2, x3, x4, ...x1,

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

Y NN N YN

Y YN N N

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

Which row in the table is paired with this set?

Which row in the table is paired with this set?

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

...

Which row in the table is paired with this set?

Which row in the table is paired with this set?

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

...

Which row in the table is paired with this set?

Which row in the table is paired with this set?

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

...

Which row in the table is paired with this set?

Which row in the table is paired with this set?

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

...

Which row in the table is paired with this set?

Which row in the table is paired with this set?

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y Y N ...

...

Y NYN N …N YN

...

Which row in the table is paired with this set?

Which row in the table is paired with this set?

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

...

Which row in the table is paired with this set?

Which row in the table is paired with this set?

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

Which row in the table is paired with this set?

Which row in the table is paired with this set?

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YNWhat set is this?What set is this?

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YNWhat set is this?What set is this?

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

f(x₀)

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

x₀ ∈ f(x₀)?

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

x₀ ∉ f(x₀)?

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

f(x₁)

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

x₁ ∈ f(x₁)?

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

x₁ ∉ f(x₁)?

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

f(x₂)

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

x₂ ∈ f(x₂)?

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

x₂ ∉ f(x₂)?

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

x₃ ∉ f(x₃)?

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

x₄ ∉ f(x₄)?

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

x₅ ∉ f(x₅)?

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

x ∉ f(x)?

...

{ 0, 2, 4, ... }Y Y YN N N …

Y Y Y NN N …

Y NN N N N …

Y Y NN NN …

Y Y NNNN …

Y Y Y Y Y Y …

… … … … … … …

Y N N N Y YN Y Y Y N N ...

...

Y NYN N …N

Y

YN

x0

x2

x3

x4

x5

x1

x0 x1 x2 x3 x4 x5 ...

{ x ∈ S | x ∉ f(x) }

The Diagonal Set

● Let f : S → (℘ S) be an arbitrary function from S to (℘ S).

● Define the set D as follows:

D = { x ∈ S | x ∉ f(x) }

(“The set of all elements x where x isnot an element of the set f(x).”)

● This is a formalization of the set we found in the previous picture.

● Using this choice of D, we can formally prove that no function f : S → (℘ S) is a bijection.

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some x ∈ S such that f(x) = D.

We can now ask under what conditions this element x happensto be an element of D. By definition of D, we know that

x ∈ D iff x ∉ f(x). (2)

By assumption, f(x) = D. Combined with (2), this tells us

x ∈ D iff x ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some x ∈ S such that f(x) = D.

We can now ask under what conditions this element x happensto be an element of D. By definition of D, we know that

x ∈ D iff x ∉ f(x). (2)

By assumption, f(x) = D. Combined with (2), this tells us

x ∈ D iff x ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some x ∈ S such that f(x) = D.

We can now ask under what conditions this element x happensto be an element of D. By definition of D, we know that

x ∈ D iff x ∉ f(x). (2)

By assumption, f(x) = D. Combined with (2), this tells us

x ∈ D iff x ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some x ∈ S such that f(x) = D.

We can now ask under what conditions this element x happensto be an element of D. By definition of D, we know that

x ∈ D iff x ∉ f(x). (2)

By assumption, f(x) = D. Combined with (2), this tells us

x ∈ D iff x ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some x ∈ S such that f(x) = D.

We can now ask under what conditions this element x happensto be an element of D. By definition of D, we know that

x ∈ D iff x ∉ f(x). (2)

By assumption, f(x) = D. Combined with (2), this tells us

x ∈ D iff x ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some x ∈ S such that f(x) = D.

We can now ask under what conditions this element x happensto be an element of D. By definition of D, we know that

x ∈ D iff x ∉ f(x). (2)

By assumption, f(x) = D. Combined with (2), this tells us

x ∈ D iff x ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some y ∈ S such that f(y) = D.

We can now ask under what conditions this element x happensto be an element of D. By definition of D, we know that

x ∈ D iff x ∉ f(x). (2)

By assumption, f(x) = D. Combined with (2), this tells us

x ∈ D iff x ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some y ∈ S such that f(y) = D.

We can now ask under what conditions this element y happensto be an element of D. By definition of D, we know that

x ∈ D iff x ∉ f(x). (2)

By assumption, f(x) = D. Combined with (2), this tells us

x ∈ D iff x ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some y ∈ S such that f(y) = D.

We can now ask under what conditions this element y happensto be an element of D. By definition of D, we know that

y ∈ D iff y ∉ f(y). (2)

By assumption, f(x) = D. Combined with (2), this tells us

x ∈ D iff x ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some y ∈ S such that f(y) = D.

We can now ask under what conditions this element y happensto be an element of D. By definition of D, we know that

y ∈ D iff y ∉ f(y). (2)

By assumption, f(y) = D. Combined with (2), this tells us

x ∈ D iff x ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some y ∈ S such that f(y) = D.

We can now ask under what conditions this element y happensto be an element of D. By definition of D, we know that

y ∈ D iff y ∉ f(y). (2)

By assumption, f(y) = D. Combined with (2), this tells us

y ∈ D iff y ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some y ∈ S such that f(y) = D.

We can now ask under what conditions this element y happensto be an element of D. By definition of D, we know that

y ∈ D iff y ∉ f(y). (2)

By assumption, f(y) = D. Combined with (2), this tells us

y ∈ D iff y ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some y ∈ S such that f(y) = D.

We can now ask under what conditions this element y happensto be an element of D. By definition of D, we know that

y ∈ D iff y ∉ f(y). (2)

By assumption, f(y) = D. Combined with (2), this tells us

y ∈ D iff y ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some y ∈ S such that f(y) = D.

We can now ask under what conditions this element y happensto be an element of D. By definition of D, we know that

y ∈ D iff y ∉ f(y). (2)

By assumption, f(y) = D. Combined with (2), this tells us

y ∈ D iff y ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some y ∈ S such that f(y) = D.

We can now ask under what conditions this element y happensto be an element of D. By definition of D, we know that

y ∈ D iff y ∉ f(y). (2)

By assumption, f(y) = D. Combined with (2), this tells us

y ∈ D iff y ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

Theorem: If S is a set, then |S| ≠ | (℘ S)|.

Proof: Let S be an arbitrary set. We will prove that |S| ≠ | (℘ S)| byshowing that there are no bijections from S to (℘ S).

Suppose for the sake of contradiction that there is a bijectivefunction f : S → (℘ S). Starting with f, we define the set

D = { x ∈ S | x ∉ f(x) }. (1)

Since every element of D is also an element of S, we know thatD ⊆ S, so D ∈ (℘ S). Therefore, since f is surjective, we know thatthere is some y ∈ S such that f(y) = D.

We can now ask under what conditions this element y happensto be an element of D. By definition of D, we know that

y ∈ D iff y ∉ f(y). (2)

By assumption, f(y) = D. Combined with (2), this tells us

y ∈ D iff y ∉ D. (3)

This is impossible. We have reached a contradiction, so ourassumption must have been wrong. Therefore, there are nobijections between S and (℘ S), and therefore |S| ≠ | (℘ S)|, asrequired. ■

The Diagonal Argument

● This proof is tricky. It's one of the hardest proofs we're going to encounter over the course of this quarter.

● To help you wrap your head around how it works, we've asked you a few questions about it on Problem Set Three.

● Don't panic if you don't get it immediately; you'll get a really good understanding of how it works if you play around with it.

Why All This Matters

● Diagonal arguments come up all the time in computer science and formal logic.

● Some examples:● Later in the quarter, we'll use diagonalization to find specific

examples of problems that cannot be solved by computers.● In complexity theory, diagonal arguments give rise to the

time hierarchy theorem, which proves that certain problems are fundamentally hard to solve.

● In formal logic, Gödel's incompleteness theorem uses diagonalization to establish limits on what formal logic can tell us.

● Want to learn more? Take Phil 152, CS154, and CS254!

Appendix: Proving CBS

Proving CBS, Intuitively

Proving CBS, Intuitively

S

T

Proving CBS, Intuitively

S

T

Proving CBS, Intuitively

S

T

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Proving CBS, Intuitively

S

T

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Proving CBS, Intuitively

S

T

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Proving CBS, Intuitively

S

T

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Proving CBS, Intuitively

S

T

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Proving CBS, Intuitively

S

T

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

If the values are linked in a cycle, have the bijection map

the nodes in S to nodes in T by following the blue lines.

If the values are linked in a cycle, have the bijection map

the nodes in S to nodes in T by following the blue lines.

Proving CBS, Intuitively

S

T

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Proving CBS, Intuitively

S

T

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

If the values form an infinite path starting with

a node in T, have the bijection map the nodes

in S to nodes in T by following the red lines.

If the values form an infinite path starting with

a node in T, have the bijection map the nodes

in S to nodes in T by following the red lines.

Proving CBS, Intuitively

S

T

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Proving CBS, Intuitively

S

T

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

Blue lines represent the injection f : S → T Red lines represent the injection g : T → S

If the values form an infinite path starting with a

node in S, have the bijection map the nodes in

S to nodes in T by following the blue lines.

If the values form an infinite path starting with a

node in S, have the bijection map the nodes in

S to nodes in T by following the blue lines.

Why This Matters

● Don't worry too much about the specifics of this proof. Think of it as more of a “math symphony.” ☺

● Fun Challenge Problem: Find an explicit bijection f : [0, 1] → (0, 1).