Answers: Practice Problems - Probability I

Answers: Practice Problems - Probability I
Math Prefresher 2013
August 22, 2013
Problem 1
Someone claims they can identify four different brands of beer by taste. An experiment is set up (off campus
of course) to test her ability in which she is given each of the four beers one at a time without labels or any
visual identification.
1. How many different ways can the four beers be presented to her one at a time?
24
This is a counting case where order matters (since they are one at a time) without replacement. Our
n is 4 and our k is 4 since we are selecting all beers. So
4!
(4−4)!
= 4! = 24 ways.
2. What is the probability that she will correctly identify all four brands simply by guessing?
1
24
There are 24 permutations and only 1 way for her to get them all right so the probability is
1
24 .
Alternatively, she has a 1/4 chance of getting the first one correct. She then has a 1/3 chance of
getting the second one correct, given that she got the first one correct and so on. This gives her the
probability of
1
4!
=
1
24 .
3. What is the probability that she will incorrectly identify only one beer simply by guessing (assume she
does not duplicate an answer)?
0
She cannot incorrectly identify 1 beer since there would be no other beer to get the name she missed.
The probability is therefore zero.
4. Is the event that she correctly identifies the second beer disjoint with the event that she incorrectly
identifies the fourth beer?
No
Since she can correctly identify the second and incorrectly identify the fourth in the same test, the
intersection is not the null set.
1
Problem 2
Suppose you had a pair of four-sided dice. You sum the results from a single toss.
1. What is the set of possible outcomes?
{2, 3, 4, 5, 6, 7, 8}
2. What is the probability of each of these outcomes?
The table below provides the ways to reach each possible outcome. There are 16 different pairings. So
the probabilities are:
P (X = 2) = 1/16
P (X = 3) = 2/16
P (X = 4) = 3/16
P (X = 5) = 4/16
P (X = 6) = 3/16
P (X = 7) = 2/16
P (X = 8) = 1/16
1 2 3 4
1
2
3
4
5
2
3
4
5
6
3
4
5
5
7
4
5
6
7
8
Problem 3
In a given town, 40% of the voters are Democrat and 60% are Republican. The president’s budget is supported by 50% of the Democrats and 90% of the Republicans. If a randomly (equally likely) selected voter
is found to support the president’s budget, what is the probability that they are a Democrat?
0.27
We are given that P (D) = .4, P (Dc ) = .6P (S|D) = .5, P (S|Dc ) = .9.
Using this, Bayes’ Law, and the Law of Total Probability we know:
P (D|S) =
P (D)P (S|D)
P (D)P (S|D)+P (D c )P (S|D c )
=
.4×.5
.4×.5+.6×.9
= .27
2
Problem 4
Assume that 2% of the population of the United States are members of some extremist militia group. We
develop a survey that positively classifies someone as being a member of a militia group given that they are
a member 95% of the time and negatively classifies someone as not being a member of a militia group given
that they are not a member 97% of the time. What is the probability that someone positively classified as
being a member of a militia group is actually a militia member?
0.38
We are given that P (M ) = .02, P (C|M ) = .95, P (C c |M c ) = .97.
P (C|M )P (M )
P (C)
P (C|M )P (M )
P (C|M )P (M )+P (C|M c )P (M c )
P (C|M )P (M )
P (C|M )P (M )+[1−P (C c |M c )]P (M c )
.95×.02
.95×.02+.03×.98
P (M |C) =
=
=
=
= .38
Problem 5
The Jack of Spades (with cider), Jack of Hearts (with tarts), Queen of Spades (with a wink), and Queen of
Hearts (without tarts) are taken from a deck of cards. These four cards are shuffled, and then two are dealt.
1. Find the probability that both of these two cards are Queens, given that the first card dealt is a Queen.
P (Q1 ∩ Q2 ∩ Q1 )
P (Q1 ∩ Q2 )
P (Q2 |Q1 )P (Q1 )
1
=
=
= P (Q2 |Q1 ) =
P (Q1 )
P (Q1 )
P (Q1 )
3
P (Q1 ∩ Q2 |Q1 ) =
2. Find the probability that both are Queens, given that at least one is a Queen.
P (Q1 ∩ Q2 |Q1 ∪ Q2 ) =
=
P (Q1 ∩ Q2 ∩ (Q1 cupQ2 ))
P (Q1 ∩ Q2 )
P (Q2 |Q1 )P (Q1 )
=
=
P (Q1 ∪ Q2 )
P (Q1 ∪ Q2 )
P (Q1 ) + P (Q2 ) − P (Q1 ∩ Q2 )
P (Q2 |Q1 )P (Q1 )
=
P (Q1 ) + P (Q2 ) − P (Q2 |Q1 )P (Q1 )
1
2
+
1
6
1
2
−
1
6
=
1
5
It may be easier to realize that this means that the set of possibilities is {(Qh , Qs ), (Qh , Js ), (Qh , Jh ), (Qs , Js ), (Qs , Jh )},
and only 1/5 of these has both queens.
3. Find the probability that both are Queens, given that one is the Queen of Hearts.
P (Q1 ∩ Q2 |(Q1 ∩ H1 ) ∪ (Q2 ∩ H2 )) =
P (Q1 ∩ H1 ∩ Q2 ) + P (Q1 ∩ Q2 ∩ H2 )
P (Q1 ∩ H1 ) + P (Q2 ∩ H2 )
because Q1 ∩ H1 and Q2 ∩ H2 are disjoint.
=
P (Q2 |Q1 ∩ H1 )P (Q1 ∩ H1 ) + P (Q2 ∩ H2 |Q1 )P (Q1 )
P (Q1 ∩ H1 ) + P (Q2 ∩ H2 )
3
=
P (Q2 |Q1 ∩ H1 )P (Q1 ∩ H1 ) + P (Q2 ∩ H2 |Q1 ∩ H1C )P (Q1 ∩ H1C )
P (Q1 ∩ H1 ) + P (Q2 ∩ H2 )
The Q1 is switched to a Q1 ∩ H1C because the only way to get a queen and heart in the second draw
given a queen in the first is if that first queen was the queen of spades.
=
( 13 )( 14 ) + ( 13 )( 14 )
1
=
1
1
3
+
4
4
It may be easier to realize that this means that the set of possibilities is {(Qh , Qs ), (Qh , Js ), (Qh , Jh )},
and only 1/3 of these has both queens.
Problem 6: LaTeX Practice
1. Create a list (numbered) of your favorite foods.
\begin{enumerate}
\item Chocolate
\item Fried Chicken
\item Watermelon
\item etc.
\end{enumerate}
2. Create a list (with bullets) of your preferred news sources
\begin{itemize}
\item NY Times
\item The New Yorker
\item etc.
\end{itemize}
Problem 7: R Practice
1. Create a vector of five numbers.
ans.1 <- c(1,2,3,4,5)
2. Find and store the mean of the vector.
ans.2 <- mean(ans.1)
3. Create
the following
matrix.


