# Sampling - Balls in a Box

> ***GitHub***: https://github.com/czs108

## Background

> Consider a box containing **15** *red* balls, **10** *green* balls and **5** *blue* balls. Let **5** balls be drawn at random *without* replacement from the box.
>
> Please give the probabilities of the following events.

\begin{equation}
P(A \cup B) = P(A) + P(B) - P(A \cap B)
\end{equation}

\begin{equation}
\begin{split}
P(A \cap B) &= P(A) \cdot P(B \mid A) \\
    &= P(B) \cdot P(A \mid B)
\end{split}
\end{equation}

## Question A

### Question 1

> The *1st* ball is *red*.

\begin{equation}
P = \frac{15}{30}
\end{equation}

### Question 2

> The *1st* ball and *2nd* ball are *red*.

\begin{equation}
P = \frac{15}{30} \times \frac{14}{29}
\end{equation}

### Question 3

> The *2nd* ball is *red*.

There are **2** situations:

\begin{equation}
P(1st = red\, \cap\, 2nd = red) = \frac{15}{30} \times \frac{14}{29}
\end{equation}

\begin{equation}
P(1st \neq red\, \cap\, 2nd = red) = \frac{15}{30} \times \frac{15}{29}
\end{equation}

The total probability:

\begin{equation}
\begin{split}
P &= P(1st = red\, \cap\, 2nd = red) + P(1st \neq red\, \cap\, 2nd = red) \\
    &= \frac{1}{2}
\end{split}
\end{equation}

### Question 4

> The *2nd* ball is *red* given that the *1st* ball is *red*.

\begin{equation}
\begin{split}
P &= \frac{P(1st = red\, \cap\, 2nd = red)}{P(1st = red)} \\
    &= \frac{\frac{15}{30} \times \frac{14}{29}}{\frac{15}{30}} \\
    &= \frac{14}{29}
\end{split}
\end{equation}

### Question 5

> The *1st* ball is *red* given that the *2nd* ball is *red*.

\begin{equation}
\begin{split}
P &= \frac{P(1st = red\, \cap\, 2nd = red)}{P(2nd = red)} \\
    &= \frac{\frac{15}{30} \times \frac{14}{29}}{\frac{1}{2}} \\
    &= \frac{14}{29}
\end{split}
\end{equation}

### Question 6

> Either the *1st* ball or *2nd* ball or both are *red*.

\begin{equation}
\begin{split}
P &= P(1st = red) + P(2nd = red) - P(1st = red\, \cap\, 2nd = red) \\
    &= \frac{1}{2} + \frac{1}{2} - \frac{15}{30} \times \frac{14}{29}
\end{split}
\end{equation}

## Question B

> **5** balls are all the *same* color.

\begin{equation}
P = \frac{^{15}C_{5} +\, ^{10}C_{5} +\, ^{5}C_{5}}{^{30}C_{5}}
\end{equation}

## Question C

> Exactly **2** balls are *red*.

\begin{equation}
P = \frac{^{15}C_{2} \times\, ^{15}C_{3}}{^{30}C_{5}}
\end{equation}

## Question D

> The sequence is *red*, *green*, *blue*, *red*, *green*.

\begin{equation}
P = \frac{15 \times 10 \times 5 \times 14 \times 9}{^{30}P_{5}}
\end{equation}

## Question E

> Getting **2** *red* balls, **2** *green* balls and **1** *blue* ball in any order.

\begin{equation}
P = \frac{^{15}C_{2} \times\, ^{10}C_{2} \times\, ^{5}C_{1}}{^{30}C_{5}}
\end{equation}

322f8c31fb05bd7c223722d1ac1f198c26134e12
ipynb
Jupyter Notebook
exercises/Sampling - Balls in a Box.ipynb
czs108/Probability-Theory-Exercises
60c6546db1e7f075b311d1e59b0afc3a13d93229
MIT
exercises/Sampling - Balls in a Box.ipynb
czs108/Probability-Theory-Exercises
60c6546db1e7f075b311d1e59b0afc3a13d93229
MIT
exercises/Sampling - Balls in a Box.ipynb
czs108/Probability-Theory-Exercises
60c6546db1e7f075b311d1e59b0afc3a13d93229
MIT
2022-03-21T05:04:07.000Z
2022-03-21T05:04:07.000Z
Qwen/Qwen-72B
1. YES
2. YES