ELEC 321
# Tutorial 2

Updated 2017-09-22

- Problem set A: 2, 5, 8, 9,10
- Lecture slide (module 2): page 53 to end
- Basic R Code: (3 Prisoner’s Problem)

A track star will run two races. The probability that he wins the ﬁrst race is 0.70, the probability that he wins the second race is 0.60 and the probability that he wins both races is 0.50. Find the probability that (a) he wins at least one race; (b) he wins exactly one race; (c) He wins neither race; (d) he wins the second race given he lost the ﬁrst.

Let

\(W_1\)be the event that he wins the first race

\(W_2\) be the event that he wins the second race

\[\mathbb P(W_1)=0.7\] \[\mathbb P(W_2)=0.6\] \[\mathbb P(W_1\cap W_2)=0.5\]We observe that the two events are not independent since \(\mathbb P(W_1 \cap W_2) \neq \mathbb P(W_1)\mathbb P(B)\)

The probability of event hat at least one race is won \(=\mathbb P(W_1\cup W_2)\)

\[\mathbb P(W_1\cup W_2)=0.7 + 0.6 - (0.5) = 0.8\]This is found using the inclusion-exclusion formula.

The event for winning exactly one race is \((W_1\cap W_2^c)\cup (W_1^c\cap W_2)\)

\[\mathbb P(W_1\cap W_2^c)=\mathbb P(W_1)-\mathbb P(W_1\cap W_2)\\ =0.7-0.5\\ =0.2\\ \mathbb P(W_1\cap W_2^c)=\mathbb P(W_2)-\mathbb P(W_1\cap W_c)\\ =0.6-0.5\\ =0.1\]Thus the chance of winning exactly one is \(=0.1+0.2=0.3\)

**Alternatively**, we could also use the result from part (a): \(=\mathbb P(W_1\cup W_2)-\mathbb P(W_1\cap W_2)\) which is \(0.8-0.5=0.3\)

The event \(E_3\) is for not winning any race is \(W_1^c\cap W_2^c=(W_1\cup W_2)^c\).

\[\mathbb P(E_3)=1-\mathbb P(W_1\cup W_2)\\ =1-0.8\\ =0.2\]Where \(\mathbb P(W_1\cup W_2)\) is calculated from part (a)

Let event \(E_4\) be when he wins the second race, given that he lost the first one.

\[\mathbb P(E_4)=\mathbb P(W_2\vert W_1^c)\\ =\frac{\mathbb P(W_2\cap W_1^c)}{\mathbb P(W_1^c)}\\ =\frac{0.1}{0.3}??\]A box contains ﬁve green balls, three black balls and seven red balls. Two balls are selected at random without replacement from the box. What is the probability that

(a) Both balls are red?

(b) Both balls are the same color?

(c) The second ball is green?

Let

- \[R_i = \{\text{event that i-thdrawn is a red ball}\}\]
- \[B_i = \{\text{event that ith drawn is a black ball}\}\]
- \[G_i = \{\text{event that i-th drawn is a green ball}\}\]

**Without replacement** means that when the ball is taken, it cannot be taken again. (The sample space decreases). So when the second ball is being picked, the number of balls left is 14 (instead of 15)

We want:

\[\mathbb P(R_1\cap R_2)+\mathbb P(B_1 \cap B_2) + \mathbb P(G_1 \cap G_2)\\ =\frac15 + \mathbb P(B_1)\mathbb P(B_2\vert B_1)+\mathbb P(G_1)\mathbb P(G_2\vert G_1)\\ =\frac15 + \frac{3}{15}\times\frac{2}{14}+\frac{5}{15}\times{4}{14}\\ =\frac15 + \frac1{35}+\frac{2}{21}\\ =\frac{34}{105}\]Using total theorem of probability, we want

\[\mathbb P(G_2)=\mathbb P(G_2\cap R_1)+\mathbb P(G_2\cap B_1)+\mathbb P(G_2\cap G_1)\\ =\mathbb P(R_1)\mathbb P(G_2\vert R_1)+\mathbb P(B_1)\mathbb P(G_1\vert B_1)+\frac2{21}\\\]The random variable X has probability mass function \(f(i) = α_i\), for \(i = 1,2,\dots,10\).

(a) Determine \(α\)

