zoukankan      html  css  js  c++  java
  • 加州大学伯克利分校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( ext{first student is not in 10th grade})=frac{3}{5}$$

    b) $$P( ext{both are in 9th grade})=frac{2}{5} imesfrac{1}{4}=frac{1}{10}$$

    c) $$P( ext{second student is in 12th grade})=frac{4}{5} imesfrac{1}{4}=frac{1}{5}$$

    d) $$P( ext{second student is in 12th grade | first student is in 9th grade})$$ $$=frac{P( ext{first is in 9th grade & second is in 12th grade})}{P( ext{first student is in 9th grade})}=frac{frac{2}{5} imesfrac{1}{4}}{frac{2}{5}}=frac{1}{4}$$

    e) $$P( ext{at least one student is in 10th grade})$$ $$=1-P( ext{no student is in 10th grade})=1-frac{3}{5} imesfrac{2}{4}=frac{7}{10}$$

    f) $$P( ext{at least two grades apart})=P( ext{grade 9 & 12})+P( ext{grade 10 & 12})$$ $$=(frac{2}{5} imesfrac{1}{4}+frac{1}{5} imesfrac{2}{4})+(frac{2}{5} imesfrac{1}{4}+frac{1}{5} imesfrac{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( ext{at least one is the winner with replacement})$$ $$=1-P( ext{none of the two is the winner})=1-frac{99}{100} imesfrac{99}{100}=0.0199$$

    b) $$P( ext{at least one is the winner without replacement})$$ $$=1-P( ext{none of the two is the winner})=1-frac{99}{100} imesfrac{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( ext{junior})$

    b) $P( ext{senior})$

    c) $P( ext{math major | junior})$

    d) $P( ext{not a math major | junior})$

    e) $P( ext{math major | senior})$

    f) $P( ext{not a math major | senior})$

    g) $P( ext{junior math major})$

    h) $P( ext{senior math major})$

    i) $P( ext{math major})$

    j) $P( ext{junior | math major})$

    k) $P( ext{senior | math major})$

    l) $P( ext{junior | not a math major})$

    Solution:

    a) $$P( ext{junior})=0.7$$

    b) $$P( ext{senior})=1-0.7=0.3$$

    c) $$P( ext{math major | junior})=0.4$$

    d) $$P( ext{not a math major | junior})=1-0.4=0.6$$

    e) $$P( ext{math major | senior})=0.25$$

    f) $$P( ext{not a math major | senior})=1-0.25=0.75$$

    g) $$P( ext{junior math major})=0.7 imes0.4=0.28$$

    h) $$P( ext{senior math major})=0.3 imes0.25=0.075$$

    i) $$P( ext{math major})=P( ext{junior math major})+P( ext{senior math major})$$ $$=0.28+0.075=0.355$$

    j) $$P( ext{junior | math major})=frac{P( ext{junior math major})}{P( ext{math major})}=frac{0.28}{0.355}doteq0.7887324$$

    k) $$P( ext{senior | math major})=frac{P( ext{senior math major})}{P( ext{math major})}=frac{0.075}{0.355}doteq0.2112676$$

    l) $$P( ext{junior | not a math major})=frac{P( ext{junior not a math major})}{P( ext{not a math major})}$$ $$=frac{0.7 imes(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( ext{A or B})$ can be?

    c) What is the smallest that $P( ext{A or B})$ can be?

    Solution:

    a) Maybe, or maybe not; there is not enough information to decide.

    b) $$P( ext{A or B})=P(A)+P(B)-P(A cap B)le P(A)+P(B)=0.5$$

    c) $$P( ext{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( ext{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(Acap B)=0.2+0.3-P(Acap B)=0.4$$ $$Rightarrow P(Acap B)=0.1 eq 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( ext{each of the first three rolls is one spot})=(frac{1}{6})^3=frac{1}{216}$$

    b) $$P( ext{each of the first three rolls is the same spot})=6 imes(frac{1}{6})^3=frac{1}{36}$$

    c) Binomial distribution $n=5, k=0:1, p=frac{1}{6}$: $$P( ext{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( ext{six spots appears for the first time on the 5th roll})$$ $$=(frac{5}{6})^4 imes(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( ext{six spots appears for the second time on the 5th roll})$$ $$=C_{4}^{1} imesfrac{1}{6} imes(frac{5}{6})^3 imesfrac{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( ext{zero head})=frac{1}{4} imesfrac{1}{4}=frac{1}{16}$$ $$P( ext{1 head})=frac{1}{2} imesfrac{1}{2}=frac{1}{4}$$ $$P( ext{2 heads})=frac{1}{4} imes{1}{4}=frac{1}{16}$$ $$P( ext{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( ext{first 3 cards are different ranks})=frac{52}{52} imesfrac{48}{51} imesfrac{44}{50}doteq0.8282353$$

    b) $$P( ext{at least one king among the first 3 cards})$$ $$=1-P( ext{no king among the first 3 cards})=1-frac{48}{52} imesfrac{47}{51} imesfrac{46}{50}doteq0.2173756$$

    c) $$P( ext{either the 1st is king or the 2nd is queen but not both})$$ $$=P( ext{1st is K, 2nd is not Q})+P( ext{1st is not K, 2nd is Q})$$ $$=P( ext{1st is K, 2nd is not Q})+P( ext{1st is Q, 2nd is Q})+P( ext{1st is neither K nor Q, 2nd is Q})$$ $$=frac{4}{52} imesfrac{47}{51}+frac{4}{52} imesfrac{3}{51}+frac{44}{52} imesfrac{4}{51}doteq0.1417798$$ Alternatively $$P( ext{either the 1st is king or the 2nd is queen but not both})$$ $$=P({ ext{1st is K}}cup{ ext{2nd is Q}})-P({ ext{1st is K}}cap{ ext{2nd is Q}})$$ $$=P( ext{1st is K})+P( ext{2nd is Q})-2 imes P({ ext{1st is K}}cap{ ext{2nd is Q}})$$ $$=frac{4}{52}+frac{4}{52}-2 imesfrac{4}{52} imes{4}{51}doteq0.1417798$$ Note that $$P( ext{2nd is Q})=P( ext{1st is no Q, 2nd is Q})+P( ext{1st is Q, 2nd is Q})$$ $$=frac{4}{52} imesfrac{3}{51}+frac{48}{52} imesfrac{4}{51}=frac{4}{52}$$

    d) Hypergeometric distribution $x=0:1, m=4, n=48, k=5$: $$P( ext{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( ext{10th is K})=frac{4}{52}$$

    f) $$P( ext{19th & 27th are both K})=frac{4}{52} imesfrac{3}{51}doteq0.004524887$$

    g) $$P( ext{more than 10 cards for the 1st K to appear})=P( ext{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( ext{more than 10 cards for the 2nd K to appear})=P( ext{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( ext{exactly 10 cards for the 2nd K to appear})$$ $$=P( ext{1 K among the first 9 cards & the 10th is K})$$ $$=frac{C_{4}^{1}cdot C_{48}^{8}}{C_{52}^{9}} imesfrac{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( ext{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( ext{all people are same gender})=frac{2 imes C_{25}^{4}}{C_{50}^{4}}doteq0.1098567$$

    2B $$P( ext{more women than men})=P( ext{4 women 0 man})+P( ext{3 women 1 man})$$ $$=frac{C_{25}^{4} imes C_{25}^{0}+C_{25}^{3} imes C_{25}^{1}}{C_{50}^{4}}doteq0.3046027$$

    2C $$P( ext{fourth person is woman})=frac{25}{50}=0.5$$

    2D $$P( ext{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( ext{gets the right answer at first attempt})=frac{1}{5}=0.2$$

    3B $$P( ext{gets the right answer the second time})$$ $$=P( ext{second time correct | first time incorrect})=frac{4}{5} imesfrac{1}{4}=0.2$$

    3C $$P( ext{gets the right answer})$$ $$=P( ext{right answer first time})+P( ext{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( ext{knew the answer | correct})$$ $$=frac{P( ext{knew the correct answer})}{P( ext{correct})}$$ $$=frac{P( ext{knew the correct answer})}{P( ext{knew the correct answer})+P( ext{guessed correct answer})}$$ $$=frac{0.7}{0.7+0.3 imes0.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( ext{first 4 rolls different & the 5th has appeared before})$$ $$=frac{6}{6} imesfrac{5}{6} imesfrac{4}{6} imesfrac{3}{6} imesfrac{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( ext{hit the bullseye 3 times among exact 30 throws})$$ $$=P( ext{hit 2 times among the first 29 throws and hit the bullseye on the 30th throw})$$ $$=C_{29}^{2} imes{0.1}^2 imes{0.9}^{27} imes0.1doteq0.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( ext{one colors appears twice as many times as the other})$$ $$=P( ext{4 blue cards & 2 white cards})+P( ext{2 blue cards & 4 white cards})$$ $$=frac{C_{8}^{4} imes C_{5}^{2}+C_{8}^{2} imes 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( ext{at least one of the TAs gets exactly 5 heads among 10 tosses})$$ $$=1-P( ext{none of the TAs gets exactly 5 heads among 10 tosses})$$ $$=1-C_{3}^{0}cdot p^0cdot{(1-p)}^{3}doteq0.5714988$$ where $p=C_{10}^{5} imes0.5^5 imes0.5^5$. R code:

    > p = dbinom(5, 10, 1/2)
    > 1 - dbinom(0, 3, p)
    [1] 0.5714988


    作者:赵胤
    出处:http://www.cnblogs.com/zhaoyin/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    Oracle数据库的dual表的作用
    数据库中CASE函数和Oracle的DECODE函数的用法
    Oracle数据库中,通过function的方式建立自增字段
    Java学习(十三):抽象类和接口的区别,各自的优缺点
    Java学习(十八):二叉树的三种递归遍历
    Sublime工具插件安装
    sizeof和strlen
    I2C接口的EEPROM操作
    关于窗口看门狗
    关于指针传入函数
  • 原文地址:https://www.cnblogs.com/zhaoyin/p/4189482.html
Copyright © 2011-2022 走看看