Bite-Sized Mathematics for Computer Science

Notes on MIT's 6.042J

Eda Eren
Table of Contents

Introduction

Prerequisites & Resources

Unit 1: Proofs

00. Introduction to Proofs

01. (Two) Proof Methods

02. The Well Ordering Principle

03. Logic & Propositions

05. Sets

06. Binary Relations

07. Induction

08. State Machines — Invariants

09. Recursive Definitions

10. Infinite Sets

Unit 2: Structures

11. GCDs

12. Congruences

13. Euler's Theorem

14. RSA Encryption

15. Digraphs: Walks and Paths

16. Directed Acyclic Graphs

17. Partial Orders and Equivalence

18. Degrees & Isomorphism

19. Coloring & Connectivity

20. Trees

21. Stable Matching

Unit 3: Counting

22. Sums & Products

23. Asymptotics

24. Counting with Bijections

25. Repetitions & Binomial Theorem

26. Pigeonhole Principle, Inclusion-Exclusion

Unit 4: Probability

27. Intro to Discrete Probability

28. Conditional Probability

29. Independence & Causality

30. Random Variables, Density Functions

31. Expectation

32. Deviation: Markov & Chebyshev Bounds

33. Sampling & Confidence

34. Random Walks & PageRank

Quantifiers and Predicate Logic

Look at this sentence:

Every American has a dream.

Let AA be the set of Americans, and DD be the set of dreams, and H(a,d)H(a, d) be the predicate that says "American aa has the dream dd".

Quantifiers that are mostly used are the existential quantifier ("there exists," denoted as \exists), and the universal quantifier ("for all," denoted as \forall).

We can try to write that sentence using quantifiers in this way:

dD aA: H(a,d)\exists d \in D \ \forall a \in A: \ H(a, d)

It reads as "there exists a dream in the set of dreams such that all Americans have it".

But, it means that there is a dream that every American has, that every American has the same dream. This is not what we wanted!

Let's do it better:

aA dD: H(a,d)\forall a \in A \ \exists d \in D : \ H(a, d)

Now, it says that every American has their own dream.

Negating Quantifiers

¬(xP(x))\neg (\forall x P(x)) is equivalent to x ¬P(x)\exists x \ \neg P(x).

Let's say that P(x)P(x) stands for "x likes parrots."
¬(xP(x))\neg (\forall x P(x)) reads as "not everyone likes parrots."
x ¬P(x)\exists x \ \neg P(x) reads as "there exists someone who doesn't like parrots."
Both of them mean the same thing.

Also, ¬(xP(x))\neg (\exists x P(x)) is equivalent to x ¬P(x)\forall x \ \neg P(x).
This time, let's say that P(x)P(x) stands for "xx likes being mocked."
¬(xP(x))\neg (\exists x P(x)) reads as "There exists no one that likes being mocked."
x ¬P(x)\forall x \ \neg P(x) reads as "Everyone dislikes being mocked."
They also mean the same thing.

These are also called De Morgan's Law for Quantifiers.


Now, let's look at this sentence:

All that glitters is not gold.

If we let G(x)G(x) to indicate "glitters," and Au(x)Au(x) to indicate "being gold," we can perhaps translate it into a formula as such:

x[G(x)    ¬Au(x)]\forall x [G(x) \implies \neg Au(x)]

But, it says that "everything that glitters is not gold". Think about it for a minute. Is it what the poet really meant?

The formula is not what we mean it to be; gold glitters — gold is one of the things that glitters, so it is not true that everything that glitters is not gold.

So, the correct way to put it is this:

¬x[G(x)    Au(x)]\neg \forall x[G(x) \implies Au(x)]

Now, it says what we mean it to say, "not everything that glitters is gold."