


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A cheatsheet for CS70, covering topics such as propositional logic, modular arithmetic, proofs, sets, countability and computability, graph theory, polynomials, and error-correcting codes. It includes formulas, theorems, and algorithms related to each topic. useful for students studying CS70 and preparing for exams or assignments related to the covered topics.
Typology: Cheat Sheet
1 / 4
This page cannot be seen from the preview
Don't miss anything!



Note 1 (Propositional Logic)
Note 2/3 (Proofs)
Note 4 (Sets)
∀ y ∃ x
f ( x ) = y
; “hits" all of range
Note 5 (Countability & Computability)
times uncountable ({0, 1}∞)
Note 6 (Graph Theory)
P f i = 1 si^ =^2 e^ where^ si^ =^ number of sides of face^ i
- e ≤ 3 v − 6 if planar (because si ≥ 3) - e ≤ 2 v − 4 if planar for bipartite graphs (because si ≥ 4) - nonplanar if and only if the graph contains K 5 or K 3, - all planar graphs can be colored with ≤ 4 colors
Note 7 (Modular Artithmetic)
x / y
a b 35 12 2 − 1 3 12 11 1 1 − 1 11 1 11 0 1 1 0 gcd
start
answer –^ new^ a^ =^ old^ b
- new b = a − b
j x y
k
- if gcd ( x , y ) = 1, then a = x −^1 mod y , b = y −^1 mod x
i ̸= j m^ j
- x ≡
ai bi (mod
mi )
- solution is unique mod
mi
- mi must be pairwise relatively prime in order to use CRT Note 8 (RSA)
i ̸= j
x − x (^) j xi − x (^) j
- P ( x ) =
i yi ∆ i ( x )
Note 11 (Counting)
¡ n k
= (^) k !( nn −! k )! = # ways to select k from n
¡ n + k − 1 k − 1
¡ n + k − 1 n
P n k = 0
¡ n k
ak^ bn − k
¡ (^) n k + 1
¡ n − 1 k
¡ n − 2 k
¡ k k
P n k = 0
(−1) k k!
p 2 πn
¡ (^) n e
¢ n
Note 12 (Probability Theory)
ω ∈Ω P( ω )^ =^1
ω ∈ A P( ω ) where^ A^ is an event
Note 13 (Conditional Probability)
P( B ) =
X^ n i = 1
B ∩ Ai
X^ n i = 1
B | Ai
Ai
for Ai partitioning Ω
n i = 1 Ai
P n i = 1 P
Ai
Note 14 (Random Variables)
b ∈ B P( X^ =^ a ,^ Y^ =^ b )
x ∈X x^ P( X^ =^ x )
g ( X )
x ∈X g^ ( x )^ P( X^ =^ x )
Note 15 (Variance/Covariance)
X − μ
- Var( c X ) = c^2 Var( X ), Var( X + Y ) = Var( X ) + Var( Y ) + 2 Cov( X , Y ) - if indep: Var( X + Y ) = Var( X ) + Var( Y )
X =
( 1 p = 0. − 1 p = −0.
, Y =
1 X = −1, p = 0. − 1 X = −1, p = 0. 0 X = 1
Note 16 (Geometric/Poisson Distributions
−∞ fX^ ( x ) d x^ =^1
R (^) x −∞ fX^ ( t^ ) d t^ , fX ( x ) = (^) dd x FX ( x )
−∞ x fX^ ( x ) d x
g ( X )
−∞ g^ ( x )^ fX^ ( x ) d x
−∞
−∞ fX Y^ ( x ,^ y ) d x^ d y^ =^1
−∞ fX Y^ ( x ,^ y ) d y ; integrate over all^ y
P n i = 1 Xi^ , all^ Xi^ iid with mean^ μ , variance σ^2 , Sn n
μ ,
σ^2 n
Sn − nμ σ
p n
Note 17 (Concentration Inequalities, LLN)
r (^) ] cr^ for^ c ,^ r^ >^0
X − μ
≥ c
≤ Var( c 2 X^ )for μ = E[ X ], c > 0
- Corollary: P
X − μ
≥ kσ
≤ (^) k^12 for σ =
p Var( X ), k > 0
p ˆ − p
≥ ε
≤ Var( ˆ ε 2 p )≤ δ , where δ is the confi- dence level (95% interval → δ = 0.05)
- p ˆ = proportion of successes in n trials, Var( ˆ p ) = p (1 n − p ) - =⇒ n ≥ (^4) ε^12 δ - For means, P
¯ (^) n^1 Sn −^ μ
¯ ≥^ ε
≤ σ
2 nε^2 =^ δ
- Sn =
P n i = 1 Xi^ , all^ Xi^ ’s iid mean^ μ , variance^ σ
2
- =⇒ ε = p σ nδ
, interval = Sn ± p σ nδ
- With CLT, P
An − μ
≤ ε
¯ ( An^ − μ )
p n σ
¯ ≤ ε
p n σ
− ε
p n σ
= 1 − δ.
μ , σ
2 n
; use inverse cdf to get ε
Table 1: Common Discrete Distributions
Distribution
Parameters
k
k
Expectation (
Variance (Var(
Support
Uniform
Uniform(
a ,
b
b^
a
k^
a
b^
a
a^
b 2
( b
a
[ a
,^ b
Bernoulli
Bernoulli(
p )
p^
k^
p
k^
p^
p
p
Binomial
Bin(
n ,
p
Ã^ n k
!^ p
k^ (
p
n ) − k
np
np
p
Geometric
Geom(
p )
p
p
k ) −^1
p
k )
1 p
p (^2) p
Poisson
Pois(
λ
λ
k^ e
− λ k!
λ^
λ^
Hypergeometric
Hypergeometric(
,^ n
¡ Kk
N
−
K n −
k
¡ Nn
n
n
n
Table 2: Common Continuous Distributions
Distribution
Parameters
fX
( x
( x
x
Expectation (
Variance (Var(
Support
Uniform
Uniform(
a ,
b
b^
a
x^
a b^
a
a^
b 2
( b
a
[ a
,^ b
Exponential
Exp(
λ )
λe
− λ
x^
e
− λ
x^
1 λ
(^12) λ
Normal/Gaussian
( μ
,^ σ
p
2 πσ
2
exp
( x
μ
2 σ
2
( x
μ^
(^2) σ