7.1.18

7.1.18
What is the probability that a positive integer not exceeding 100 selected at
random is divisible by 3?
The sample space is S = {1, 2, . . . , 100}. We start by counting how many
c=
positive integers not exceeding 100 that 3 is divisible with. That is b 100
3
33.
Thus we find the probability to be
33
.
100
7.1.28
Which is most likely: rolling a total of 8 when two dice is rolled or rolling a
total of 8 when three dice is rolled?
Let us start by considering the probability for rolling a total of 8 with two
dice. Then the sample space will look as the follwing.
1
2
3
4
5
6
1
2
3
4
5
6
7
2
3
4
5
6
7
8
3 4 5 6
4 5 6 7
5 6 7 8
6 7 8 9
7 8 9 10
8 9 10 11
9 10 11 12
Here the index to the left denotes value of when the first die is rolled. The
index above denotes the value of when the second die is rolled. As we can
see there are 5 out of 36 possible rolls with two dice that gives a total of 8.
5
.
This gives us probability 36
Next we consider the case where three dice is rolled. Here the size of the
sample space is 63 . Let us consider the different ways three dice can roll
and give a total of 8. We find the following ways of doing so. 1 + 1 + 6 =
1
1 + 2 + 5 = 1 + 3 + 4 = 2 + 2 + 4 = 2 + 3 + 3. When we have a sum of 3 distinct
values, there are 3! = 6 different ways this sum could be expressed. Take for
instance 1 + 2 + 5 = 1 + 5 + 2 = 2 + 1 + 5 = 2 + 5 + 1 = 5 + 1 + 2 = 5 + 2 + 1.
When a sum of 2 equal values and a 3rd. that is different, there are 3 different
ways this sum can be expressed. As an example consider the following:
1 + 1 + 6 = 1 + 6 + 1 = 6 + 1 + 1.
These two properties gives us a total of 3 + 6 + 6 + 3 + 3 = 21 different ways
three dice can be rolled to give a total of 8. Thus the probability for getting
. Since 652 > 21
we have that getting
a total of 8 when rolling three dice is 21
63
63
a total of 8 when rolling two dice has greater probability than trying to the
same by rolling three dice.
7.2.6
What is the probability if these events when we randomly select a permutation of {1, 2, 3, 4}?
a)
1 precedes 4.
There are 4! = 24 different permutations, which is the size of our sample
space. If 1 is the first element of the permuation, there is 3! = 6 different
ways 1 can precedes 4. If 1 is the second element of the permutation, there
is 2 different elements that can precedes 1 (the elements 2 and 3), and for
each of these possibilities there is 2! = 2 different ways the elements can be
ordered after 1. If 1 is the third element of the permutation, the last element
must be 4. In this case there is 2! = 2 different ways the two firs elements can
be permutated. If 1 is the fourth element of the permutation, no permutaions
where 1 precedes 4 exists.
The total number of permutations where 1 precedes 4 is 3! + 2 · 2! + 2! =
2
6 + 4 + 2 = 12. Thus the probability for randomly selecting a permutation
= 21 .
where 1 precedes 4 is 12
24
b)
4 precedes 1.
We note that this is the same as not 1 precedes 4. Since we already know
the probability for this the complement is easy to calculate. We find the
probability to be 1 − 12 = 12 .
c)
4 precedes 1 and 4 precedes 2.
If 4 is the first element of a permutation, there is 3! different permutations
satisfying the conditions. If 4 is the second element of a permutation, there is
2! different permutations satisfying the conditions. If 4 is the third or fourth
element of a permutation there is no way of satisfying both conditions.
The total number of permutations where 4 precedes 1 and 2 is 3! + 2! = 8.
Thus the probability for randomly selecting a permutation where 4 precedes
8
= 13
1 and 4 precedes 2 is 24
d)
4 precedes 1, 4 precedes 2 and 4 precedes 3.
This can only happen when 4 is the first element of the permutations which is
the case 3! times. Thus the probability for randomly selecting a permutation
6
where 4 precedes 1, 4 precedes 2 and 4 precedes 3 is 24
= 14
3
e)
4 precedes 3 and 2 precedes 1.
If 4 is the first element of the permutation and 2 is the second element of the
permutaion, there is 2! different permutations satisfying the permutations.
If 2 is the first element of the permutation and 4 is the second element of the
permutation, there is 2! different permutations satisfying the permutations.
If 4 is the first element of the permutation and 2 is the third element of the
permutation, there is 1 permutation satisfying the permutations.
If 2 is the first element of the permutation and 4 is the third element of the
permutation, there is 1 permutation satisfying the permutations.
No other permuations satisfies the conditions. Thus the probability for ran6
= 41 .
domly selecting a permutation where 4 precedes 3 and 2 precedes 1 is 24
7.2.14
a)
What is the probability that two people chosen at random were born on the
same day of the week?
The size of the sample space is 72 = 49. Any day of the week is equally likely
to be someone’s birthday. For each week day there is one possibility for the
7
two to be born on the same weekday. Thus the probability is 49
= 71
4
b)
What is the probability that two people in a group of n people is born on
the same day of the week?.
This is the same as the birthday problem, except we consider birthdays within
a week instead of a whole year.
We consider the complementary probability, since this is easier to work with
(the probability that no two people of a group of n is born on the same day of
the week). We will denote this probability pn . When n = 2 we have pn = 76 ,
when n = 3 we have pn = 57 etc. A general formula for pn is
pn =
6 5
7 − (n − 1)
· ···
7 7
7
The probability that two people in a group of n people is born on the same
day of the week is
1 − pn = 1 −
6 5
7 − (n − 1)
· ···
7 7
7
c)
How many people chosen at random are needed to make the probability
greater than 1/2 that there are at least two people born on the same day of
the week?
When n = 2 the probability is
1−
1
1
6
= <
7
7
2
When n = 3 the probability is
1−
6 5
19
1
· =
<
7 7
49
2
5
When n = 4 the probability is
1−
6 5 4
223
1
· · =
>
7 7 7
343
2
Thus when 4 people is chosen at random, the probability is greater than 1/2
that there are at least two people with birhday on the same day of the week.
7.2.22
Assume that the probability a child is a boy is 21 and that the sexes of children
born into a family are independent. What is the probability that a family of
five children has
a)
exactly three boys?
The size of the sample space is 25 = 32. From chapter 6 we remember that
we can find the number of ways 3 elements can be picked from a set of size
5!
= 10. The probability for a familty of five children
5 is C(5, 3) = 3!(5−3)!
10
5
having exactly 3 boys is 32
= 16
b)
at least one boy?
The complement of this event is when none of the children is a boy. This
can only be when all the children are girls. This can only happen in one
outcome. Thus the probability for a family of five children having at least
1
31
one boy is 1 − 32
= 32
.
6
c)
at least one girl?
The calcuation for this is pretty much the same as in b). There is only one
way that none of the children is a girl. This gives us that the probability for
1
= 31
.
a family of five children having at least one girl is 1 − 32
32
d)
all children of the same sex.
This can only happen in two situations, either they are all girls or all all
boys. Thus the probability for a family of five children having all children of
2
1
the same sex is 32
= 16
.
7.3.2
Suppose that Frida selects a ball by first picking one of two boxes at random
and then selecting a ball from this box at random. The first box contains
two white balls and three blue balls, and the second box contains four white
balls and one blue ball. What is the probability that Frida picked a ball from
the first box if she has selected a blue ball?
Here we are going to use Bayes formula. Let the event that box one i selected
be F and the complement that box two is selected F . We define the event
that a blue ball is selected to be E and the complement that a white ball is
selected to be E.
From Bayes formula we find the probability p(F |E) to be
p(F |E) =
p(E|F )p(F )
p(E|F )p(F ) + p(E|F )p(F )
7
The probabilities are p(F ) = 12 , p(E|F ) = 35 , p(E|F ) =
1
5
and p(F ) = 21 .
Thus the probability for Frida having selected box one when picking a blue
ball is
p(F |E) =
3
p(E|F )p(F )
3/5 · 1/2
=
=
3/5 · 1/2 + 1/5 · 1/2
4
p(E|F )p(F ) + p(E|F )p(F )
7.3.12
Suppose that a Bayesian spam filter is trained on a set of 500 spam messages
and 200 messages that are not spam. The word ”exiting” appears in 40 spam
messages and in 25 messages that are not spam. Would an incoming message
be rejected as spam if it contains the word ”exiting” and the threshold for
rejecting spam is 0.9?
We define the event that a message is spam to be S and the event that the
message contains ”exiting” to be E. Since we do not know anything about
the probability for an incoming message to be spam we assume that the
probability is 1/2 for a random message to be spam, and the same probability
for a message not to be spam. Thus p(S) = p(S) = 12 .
The probability for a message to contain the word ”exiting” when the message
40
and the probability for a message to
is known to be spam is p(E|S) = 500
contain the word ”exiting” when the message is known to not be spam is
25
p(E|S) = 200
.
From Bayes formula we find the probability for a message to be spam when
it contains the word ”exiting” is
p(S|E) =
p(E|S)p(S)
p(E|S)p(S) + p(E|S)p(S)
Hence the probability is
p(S|E) =
40/500 · 1/2
≈ 0.39
40/500 · 1/2 + 25/200 · 1/2
8
Since 0.39 < 0.9 the message will not be considered spam.
7.4.2
What is the expected number of times a 6 appears when a fair die is rolled
10 times?
The sample space is the set of possible outcomes when rolling a die 10 times.
This sample space has size 610 Let X be the random variable that returns
the number of 6’s when a die is rolled 10 times.
There are 510 different ways to roll a die 10 times without the die having 6
as outcome. This gives us the probability p(X = 0) = 510 /610
There are 59 ·
exactly once.
10
1
different ways to roll a die 10 times having 6 as an outcome
There are 58 ·
exactly twice.
10
2
different ways to roll a die 10 times having 6 as an outcome
There are 57 · 10
different ways to roll a die 10 times having 6 as an outcome
3
exactly three times.
There are 56 · 10
different ways to roll a die 10 times having 6 as an outcome
4
exactly four times.
There are 55 · 10
different ways to roll a die 10 times having 6 as an outcome
5
exactly five times.
There are 54 · 10
different ways to roll a die 10 times having 6 as an outcome
6
exactly six times.
There are 53 · 10
different ways to roll a die 10 times having 6 as an outcome
7
exactly seven times.
There are 52 ·
10
8
different ways to roll a die 10 times having 6 as an outcome
9
exactly eight times.
There are 51 · 10
different ways to roll a die 10 times having 6 as an outcome
9
exactly nine times.
There are 50 · 10
different ways to roll a die 10 times having 6 as an outcome
10
exactly ten times.
This gives us the following expectation for X.
10
10
10
8
7
6
59 · 10
5
·
5
·
5
·
510
1
2
3
4
+2·
+3·
+4·
E(X) = 0 · 10 + 1 ·
10
10
10
10
6
6
6
6
6
10
10
10
4
3
2
5
·
5
·
5
·
55 · 10
6
7
8
5
+6·
+7·
+8·
+5·
610 610 610
610
51 · 10
50 · 10
5
9
10
+9·
+ 10 ·
=
10
10
6
6
3
10
7.4.22
What is the variance of the number of times a 6 appears when a fair die is
rolled 10 times.
We use the same setup as in 7.4.2. From the lecture we know the variance
is.
X
V (X) =
(r − E(X))2 p(X = r)
r∈X(S)
In this case we get
2 10 2 9 10 2 8 10
5 · 1
5 · 2
5
5
5
5
+
· 10 + 1 −
·
2
−
·
V (X) = 0 −
3
6
3
610
3
610
2 7 10 2 6 10 2 5 10
5 · 3
5 · 4
5 · 5
5
5
5
+ 3−
+ 4−
+ 5−
·
·
·
10
10
3
6
3
6
3
610
2 4 10
2 3 10
2 2 10
5 · 6
5 · 7
5 · 8
5
5
5
+ 6−
·
+ 7−
·
+ 8−
·
10
10
3
6
3
6
3
610
2 1 10 2 0 10
5 · 9
5 · 10
5
25
5
·
·
+
10
−
=
+ 9−
10
10
3
6
3
6
18
11