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

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

34. Random Walks & PageRank

Sampling & Confidence

Take a random variable RR with an expectation of μ\mu.
Make nn trial observations of RR, and take the average of those observations.
See how close they are to μ\mu.

The observed average of the results will approach the true expectation as the number of trial observations increases.

So, we're doing nn observations of RR. They are mutually independent:
R1, R2, ..., RnR_1, \ R_2, \ ..., \ R_n

They all have the same expectation μ\mu.

Taking the average of those values: An=R1 + R2 + ... + RnnA_n = \frac{R_1 \ + \ R_2 \ + \ ... \ + \ R_n}{n}
Is this average value close to μ\mu if nn is big?

lim Pr[Anμδ]= ?\lim_\infty \ \text{Pr}[|A_n - \mu| \leq \delta] = \ ?

The answer that the Weak Law of Large Numbers gives to that question is 11:

lim Pr[Anμδ]= 1\lim_\infty \ \text{Pr}[|A_n - \mu| \leq \delta] = \ 1

Another way of saying it is:

lim Pr[Anμ>δ]= 0\lim_\infty \ \text{Pr}[|A_n - \mu| \gt \delta] = \ 0

So, as the number of trials increases, the probability that the average differs from the expectation more than delta goes to 00.

As the number of trials increases, the difference between the observed average and the theoretical average gets smaller.

For a clear example to understand the concept of the Law of Large Numbers, The Organic Chemistry Tutor's video is really great.


Let R1, R2, ..., RnR_1, \ R_2, \ ..., \ R_n be pairwise independent random variables with same mean μ\mu and variance σ2\sigma^2.
Their average AnA_n is R1 + R2 + ... + Rnn\frac{R_1 \ + \ R_2 \ + \ ... \ + \ R_n}{n}.

So, the probability that their average differs from the mean by more than a given tolerance delta is:

Pr[Anμ>δ]1n(σδ)2\text{Pr}[|A_n - \mu| \gt \delta] \leq \frac{1}{n}\bigg(\frac{\sigma}{\delta}\bigg)^2

It is the Pairwise Independent Sampling Theorem.


Confidence levels refer to the results of estimation procedures for real-world quantities.

So, when some facts are told to have high confidence level, the important thing to remember is that behind this claim, a random experiment lies.

95% confidence level is most common, and as mentioned in the course video, this xkcd comic illustrates the topic:

xkcd 882