L02 ProbabilityBasics
L02 ProbabilityBasics
Definition
A set is a collection of unique objects.
Examples:
A = {3, 8, 31}
B = {apple, pear, orange, grape}
Not a valid set definition: C = {1, 2, 3, 4, 2}
Sets
I Order in a set does not matter!
{1, 2, 3} = {3, 1, 2} = {1, 3, 2}
I When x is an element of A, we denote this by:
x ∈ A.
x∈
/ A.
∅ = {}
Sample Spaces
Definition
A sample space is the set of all possible outcomes of an
experiment. We’ll denote a sample space as Ω.
Examples:
I Coin flip: Ω = {H, T}
I Roll a 6-sided die: Ω = {1, 2, 3, 4, 5, 6}
I Pick a ball from a bucket of red/black balls:
Ω = {R, B}
Some Important Sets
I Integers:
I Natural Numbers:
N = {0, 1, 2, 3, . . .}
I Real Numbers:
5 ∈ R, 17.42 ∈ R, π = 3.14159 . . . ∈ R
Building Sets Using Conditionals
N = {x ∈ Z : x ≥ 0}
{x ∈ Z : x is divisible by 2}
I Rationals:
Q = { p/q : p, q ∈ Z, q 6= 0}
Subsets
Definition
A set A is a subset of another set B if every element of
A is also an element of B, and we denote this as A ⊆ B.
Examples:
I {1, 9} ⊆ {1, 3, 9, 11}
I Q⊆R
I {apple, pear} * {apple, orange, banana}
I ∅ ⊆ A for any set A
Events
Definition
An event is a subset of a sample space.
Examples:
I You roll a die and get an even number:
{2, 4, 6} ⊆ {1, 2, 3, 4, 5, 6}
I You flip a coin and it comes up “heads”:
{H} ⊆ {H, T}
I Your code takes longer than 5 seconds to run:
(5, ∞) ⊆ R
Set Operations: Union
Definition
The union of two sets A and B, denoted A ∪ B is the set
of all elements in either A or B (or both).
Example:
A = {1, 3, 5} “an odd roll”
B = {1, 2, 3} “a roll of 3 or less”
A ∪ B = {1, 2, 3, 5}
Venn Diagram: Union
A B
Ω
Venn Diagram: Union
A∪B
Ω
Set Operations: Intersection
Definition
The intersection of two sets A and B, denoted A ∩ B is
the set of all elements in both A and B.
A B
Ω
Venn Diagram: Intersection
A∩B
Ω
Set Operations: Complement
Definition
The complement of a set A ⊆ Ω, denoted Ac , is the set
of all elements in Ω that are not in A.
Example:
A = {1, 3, 5} “an odd roll”
Ac = {2, 4, 6} “an even roll”
Venn Diagram: Complement
Ω
Venn Diagram: Complement
AC
Ω
Set Operations: Difference
Definition
The difference of a set A ⊆ Ω and a set B ⊆ Ω,
denoted A − B, is the set of all elements in Ω that are in
A and are not in B.
Example:
A = {3, 4, 5, 6}
B = {3, 5}
A − B = {4, 6}
Note: A − B = A ∩ Bc
Venn Diagram: Difference
A B
Ω
Venn Diagram: Difference
A-B
Ω
De Morgan’s Laws
(A ∪ B)c = Ac ∩ Bc
(A ∩ B)c = Ac ∪ Bc
(A ∪ B)c = Ac ∩ Bc
A B A B
Ω Ω
Venn Diagram: De Morgan
(A ∪ B)c = Ac ∩ Bc
A B
A∪B
Ω Ω
Venn Diagram: De Morgan
(A ∪ B)c = Ac ∩ Bc
A B
(A∪B)C
Ω Ω
Venn Diagram: De Morgan
(A ∪ B)c = Ac ∩ Bc
AC
(A∪B)C
Ω Ω
Venn Diagram: De Morgan
(A ∪ B)c = Ac ∩ Bc
(A∪B)C BC
Ω Ω
Venn Diagram: De Morgan
(A ∪ B)c = Ac ∩ Bc
(A∪B)C AC BC
Ω Ω
Venn Diagram: De Morgan
(A ∪ B)c = Ac ∩ Bc
(A∪B)C AC ∩ B C
Ω Ω
Exercises
Definition
A probability function on a finite sample space Ω
assigns every event A ⊆ Ω a number in [0, 1], such that
1. P(Ω) = 1
2. P(A ∪ B) = P(A) + P(B) when A ∩ B = ∅
P(A) is the probability that event A occurs.
Equally Likely Outcomes
|A|
P(A) =
|Ω|
Example: Rolling a 6-sided die
I P({1}) = 1/6
I P({1, 2, 3}) = 1/2
Repeated Experiments
Ω × Ω = {(x, y) : x ∈ Ω, y ∈ Ω}
Properties:
Order matters: (1, 2) 6= (2, 1)
Repeats are possible: (1, 1) ∈ N × N
More Repeats
Ωn = Ω × · · · × Ω (n times)
= {(x1 , x2 , . . . , xn ) : xi ∈ Ω for all i}
Complement of an event A:
P(Ac ) = 1 − P(A)
n! = n × (n − 1) × (n − 2) × · · · × 2
n
The binomial coefficient, written as k and spoken as
“n choose k”, is the number of ways you can select k
items out of a list of n choices.
Formula:
n n!
=
k k!(n − k)!
Binomial Coefficient or “n choose k”
|A| 1
P(A) = = ≈ 0.00397 = 0.397%
|Ω| 252