ECE302 – Probability and Applications
Tutorial #1
Reza Rafie
rrafie@ece.utoronto.ca
Administrivia
Reza Rafie
PhD Student in Communications
1
Administrivia
• Starting from today, you have an assignment at the
end of the tutorial. You have assignments every
other week.
2
Administrivia
• Starting from today, you have an assignment at the
end of the tutorial. You have assignments every
other week.
• Starting from next week, you have a quiz at the end
of the tutorial. You have quizzes every other week.
2
Administrivia
• Starting from today, you have an assignment at the
end of the tutorial. You have assignments every
other week.
• Starting from next week, you have a quiz at the end
of the tutorial. You have quizzes every other week.
• If you have not yet, check the course information on
blackboard for information about quizzes and
assignments.
2
Administrivia
• An unexplained missed quiz or assignment will
count as a zero towards your final mark. You must
take all assignments and quizzes.
3
Administrivia
• An unexplained missed quiz or assignment will
count as a zero towards your final mark. You must
take all assignments and quizzes.
• If you are unable to attend a tutorial, ask for your
professor’s permission.
3
Illustrating randomness and the role of probability
theory in our lives
A student lives in Mississauga and during the term leaves
an hour before her first class of the day. However, during
the exam period she leaves an hour and 15 mins before
her first exam of the day. Why (think probability of being
late)?
4
Illustrating randomness and the role of probability
theory in our lives
The probability of being late is a “decreasing” function of
the amount of time she allots for commuting.
4
Illustrating randomness and the role of probability
theory in our lives
Climate change has meant that the planet is getting
warmer, but we’ve had a crazy cold summer. Does this
mean climate change is a hoax?
5
Illustrating randomness and the role of probability
theory in our lives
Uh, no! While the mean or average temperature has gone
up, there’s also increasing variation in the weather!
5
Illustrating randomness and the role of probability
theory in our lives
Sports analytics is a growing business: before signing a
player (with millions at stake) teams must predict how a
particular player will perform. How do they do that? Is
the player’s past performance enough?
6
Illustrating randomness and the role of probability
theory in our lives
Clearly not (else, we will still be trying to sign Michael
Jordan, not Steph Curry).
6
Illustrating randomness and the role of probability
theory in our lives
Communications depends heavily on probability theory:
think of a cellphone voice call. What is being said is
random. Where the call is made from is random (the
system does not control where you are when you place
the call). Importantly, the signal must travel from the cell
phone to a basestation—loss in power due to buildings,
trees and other obstacles between the cellphone and
basestation is random (in fact, it is largely because of
this random loss in power that data rates for cellphones
are much lower than for a wired connection).
7
Question 1.1
Consider the following three random experiments:
Experiment 1: Toss a coin.
Experiment 2: Toss a die.
Experiment 3: Select a ball at random from an urn
containing balls numbered 0 to 9.
8
(a) Specify the sample space of each experiment.
9
Question 1.1
Each random experience has an unpredictable outcome.
10
Question 1.1
Each random experience has an unpredictable outcome.
Possible outcomes of rolling a coin are:
10
Question 1.1
Each random experience has an unpredictable outcome.
Possible outcomes of rolling a coin are:
10
Question 1.1
Each random experience has an unpredictable outcome.
Possible outcomes of rolling a coin are:
B and Z
10
Question 1.1
The set of all possible outcomes is called the sample
space.
11
Question 1.1
The set of all possible outcomes is called the sample
space. The sample space of rolling a coin is:
S1 = B , Z
11
Question 1.1
The sample space of rolling a dice is:
{ }
S2 = , , , , ,
12
Question 1.1
The sample space for experiment 3 is:
S3 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
13
Question 1.1
(b) Find the relative frequency of each outcome in each
of the above experiments in a large number of
repetitions of the experiment. Explain your answer.
14
Question 1.1
Suppose that a discrete experiment is repeated n times
under identical conditions. If we show the number of
occurrences of the ith outcome by Ni (n), the relative
frequency of the outcome is defined by
Ni (n)
fi (n) =
n
15
Question 1.1
For rolling a coin: fh (n) ≈ 0.5 and ft (n) ≈ 0.5.
16
Question 1.1
For rolling a coin: fh (n) ≈ 0.5 and ft (n) ≈ 0.5. For rolling a
dice: fi (n) ≈ 61 , for i ∈ {1, 2, . . . , 6}.
16
Question 1.1
For rolling a coin: fh (n) ≈ 0.5 and ft (n) ≈ 0.5. For rolling a
dice: fi (n) ≈ 61 , for i ∈ {1, 2, . . . , 6}. For Experiment 3:
fi (n) ≈ 101 , for i ∈ {0, 1, 2, . . . , 9}.
16
Question 1.1
For rolling a coin: fh (n) ≈ 0.5 and ft (n) ≈ 0.5. For rolling a
dice: fi (n) ≈ 61 , for i ∈ {1, 2, . . . , 6}. For Experiment 3:
fi (n) ≈ 101 , for i ∈ {0, 1, 2, . . . , 9}. Note that for all of these
experiments we assumed a uniform distribution over all
possible outcomes, that is, the coin is unbiased, the dice
is fair, and all of the balls in the urn are identical.
16
Question 2.2
A dice is tossed twice and the number of dots facing up
in each toss is counted and noted in the order of
occurrence.
(a) Find the sample space.
17
Question 2.2
What are the possible outcomes?
18
Question 2.2
What are the possible outcomes?
18
Question 2.2
What are the possible outcomes?
18
Question 2.2
What are the possible outcomes?
18
Question 2.2
What are the possible outcomes?
..
.
18
Question 2.2
The sample space is
S = {11, 12, 13, . . . , 16, 21, 22, . . . , 66}
19
Question 2.2
The sample space is
S = {11, 12, 13, . . . , 16, 21, 22, . . . , 66}
|S| =?
19
Question 2.2
The sample space is
S = {11, 12, 13, . . . , 16, 21, 22, . . . , 66}
|S| = 36
19
Question 2.2
The sample space is
S = {11, 12, 13, . . . , 16, 21, 22, . . . , 66}
2nd
1st
19
Question 2.2
(b) Find the set A corresponding to the event “number of
dots in first toss is not less than number of dots in
second toss.”
20
Question 2.2
Events are some subsets of the sample space that we
would like to assign them a probability.
21
Question 2.2
• Every event is a subset of the sample space.
22
Question 2.2
• Every event is a subset of the sample space.
• Not all of the subsets are necessarily events (we talk
more about it later in the course).
22
Question 2.2
• Every event is a subset of the sample space.
• Not all of the subsets are necessarily events (we talk
more about it later in the course).
Fact:
In this course, if the sample space is discrete, then all
of the subsets of the sample space are usually events!
22
Question 2.2
2nd
1st
Question 2.2
2nd
1st
Question 2.2
2nd
1st
23
Question 2.2
A = {11, 21, 22, 31, 32, 33, 41, . . . , 65, 66}
24
Question 2.2
A = {11, 21, 22, 31, 32, 33, 41, . . . , 65, 66}
|A| =
24
Question 2.2
A = {11, 21, 22, 31, 32, 33, 41, . . . , 65, 66}
|A| = 21
24
Question 2.2
(c) Find the set B corresponding to the event “number of
dots in first toss is 6.”
25
Question 2.2
2nd
1st
Question 2.2
2nd
1st
Question 2.2
2nd
1st
26
Question 2.2
B = {61, 62, 63, 64, 65, 66}
27
Question 2.2
B = {61, 62, 63, 64, 65, 66}
|B| =
27
Question 2.2
B = {61, 62, 63, 64, 65, 66}
|B| = 6
27
Question 2.2
(d) Does A imply B or does B imply A?
28
Question 2.2
If the event B happens it means that the outcome x is in
B, that is x ∈ B.
29
Question 2.2
If the event B happens it means that the outcome x is in
B, that is x ∈ B.
Note that, B ⊂ A =⇒ x ∈ A.
29
Question 2.2
If the event B happens it means that the outcome x is in
B, that is x ∈ B.
Note that, B ⊂ A =⇒ x ∈ A.
So, if B occurs, A occurs too!
29
Question 2.2
If the event B happens it means that the outcome x is in
B, that is x ∈ B.
Note that, B ⊂ A =⇒ x ∈ A.
So, if B occurs, A occurs too!
Therefore B implies A.
29
Question 2.2
(e) Find A ∩ Bc and describe this event in words.
30
Question 2.2
Bc is the complement of B.
31
Question 2.2
Bc is the complement of B.
So, A ∩ Bc is the event that A occurs and B does not occur.
31
Question 2.2
Bc is the complement of B.
So, A ∩ Bc is the event that A occurs and B does not occur.
In words
Number of dots in first toss is not less than number of
dots in second toss and number of dots in first toss is
not 6.
31
Question 2.2
2nd
1st
32
Question 2.2
A ∩ Bc = {11, 21, 22, 31, 32, 33, 41, 42, 43, 44, 51, 52, 53, 54, 55}
33
Question 2.2
(f) Let C corresponds to the event “number of dots in
dices differs by 2.” Find A ∩ C.
34
Question 2.2
A ∩ C =Number of dots in first toss is not less than
number of dots in second toss
and
number of dots in dices differs by 2.
35
Question 2.2
A ∩ C =Number of dots in first toss is not less than
number of dots in second toss
and
number of dots in dices differs by 2.
A ∩ C = {31, 42, 53, 64}
35
Question 2.4
A binary communication system transmits a signal X that
is either a +2 voltage signal or a −2 voltage signal. A
malicious channel reduces the magnitude of the
received signal by the number of heads it counts in two
tosses of a coin. Let Y be the resulting signal.
(a) Find the sample space.
36
Question 2.4
Number of heads (N) in two tosses of a coin can be 0,1 or
2.
37
Question 2.4
Number of heads (N) in two tosses of a coin can be 0,1 or
2.
We know that |Y| = |X| − N in which N ∈ {0, 1, 2}.
37
Question 2.4
Number of heads (N) in two tosses of a coin can be 0,1 or
2.
We know that |Y| = |X| − N in which N ∈ {0, 1, 2}.
If X = +2, possible outcomes are Y = +2, +1 or 0.
37
Question 2.4
Number of heads (N) in two tosses of a coin can be 0,1 or
2.
We know that |Y| = |X| − N in which N ∈ {0, 1, 2}.
If X = +2, possible outcomes are Y = +2, +1 or 0.
If X = −2, possible outcomes are Y = -2, -1 or 0.
37
Question 2.4
Number of heads (N) in two tosses of a coin can be 0,1 or
2.
We know that |Y| = |X| − N in which N ∈ {0, 1, 2}.
If X = +2, possible outcomes are Y = +2, +1 or 0.
If X = −2, possible outcomes are Y = -2, -1 or 0.
Therefore, SY = {−2, −1, 0, +1, +2}.
37
Question 2.4
(b) Find the set of outcomes corresponding to the event
“transmitted signal was definitely +2”
38
Question 2.4
We already saw that if X = +2, possible outcomes are Y =
+2, +1 or 0.
39
Question 2.4
We already saw that if X = +2, possible outcomes are Y =
+2, +1 or 0.
Also, we saw that Y = 0 can happen when X = −2.
39
Question 2.4
We already saw that if X = +2, possible outcomes are Y =
+2, +1 or 0.
Also, we saw that Y = 0 can happen when X = −2.
Thus, as a set, the answer is {+1, +2}.
39
Question 2.4
Y
X = +2 +2
+1
−1
X = −2 −2
40
Question 2.4
(c) Describe in words the event corresponding to the
outcome Y = 0
41
Question 2.4
This is the case that N = 2.
42
Question 2.4
This is the case that N = 2.
We cannot determine the input!
42
Question 2.5
A desk drawer contains six pens, four of which are dry.
(a) The pens are selected at random one by one until a
good pen is found. The sequence of test results is noted.
What is the sample space?
43
Question 2.5
The first pen is good!
Sa = {G
44
Question 2.5
The first pen is dry, the second pen is good!
Sa = {G, DG,
44
Question 2.5
We can select at most 4 dry pens!
Sa = {G, DG, DDG, DDDG, DDDDG}
44
Question 2.5
(b) Suppose that only the number, and not the sequence,
of pens tested in part (a) is noted. Specify the sample
space.
45
Question 2.5
Sa = {G, DG, DDG, DDDG, DDDDG}
46
Question 2.5
Sa = {G, DG, DDG, DDDG, DDDDG}
Sb = {1, 2, 3, 4, 5}
46
Question 2.5
(c) Suppose that the pens are selected one by one and
tested until both good pens have been identified, and
the sequence of test results is noted. What is the sample
space?
47
Question 2.5
Sc = {GG
48
Question 2.5
Sc = {GG, GDG
48
Question 2.5
Sc = {GG, GDG, DGG
48
Question 2.5
Sc = {GG, GDG, DGG, GDDG
48
Question 2.5
Sc = {GG, GDG, DGG, GDDG, . . . , DDDDGG}
48
Question 2.5
Sc = {GG, GDG, DGG, GDDG, . . . , DDDDGG}
What is |Sc |?
48
Question 2.5
Sc = {GG, GDG, DGG, GDDG, . . . , DDDDGG}
What is |Sc |?
Hint: The last pen is always a Good one!
48
Question 2.5
Sc = {GG, GDG, DGG, GDDG, . . . , DDDDGG}
What is |Sc |?
Hint: The last pen is always a Good one!
|Sc | = 1 + 2 + 3 + 4 + 5 = 15.
48
Question 2.5
(d) Specify the sample space in part (c) if only the
number of pens tested is noted.
49
Question 2.5
Sc = {GG, GDG, DGG, GDDG, . . . , DDDDGG}
50
Question 2.5
Sc = {GG, GDG, DGG, GDDG, . . . , DDDDGG}
Sd = {2, 3, 4, 5, 6}
50
Question 2.5
Sc = {GG, GDG, DGG, GDDG, . . . , DDDDGG}
Sd = {2, 3, 4, 5, 6}
What is |Sd |?
50
Question 2.9
The sample space of an experiment is the real line. Let
the events A and B correspond to the following subsets
of the real line: A = (−∞, r] and B = (−∞, s], where r ≤ s.
Find an expression for the event C = (r, s] in terms of A
and B. Show that B = A ∪ C and A ∩ C = ∅.
51
Question 2.9
−∞ r s +∞
C = B ∩ Ac
52
Question 2.10
Use Venn diagrams to verify the set identities given in
Eqs. (2.2) and (2.3). You will need to use different colors or
different shadings to denote the various regions clearly.
53
Question 2.10
A ∪ (B ∪ C) = (A ∪ B) ∪ C
A ∩ (B ∩ C) = (A ∩ B) ∩ C
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
54
Question 2.10
A ∪ (B ∪ C) = (A ∪ B) ∪ C
A ∩ (B ∩ C) = (A ∩ B) ∩ C
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
Think about it for 1 minute!
54
Question 2.12
Show that if A ∪ B = A and A ∩ B = A then A = B
55
Question 2.12
To show that two sets A, B are equal A = B, we usually
show that:
56
Question 2.12
To show that two sets A, B are equal A = B, we usually
show that:
1. A ⊂ B
56
Question 2.12
To show that two sets A, B are equal A = B, we usually
show that:
1. A ⊂ B
2. B ⊂ A
56
Question 2.12
To show that A ⊂ B, we need to prove that for any x ∈ A,
we have x ∈ B:
57
Question 2.12
To show that A ⊂ B, we need to prove that for any x ∈ A,
we have x ∈ B:
∀x ∈ A : A = A ∩ B =⇒ x ∈ (A ∩ B)
=⇒ x ∈ B =⇒ A ⊂ B
57
Question 2.12
To show that B ⊂ A, we need to prove that for any x ∈ B,
we have x ∈ A.
58
Question 2.12
To show that B ⊂ A, we need to prove that for any x ∈ B,
we have x ∈ A.
∀x ∈ B : x ∈ B ∪ A = A =⇒ x ∈ A
=⇒ B ⊂ A
58
Question 2.12
A ⊂ B and B ⊂ A =⇒ A = B
59
Questions?
59
Fun fact
We can approximate π using the concept of relative
frequency!
60
Fun fact
61
Fun fact
61
Fun fact
Sample points from the square “uniformly” at random.
61
Fun fact
Sample points from the square “uniformly” at random.
The relative frequency of points within the circle is
approximately
61
Fun fact
Sample points from the square “uniformly” at random.
The relative frequency of points within the circle is
2
approximately π×122
= π/4
61
Fun fact
Using Matlab after 100 iterations, sampling 10 million
points in each iteration:
62
Fun fact
i t e r a t i o n s = 100;
pi_approx = z e r o s ( i t e r a t i o n s , 1 ) ;
for k = 1: iterations
num_of_samples = 1 0 0 0 0 0 0 0 ;
X = rand ( num_of_samples , 1 ) ;
Y = rand ( num_of_samples , 1 ) ;
d i s t = s q r t ( X. ^2 + Y. ^2) ;
num_samples_inside = nnz ( d i s t <= 1 ) ;
pi_approx ( k ) = 4 * num_samples_inside / ...
num_of_samples ;
end
format l o n g
mean ( pi_approx )
pi
63
Fun fact
True value: 3.141592653589793 ...
64
Fun fact
True value: 3.141592653589793 ...
Approximated value: 3.141594348
64