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

04. Quantifiers and Predicate Logic

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

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

Directed Acyclic Graphs

A directed graph with no cycles is called a directed acyclic graph.

Directed acyclic graph example

By definition, they also don't have closed walks (remember that a closed walk is a walk that begins and ends at the same vertex).

Also called DAGs, directed acyclic graphs are helpful for things such as task scheduling:

A schedule for performing tasks specifies which tasks to do at successive steps.

In a scheduling problem, some tasks depend on other tasks being completed beforehand. Because of that, we need to order the tasks. Such ordering is called topological sorting:

A topological sort of a finite DAG is a list of all the vertices such that each vertex vv appears earlier in the list than every other vertex reachable from vv.


A vertex vv of a DAG, DD, is minimum iff every other vertex is reachable from vv.
A vertex vv is minimal iff vv is not reachable from any other vertex.

There is a possibility that there is no minimum vertex in a DAG, but there can be a lot of minimal ones.


Two vertices are said to be comparable if one of them is reachable from the other.

In a set of vertices, when any two of them are comparable, it is called a chain. It implies that the sequence of elements has an order.

The opposite of that, when no two elements are comparable, is the antichain.

So, uu is incomparable to vv iff there is no path from uu to vv and no path from vv to uu.

When a vertex in a chain is reachable from all the other vertices, it is the maximum element of the chain.

Every nn-vertex DAG has a chain of size greater than n\sqrt{n}, or an antichain of size greater than or equal to n\sqrt{n}. If we have a DAG with nn number of vertices, for any number t>0t \gt 0, it either has a chain of size bigger than tt, or it has an antichain of size greater than or equal to nt\frac{n}{t} for all 1tn1 \leq t \leq n.

The product of the maximum chain size and the maximum antichain size is greater than or equal to the number of vertices:

ncan \geq c \cdot a

This is Dilworth's lemma.

To help visualize it better in our mind's eye, it'd be good to know that the size of the longest chain is called the length, and the size of the longest antichain the width.

Then, this image taken from the slides of the lecture would make more sense:

Antichains times chains

A partition of a set AA is a set of nonempty subsets of AA such that every element of AA is in exactly one of them. These nonempty subsets are called blocks of the partition.

So, every element of AA has to be in exactly one block.

Let's imagine a set {a, b, c, d, e}\{a, \ b, \ c, \ d, \ e\}.
We can think of a partition of it into three blocks, such as: {{a, c}, {b, e}, {d}}\{\{a, \ c\}, \ \{b, \ e\}, \ \{d\}\}.


A parallel schedule for a DAG is a partition of its vertices into blocks A0, A1, ...,A_0, \ A_1, \ ..., such that when j<kj \lt k, no vertex in AjA_j is reachable from any vertex in AkA_k.
So, for example, the vertices in A0A_0 can't be reachable from any vertex in A1A_1.

The block AkA_k is the set of elements scheduled at step kk.
The number of blocks is the time of the schedule.

The largest chain ending at element aa is the critical path to aa.
The number of elements in the chain that are less than aa is the depth of aa.
So, in a parallel schedule, before task aa can even be started, there must be at least depth(a) steps.