(b) Calculate \(E(X)\)

(c) Calculate \(\mathbb P(X ≤ 2\vert X ≤ 5)\)

We know that \(X\) is a random variable, and \(f(i)=\mathbb P(x=i)=\alpha_i\).

There are the probabilities:

- \[f(i)\geq 0\]
- \[\sum_i f(i)=1\]

and from the second property we can say:

\[\sum_{i=1}^{10}f(i)=55\alpha=1\\ \alpha=\frac1{55}\]For a discrete random variable \(X\) that has the following **Probability Mean Function** (PMF): \(\mathbb P(x=x_i)=f(x_i)\). Then \(E(X)\) is the expectation of \(X\). Where expectation of \(X\) is defined as \(\sum_i...\)

\[E(x)=\sum_ix_if(i)\\ =\sum_i x_i \mathbb P(x=x_i)\]

Example: on expectation of \(X\) (side note)\(X\) is a random variable that takes the value of \(x_1, x_2,\dotsc,x_n\) with equal probabilities (i.e. \(\frac 1 n\)).

So \(E(X)=\sum_{i=1}^nx_i \frac 1n\)

which \(=\frac 1 n \sum{x_i}\) (average)

and in this case, \(E(x)=\sum_{i=1}^{10}i(\alpha_i)\), so

\[E(x)=\frac1{55}\sum_{i=1}^{10}i^2\\ =\frac{1}{55}\times\frac{10\times11\times21}{6}\\ =7\]John has 10 keys in a chain, one of which opens his apartment door. After a big celebration, he returns home one evening and ﬁnds that he cannot identify the apartment key. He works out a clever plan: chooses a key at random and try it. If it fails, he puts it aside and try another randomly chosen key, and continues this way until he can open the door.

(a) What is the probability that the ﬁrst attempt works?

(b) What is the probability that the second attempt works?

(c) What is the probability that the \(i^\text{th}\) attempt works (for \(i=3,4,\dotsc,10\))

(d) What is the expected number of attempts until a key works?

Let \(K_i\) be the event for \(i^\text{th}\) attempt that works.

\[\mathbb P(K_i)=\frac 1 {10}\]This automatically implies that the first time did not work. so:

\[\mathbb P(K_2)=\mathbb P(K_2\cap K_1)+\mathbb P(K_2\cap K_1^c)\]But the first term \(=0\) because there is no two key that works at the same time.

\[\mathbb P(K_1)=\mathbb P(K_1^c)\mathbb P(K_2\vert \mathbb K_1^c)\\ =\frac{9}{10}\times\frac{1}{9} =\frac{1}{10}\]Using the pattern we observed from part (a), we can write the general expression:

\[\mathbb P(K_i)=\mathbb P(K_i\cap K_{i-1}^c\cap K_{i-2}^c\cap\dots\cap K_1^c)\]We may utilize **Chain Rule of Probability** on to this equation.

\[\mathbb P(\bigcap_{i=1}^n A_i)=\Pi_{i=1}^n \mathbb P(A_i\vert \bigcap_{j=1}^n A_j)\]

Chain Rule of Probability:

… we get:

\[\mathbb P(K_i)=\mathbb P(K_i\vert K_{i-1}^cK_{i-2}^c\dots K_1^c)\mathbb P(K_{i-1}^c\vert K_{i-2}^cK_{i-3}^c\dots K_1^c)\dots\mathbb P(K_2^c\vert K_1^c)\mathbb P(K_1^c)\\ =\frac1{10}\]We want expected number of attempted: \(E(X)=\sum_{i=1}^{10} i\mathbb P(K_i)\) where \(X\) is the number of attempts.

\[=\frac{1}{10}\sum_{i=1}^{10}i\\ =5.5 \text{ times}\]*Interpretation*: if John tries for a long time, he should be able to open the door after 5-6 attempts on average.

Peter is in the same situation. He comes up with a less clever plan: randomly chooses one key from the chain until the key works. He misses the clever step of setting aside failing keys!

(a) What is the probability that the ﬁrst attempt works?

(b) What is the probability that the attempt works?

(c) What is the probability that the \(i^\text{th}\) attempt works (for \(i=3,4,\dots\))?

(d) What is the expected number of attempts until the key works?