0 2 4


 1 3 0 
0 0 1
4
ans.3 <- matrix(c(0,2,4,1,3,0,0,0,1), nrow=3, ncol=3, byrow=T)
4. Create a list that includes your vector, stored mean, and matrix.
ans.4 <- list(ans.1,ans.2,ans.3)
5. Create a vector of integers from 1 to 20.
ans.5 <- 1:20
[1]
1
2
3
4
5
6
7
8
9 10 11 12 13 14 15 16 17 18 19 20
6. In one line of code, add 2, multiply by 5, take the square root, and then take the log of each element
in the vector you created.
ans.6 <- log(sqrt((ans.5 + 2) * 5))
[1] 1.354025 1.497866 1.609438 1.700599 1.777674 1.844440 1.903331 1.956012
[9] 2.003667 2.047172 2.087194 2.124248 2.158744 2.191013 2.221326 2.249905
[17] 2.276938 2.302585 2.326980 2.350240
7. Create a vector of your 5 favorite cities.
ans.7 <- c("Paris", "New York", "Vienna", "Moscow", "San Francisco")
8. Create a 3 × 3 matrix where each element of every column corresponds to the column number.
ans.8 <- matrix(c(1, 2, 3), ncol = 3, nrow = 3, byrow = T)
[,1] [,2] [,3]
[1,]
1
2
3
[2,]
1
2
3
[3,]
1
2
3
9. Convert this matrix into a dataframe.
ans.9 <- as.data.frame(ans.8)
V1 V2 V3
1
1
2
3
2
1
2
3
3
1
2
3
10. Create a 3 × 5 × 2 array of all 0s.
5
ans.10 <- array(0, dim = c(3, 5, 2))
, , 1
[,1] [,2] [,3] [,4] [,5]
[1,]
[2,]
0
0
0
0
0
0
0
0
0
0a
[3,]
0
0
0
0
0
, , 2
[,1] [,2] [,3] [,4] [,5]
[1,]
0
0
0
0
0
[2,]
0
0
0
0
0
[3,]
0
0
0
0
0
11. Create a list containing your array, your dataframe and your two vectors.
ans.11 <- list(ans.10, ans.9, ans.7, ans.6)
6