首页 > 代码库 > 加州大学伯克利分校Stat2.2x Probability 概率初步学习笔记: Midterm
加州大学伯克利分校Stat2.2x Probability 概率初步学习笔记: Midterm
Stat2.2x Probability(概率)课程由加州大学伯克利分校(University of California, Berkeley)于2014年在edX平台讲授。
PDF笔记下载(Academia.edu)
PRACTICE PROBLEMS FOR THE MIDTERM
PROBLEM 1
In a group of 5 high school students, 2 are in 9th grade, 2 are in 10th grade, and 1 is in 12th grade. Two of the students are picked at random without replacement.
a) the first student picked is not in 10th grade
b) both of the students are in 9th grade
c) the second student picked is in 12th grade
d) the second student picked is in 12th grade, given that the first student picked is in 9th grade
e) at least one of the students is in 10th grade
f) the two students are at least two grades apart
Solution:
a) $$P(\text{first student is not in 10th grade})=\frac{3}{5}$$
b) $$P(\text{both are in 9th grade})=\frac{2}{5}\times\frac{1}{4}=\frac{1}{10}$$
c) $$P(\text{second student is in 12th grade})=\frac{4}{5}\times\frac{1}{4}=\frac{1}{5}$$
d) $$P(\text{second student is in 12th grade | first student is in 9th grade})$$ $$=\frac{P(\text{first is in 9th grade & second is in 12th grade})}{P(\text{first student is in 9th grade})}=\frac{\frac{2}{5}\times\frac{1}{4}}{\frac{2}{5}}=\frac{1}{4}$$
e) $$P(\text{at least one student is in 10th grade})$$ $$=1-P(\text{no student is in 10th grade})=1-\frac{3}{5}\times\frac{2}{4}=\frac{7}{10}$$
f) $$P(\text{at least two grades apart})=P(\text{grade 9 & 12})+P(\text{grade 10 & 12})$$ $$=(\frac{2}{5}\times\frac{1}{4}+\frac{1}{5}\times\frac{2}{4})+(\frac{2}{5}\times\frac{1}{4}+\frac{1}{5}\times\frac{2}{4})=\frac{2}{5}$$
PROBLEM 2
In a raffle there are 100 tickets of which 1 is the winner. I pick 2 tickets at random. Find the chance that at least one of the tickets that I pick is the winner, if I pick
a) with replacement
b) without replacement
Solution:
a) $$P(\text{at least one is the winner with replacement})$$ $$=1-P(\text{none of the two is the winner})=1-\frac{99}{100}\times\frac{99}{100}=0.0199$$
b) $$P(\text{at least one is the winner without replacement})$$ $$=1-P(\text{none of the two is the winner})=1-\frac{99}{100}\times\frac{98}{99}=0.02$$
PROBLEM 3
In an undergraduate class, 70% of the students are juniors and the rest are seniors. Of the juniors, 40% are math majors. Of the seniors, 25% are math majors. One student is picked at random. Find
a) $P(\text{junior})$
b) $P(\text{senior})$
c) $P(\text{math major | junior})$
d) $P(\text{not a math major | junior})$
e) $P(\text{math major | senior})$
f) $P(\text{not a math major | senior})$
g) $P(\text{junior math major})$
h) $P(\text{senior math major})$
i) $P(\text{math major})$
j) $P(\text{junior | math major})$
k) $P(\text{senior | math major})$
l) $P(\text{junior | not a math major})$
Solution:
a) $$P(\text{junior})=0.7$$
b) $$P(\text{senior})=1-0.7=0.3$$
c) $$P(\text{math major | junior})=0.4$$
d) $$P(\text{not a math major | junior})=1-0.4=0.6$$
e) $$P(\text{math major | senior})=0.25$$
f) $$P(\text{not a math major | senior})=1-0.25=0.75$$
g) $$P(\text{junior math major})=0.7\times0.4=0.28$$
h) $$P(\text{senior math major})=0.3\times0.25=0.075$$
i) $$P(\text{math major})=P(\text{junior math major})+P(\text{senior math major})$$ $$=0.28+0.075=0.355$$
j) $$P(\text{junior | math major})=\frac{P(\text{junior math major})}{P(\text{math major})}=\frac{0.28}{0.355}\doteq0.7887324$$
k) $$P(\text{senior | math major})=\frac{P(\text{senior math major})}{P(\text{math major})}=\frac{0.075}{0.355}\doteq0.2112676$$
l) $$P(\text{junior | not a math major})=\frac{P(\text{junior not a math major})}{P(\text{not a math major})}$$ $$=\frac{0.7\times(1-0.4)}{1-0.355}\doteq0.6511628$$
PROBLEM 4
There are two events, $A$ and $B$. $P(A)=0.2$ and $P(B)=0.3$.
a) Are $A$ and $B$ independent?
i) Yes. ii) No. iii) Maybe, or maybe not; there is not enough information to decide.
b) What is the biggest that $P(\text{A or B})$ can be?
c) What is the smallest that $P(\text{A or B})$ can be?
Solution:
a) Maybe, or maybe not; there is not enough information to decide.
b) $$P(\text{A or B})=P(A)+P(B)-P(A \cap B)\le P(A)+P(B)=0.5$$
c) $$P(\text{A or B})\ge \max\{P(A), P(B)\}=0.3$$
PROBLEM 5
There are two events, $A$ and $B$. $P(A)=0.2$, $P(B)=0.3$, and $P(\text{A or B})=0.4$. Are $A$ and $B$ independent?
i) Yes. ii) No. iii) Maybe, or maybe not; there is not enough information to decide.
Solution:
No. $$P(A \cup B)=P(A)+P(B)-P(A\cap B)=0.2+0.3-P(A\cap B)=0.4$$ $$\Rightarrow P(A\cap B)=0.1\neq P(A)\cdot P(B)=0.06$$
PROBLEM 6
A die is rolled repeatedly. Find the chance that
a) each of the first three rolls shows one spot
b) the first three rolls all show the same face
c) the face with six spots appears at most once among the first 5 rolls
d) the face with six spots appears for the first time on the 5th roll
e) the face with six spots appears for the second time on the 5th roll
Solution:
a) $$P(\text{each of the first three rolls is one spot})=(\frac{1}{6})^3=\frac{1}{216}$$
b) $$P(\text{each of the first three rolls is the same spot})=6\times(\frac{1}{6})^3=\frac{1}{36}$$
c) Binomial distribution $n=5, k=0:1, p=\frac{1}{6}$: $$P(\text{six spots appears at most once among the first 5 rolls})$$ $$=\sum_{k=0}^{1}C_{5}^{k}\cdot (\frac{1}{6})^{k}\cdot (\frac{5}{6})^{5-k}\doteq0.8037551$$ R code:
> sum(dbinom(x = 0:1, size = 5, prob = 1/6))[1] 0.8037551
d) $$P(\text{six spots appears for the first time on the 5th roll})$$ $$=(\frac{5}{6})^4\times(\frac{1}{6})\doteq0.08037551$$ R code:
> dgeom(x = 4, prob = 1/6)[1] 0.08037551
e) There is one roll appearing six spots among the first 4 rolls and the 5th roll is six spots, that is, it is binomial distribution that $n=4, k=1, p=1/6$ among the first 4 rolls: $$P(\text{six spots appears for the second time on the 5th roll})$$ $$=C_{4}^{1}\times\frac{1}{6}\times(\frac{5}{6})^3\times\frac{1}{6}\doteq0.06430041$$ R code:
> dbinom(x = 1, size = 4, prob = 1/6) * 1/6[1] 0.06430041
PROBLEM 7
I toss a coin 2 times; then my friend tosses it 2 times. Find the chance that we get the same number of heads.
Solution:
The outcome of one person is: $\{HH, HT, TH, TT\}$. Hence $$P(\text{zero head})=\frac{1}{4}\times\frac{1}{4}=\frac{1}{16}$$ $$P(\text{1 head})=\frac{1}{2}\times\frac{1}{2}=\frac{1}{4}$$ $$P(\text{2 heads})=\frac{1}{4}\times{1}{4}=\frac{1}{16}$$ $$P(\text{we get the same number of heads})=\frac{1}{16}+\frac{1}{4}+\frac{1}{16}=\frac{3}{8}$$
PROBLEM 8
A standard deck consists of 52 cards; 26 are red and 26 are black; there are 4 cards of each rank: Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King. Cards are dealt at random without replacement. Find the chance that
a) the first 3 cards are of three different ranks
b) at least one of the first three cards is a king
c) either the first card is a king or the second is a queen, but not both
d) there is at most one king among the first 5 cards
e) the 10th card is a king
f) the 19th and 27th cards are both kings
g) it takes more than 10 cards for the first king to appear
h) it takes more than 10 cards for the second king to appear
i) it takes exactly 10 cards for the second king to appear
Solution:
a) $$P(\text{first 3 cards are different ranks})=\frac{52}{52}\times\frac{48}{51}\times\frac{44}{50}\doteq0.8282353$$
b) $$P(\text{at least one king among the first 3 cards})$$ $$=1-P(\text{no king among the first 3 cards})=1-\frac{48}{52}\times\frac{47}{51}\times\frac{46}{50}\doteq0.2173756$$
c) $$P(\text{either the 1st is king or the 2nd is queen but not both})$$ $$=P(\text{1st is K, 2nd is not Q})+P(\text{1st is not K, 2nd is Q})$$ $$=P(\text{1st is K, 2nd is not Q})+P(\text{1st is Q, 2nd is Q})+P(\text{1st is neither K nor Q, 2nd is Q})$$ $$=\frac{4}{52}\times\frac{47}{51}+\frac{4}{52}\times\frac{3}{51}+\frac{44}{52}\times\frac{4}{51}\doteq0.1417798$$ Alternatively $$P(\text{either the 1st is king or the 2nd is queen but not both})$$ $$=P(\{\text{1st is K}\}\cup\{\text{2nd is Q}\})-P(\{\text{1st is K}\}\cap\{\text{2nd is Q}\})$$ $$=P(\text{1st is K})+P(\text{2nd is Q})-2\times P(\{\text{1st is K}\}\cap\{\text{2nd is Q}\})$$ $$=\frac{4}{52}+\frac{4}{52}-2\times\frac{4}{52}\times{4}{51}\doteq0.1417798$$ Note that $$P(\text{2nd is Q})=P(\text{1st is no Q, 2nd is Q})+P(\text{1st is Q, 2nd is Q})$$ $$=\frac{4}{52}\times\frac{3}{51}+\frac{48}{52}\times\frac{4}{51}=\frac{4}{52}$$
d) Hypergeometric distribution $x=0:1, m=4, n=48, k=5$: $$P(\text{at most 1 king among the first 5 cards})$$ $$=\frac{\sum_{x=0}^{1}C_{4}^{x}\cdot C_{48}^{5-x}}{C_{52}^{5}}\doteq0.9583156$$ R code:
> sum(dhyper(x = 0:1, m = 4, n = 48, k = 5))[1] 0.9583156
e) $$P(\text{10th is K})=\frac{4}{52}$$
f) $$P(\text{19th & 27th are both K})=\frac{4}{52}\times\frac{3}{51}\doteq0.004524887$$
g) $$P(\text{more than 10 cards for the 1st K to appear})=P(\text{no K among the first 10 cards})=\frac{C_{4}^{0}\cdot C_{48}^{10}}{C_{52}^{10}}\doteq0.4134454$$ This is hypergeometric distribution, R code:
> dhyper(x = 0, m = 4, n = 48, k = 10)[1] 0.4134454
h) There might be 0 or 1 king among the first 10 cards. Hypergeometric distribution $x=0:1, m=4, n=48, k=10$: $$P(\text{more than 10 cards for the 2nd K to appear})=P(\text{at most 1 K among the first 10 cards})$$ $$=\frac{\sum_{x=0}^{1}C_{4}^{x}\cdot C_{48}^{10-x}}{C_{52}^{10}}\doteq0.8374919$$ R code:
> sum(dhyper(x = 0:1, m = 4, n = 48, k = 10))[1] 0.8374919
i) $$P(\text{exactly 10 cards for the 2nd K to appear})$$ $$=P(\text{1 K among the first 9 cards & the 10th is K})$$ $$=\frac{C_{4}^{1}\cdot C_{48}^{8}}{C_{52}^{9}}\times\frac{3}{43}\doteq0.02862314$$ R code:
> dhyper(x = 1, m = 4, n = 48, k = 9) * 3/43[1] 0.02862314
THE MIDTERM
PROBLEM 1
According to genetic theory, every plant of a particular species has a 25% chance of being red-flowering, independently of all other plants. Among 10 plants of this species, what is the chance that fewer than 4 are red-flowering?
Solution:
Binomial distribution $n=10, k=0:3, p=0.25$: $$P(\text{fewer than 4 are red-flowering})=\sum_{k=0}^{3}C_{10}^{k}\cdot {0.25}^{k}\cdot{0.75}^{10-k}\doteq0.7758751$$ R code:
> sum(dbinom(x = 0:3, size = 10, prob = 0.25))[1] 0.7758751
PROBLEM 2
A population consists of 25 men and 25 women. A simple random sample (draws at random without replacement) of 4 people is chosen. Find the chance that in the sample:
2A all the people are of the same gender
2B there are more women than men
2C the fourth person is a woman
2D the third person is a woman, given that the first person and fourth person are both men
Solution:
2A $$P(\text{all people are same gender})=\frac{2\times C_{25}^{4}}{C_{50}^{4}}\doteq0.1098567$$
2B $$P(\text{more women than men})=P(\text{4 women 0 man})+P(\text{3 women 1 man})$$ $$=\frac{C_{25}^{4}\times C_{25}^{0}+C_{25}^{3}\times C_{25}^{1}}{C_{50}^{4}}\doteq0.3046027$$
2C $$P(\text{fourth person is woman})=\frac{25}{50}=0.5$$
2D $$P(\text{third person is woman | first and fourth are men})=\frac{25}{48}\doteq0.5208333$$
PROBLEM 3
An edX multiple choice question has 5 available options, only 1 of which is correct. Students are allowed 2 attempts at the answer. A student who does not know the answer decides to guess at random, as follows: On the first attempt, he guesses at random among the 5 options. If his guess is right, he stops. If his guess is wrong, then on the second attempt he guesses at random from among the 4 remaining options.
3A Find the chance that the student gets the right answer at his first attempt.
3B Find the chance that the student has to make two attempts and gets the right answer the second time.
3C Find the chance that the student gets the right answer.
Solution:
3A $$P(\text{gets the right answer at first attempt})=\frac{1}{5}=0.2$$
3B $$P(\text{gets the right answer the second time})$$ $$=P(\text{second time correct | first time incorrect})=\frac{4}{5}\times\frac{1}{4}=0.2$$
3C $$P(\text{gets the right answer})$$ $$=P(\text{right answer first time})+P(\text{right answer second time})=0.2+0.2=0.4$$
PROBLEM 4
On a true-false test, each question has exactly one correct answer: true, or false. A student knows the correct answer to 70% of the questions on the test, and gives the correct answer to each of those questions. Each of the remaining answers she guesses at random, independently of all other answers. After the test has been graded, one of the questions is picked at random. Given that she got the answer right, what is the chance that she knew the answer?
Solution:
According to Bayes Theorem, we have $$P(\text{knew the answer | correct})$$ $$=\frac{P(\text{knew the correct answer})}{P(\text{correct})}$$ $$=\frac{P(\text{knew the correct answer})}{P(\text{knew the correct answer})+P(\text{guessed correct answer})}$$ $$=\frac{0.7}{0.7+0.3\times0.5}\doteq0.8235294$$
PROBLEM 5
I roll a die repeatedly. Find the chance that the first 4 rolls all show different faces, and the 5th roll shows a face that has appeared before.
Solution: $$P(\text{first 4 rolls different & the 5th has appeared before})$$ $$=\frac{6}{6}\times\frac{5}{6}\times\frac{4}{6}\times\frac{3}{6}\times\frac{4}{6}\doteq0.1851852$$
PROBLEM 6
I throw darts repeatedly. Assume that on each single throw, my chance of hitting the bullseye is 10%, independently of all other throws. I decide to throw until I have hit the bullseye 3 times. What is the chance that I throw exactly 30 times?
Solution:
The first 29 throws follow the binomial distribution that $n=29, k=2, p=0.1$: $$P(\text{hit the bullseye 3 times among exact 30 throws})$$ $$=P(\text{hit 2 times among the first 29 throws and hit the bullseye on the 30th throw})$$ $$=C_{29}^{2}\times{0.1}^2\times{0.9}^{27}\times0.1\doteq0.02360879$$ R code:
> dbinom(x = 2, size = 29, prob = 0.1) * 0.1[1] 0.02360879
PROBLEM 7
A deck of cards consists of 8 blue cards and 5 white cards. A simple random sample (random draws without replacement) of 6 cards is selected. What is the chance that one of the colors appears twice as many times as the other?
Solution:
Follow the hypergeometric distribution that $x = 2,4, m=8, n=5, k=6$: $$P(\text{one colors appears twice as many times as the other})$$ $$=P(\text{4 blue cards & 2 white cards})+P(\text{2 blue cards & 4 white cards})$$ $$=\frac{C_{8}^{4}\times C_{5}^{2}+C_{8}^{2}\times C_{5}^{4}}{C_{13}^{6}}\doteq0.4895105$$ R code:
> sum(dhyper(x = c(2, 4), m = 8, n = 5, k = 6)) [1] 0.4895105
PROBLEM 8
A class has 3 Teaching Assistants (TAs). Each TA tosses a coin 10 times. Find the chance that at least one of the TAs gets exactly 5 heads.
Solution:
There are two processes of the binomial distribution. $$P(\text{at least one of the TAs gets exactly 5 heads among 10 tosses})$$ $$=1-P(\text{none of the TAs gets exactly 5 heads among 10 tosses})$$ $$=1-C_{3}^{0}\cdot p^0\cdot{(1-p)}^{3}\doteq0.5714988$$ where $p=C_{10}^{5}\times0.5^5\times0.5^5$. R code:
> p = dbinom(5, 10, 1/2)> 1 - dbinom(0, 3, p)[1] 0.5714988
加州大学伯克利分校Stat2.2x Probability 概率初步学习笔记: Midterm