Skip to content

Midterm Prep: Formulas & Identities Cheatsheet | CSCI 328

This cheatsheet captures all major formulas and identities from the course, organized by topic for quick reference during problem-solving and exam preparation.


Pr⁡(Ac)=1−Pr⁡(A)\Pr(A^c) = 1 - \Pr(A)

Two events AA and BB are independent if:

Pr⁡(A∩B)=Pr⁡(A)⋅Pr⁡(B)\Pr(A \cap B) = \Pr(A) \cdot \Pr(B)

For any random variables X1,X2,…,XnX_1, X_2, \ldots, X_n (with or without independence):

E[∑i=1nXi]=∑i=1nE[Xi]E\left[\sum_{i=1}^n X_i\right] = \sum_{i=1}^n E[X_i] Pr⁡(A1∪A2∪⋯∪An)≤∑i=1nPr⁡(Ai)\Pr(A_1 \cup A_2 \cup \cdots \cup A_n) \leq \sum_{i=1}^n \Pr(A_i)

For an event AA:

XA={1if A occurs0otherwise,E[XA]=Pr⁡(A)X_A = \begin{cases} 1 & \text{if } A \text{ occurs} \\ 0 & \text{otherwise} \end{cases}, \quad E[X_A] = \Pr(A)

X∼Bernoulli(p)X \sim \text{Bernoulli}(p):

E[X]=p,Var(X)=p(1−p)=p⋅q(where q=1−p)E[X] = p, \quad \text{Var}(X) = p(1-p) = p \cdot q \quad \text{(where } q = 1-p\text{)}

X∼Binomial(n,p)X \sim \text{Binomial}(n, p) (sum of nn independent Bernoulli trials):

E[X]=np,Var(X)=np(1−p)=npqE[X] = np, \quad \text{Var}(X) = np(1-p) = npq Pr⁡(X=k)=(nk)pk(1−p)n−k\Pr(X = k) = \binom{n}{k} p^k (1-p)^{n-k}

X∼Geometric(p)X \sim \text{Geometric}(p) (number of trials until first success):

E[X]=1p,Var(X)=1−pp2E[X] = \frac{1}{p}, \quad \text{Var}(X) = \frac{1-p}{p^2}

Expected number of items needed to collect all nn distinct types (with uniform sampling):

E[# items]=n(1+12+13+⋯+1n)=nHn≈nln⁡nE[\text{\# items}] = n \left(1 + \frac{1}{2} + \frac{1}{3} + \cdots + \frac{1}{n}\right) = n H_n \approx n \ln n

where HnH_n is the nn-th harmonic number.


Var(X)=E[X2]−(E[X])2\text{Var}(X) = E[X^2] - (E[X])^2

If X1,X2,…,XnX_1, X_2, \ldots, X_n are independent:

Var(∑i=1nXi)=∑i=1nVar(Xi)\text{Var}\left(\sum_{i=1}^n X_i\right) = \sum_{i=1}^n \text{Var}(X_i) σ=Var(X)\sigma = \sqrt{\text{Var}(X)}

For any non-negative random variable XX and t>0t > 0:

Pr⁡(X≥t)≤E[X]t\Pr(X \geq t) \leq \frac{E[X]}{t}

Intuition: Probability of extreme deviation is bounded by expected value ratio.

For any random variable XX and t>0t > 0:

Pr⁡(∣X−E[X]∣≥t)≤Var(X)t2\Pr(|X - E[X]| \geq t) \leq \frac{\text{Var}(X)}{t^2}

Alternatively:

Pr⁡(X≥t)≤Var(X)t2\Pr(X \geq t) \leq \frac{\text{Var}(X)}{t^2}

Intuition: Values far from the mean are unlikely if variance is small.

For X=∑i=1nXiX = \sum_{i=1}^n X_i where XiX_i are independent Bernoulli random variables, and μ=E[X]\mu = E[X]:

(1) General Form — For any δ>0\delta > 0:

Pr⁡(X≥(1+δ)μ)≤(eδ(1+δ)1+δ)μ\Pr(X \geq (1+\delta)\mu) \leq \left(\frac{e^\delta}{(1+\delta)^{1+\delta}}\right)^\mu

(2) Simplified Form — For 0<δ≤10 < \delta \leq 1:

Pr⁡(X≥(1+δ)μ)≤e−μδ2/3\Pr(X \geq (1+\delta)\mu) \leq e^{-\mu\delta^2/3}

(3) For Large Deviations — For R≥6μR \geq 6\mu:

Pr⁡(X≥R)≤2−R\Pr(X \geq R) \leq 2^{-R}

Intuition: Exponential bounds for sums of independent Bernoulli variables.


PART VI: BIRTHDAY PARADOX & COLLISION PROBABILITY

Section titled “PART VI: BIRTHDAY PARADOX & COLLISION PROBABILITY”

Probability that mm balls thrown into nn bins have no collisions:

Pr⁡(no collision)=nn⋅n−1n⋅n−2n⋯n−m+1n\Pr(\text{no collision}) = \frac{n}{n} \cdot \frac{n-1}{n} \cdot \frac{n-2}{n} \cdots \frac{n-m+1}{n}

This can be written as:

Pr⁡(no collision)=∏i=0m−1(1−in)\Pr(\text{no collision}) = \prod_{i=0}^{m-1} \left(1 - \frac{i}{n}\right)

Approximate Collision Probability (for m2≪nm^2 \ll n)

Section titled “Approximate Collision Probability (for m2≪nm^2 \ll nm2≪n)”
Pr⁡(collision)≈1−e−m2/(2n)\Pr(\text{collision}) \approx 1 - e^{-m^2/(2n)}

Birthday Paradox (specific case: n=365n = 365, m=23m = 23)

Section titled “Birthday Paradox (specific case: n=365n = 365n=365, m=23m = 23m=23)”

Probability that 23 people have a shared birthday exceeds 50%.


When nn balls are thrown into nn bins:

Pr⁡(bin is empty)=(1−1/n)n≈e−1\Pr(\text{bin is empty}) = (1 - 1/n)^n \approx e^{-1} E[# empty bins]=n⋅e−1≈0.368nE[\text{\# empty bins}] = n \cdot e^{-1} \approx 0.368n

When nn balls are thrown into nn bins:

E[max load]=Θ(ln⁡nln⁡ln⁡n)E[\text{max load}] = \Theta\left(\frac{\ln n}{\ln \ln n}\right) Pr⁡(max load>3ln⁡nln⁡ln⁡n)≤1n\Pr\left(\text{max load} > \frac{3\ln n}{\ln \ln n}\right) \leq \frac{1}{n}