Two Interesting, Short Probability Questions

2019-02-28
  1. If you have N coins, and x of them are special in the sense that they have head both front and back. And you pick one up randomly and flip it k times and get 10 heads, what is the probability that the coin you picked is one of the special ones?

    Solution: Say A is the event that you get 10 heads, B is the event you picked one of the special coins. Then, by Law of Total Probability, P(A)=P(A|B)P(B)+P(A|BC)P(BC)=1xN+(12)kNxN Now, from the Bayes Theorem, P(B|A)=P(A,B)P(A)=1N1xN+(12)kNxN=1x+N12k Say for N=100, x=10, and k=2, the probability will be about 2.9%.


  2. Say you have N ropes, or lines, or spaghetti. Each time you pick two ends and tie them up together. What is the expected number of loops?

    Solution: This one is for bored people. So for each round, after you picked up two ends and connect them, they either form a circle, or they do not. In either case the total number of ropes available decreases by 1. Say in a round we have i ropes left, then let Ri be a Bernoulli r.v. denoting if a loop is formed, by Law of Total Probability, E(Ri)=jP(picked up rope j)P(forming a loop)=j=12i12i12i1=12i1 Summing over all N rounds, and let R be the r.v. of total number of loops formed. E(R)=E(iRi)=iE(Ri)=i=1N12i1 Second step is true since expectation is a linear operator. So for N=100, this is about py> expected_n_of_loops = lambda N: sum(1.0/(2*i - 1) for i in range(1,N)) py> expected_n_of_loops(100) # 3.2793170636734916

    Note the generator expression, without of a list or a tuple, in the sum() function.

© The Responsible Adult 2017 - 2025