# Find expected number of successful trail in $N$ times

I have $k_1$ red balls and $k_2$ blue balls in a box. Let $p_r$ be probability that randomly select $r$ balls in the box without replacement, $\sum_{r=1}^{m} p_r=1$. A trial is succeeds if the trial can draw at least one red ball in the trial. Find expected number of successful trail in $N$ times.

This is my solution

Let $X$ be event that draw $r$ ball in the box which has at least one red ball.

$$P(X)=p(r) \times\sum_{i=0}^{k_1}\frac{\binom{k_1}{i}\binom{k_2}{r-i}}{\binom{k_1+k_2}{n}}$$

Finally, we got the expected value as
$$E(X)= N \times \sum_{r=1}^{m} p(r) \sum_{i=0}^{k_1}\frac{\binom{k_1}{i}\binom{k_2}{r-i}}{\binom{k_1+k_2}{n}}$$

Is it right?

#### Solutions Collecting From Web of "Find expected number of successful trail in $N$ times"

Let $Y$ be the random variable counting how many successes you have in $N$ trials. If $X_i$ is the Bernoulli random variable giving $1$ if the $i$th draw is a successs and $0$ otherwise, then $Y = \sum\limits_{i=1}^N X_i$.

Thus, $Y$ is a sum of presumably-independent Bernoulli random variables, hence a binomial random variable with probability of success $p = \mathbb{P}(X_i = 1)$.
For example, the mass function is
$$\mathbb{P}(Y = s) = \mathbb{P}\left(\sum\limits_{i=1}^N X_i = s\right) = {{N}\choose{s}} \mathbb{P}(X_i = 1)^s\, \mathbb{P}(X_i = 0)^{N-s} = {{N} \choose{s}} p^s \,(1-p)^{N-s}$$
for $0 \leq s \leq N.$

At this point, you probably know that the expected value of a Binomial random variable with parameters $N$ and $p$ is $\mathbb{E}[Y] = Np$, or you can go through the calculation yourself easily since the expected value is linear to find
$$\mathbb{E}[Y] = \sum\limits_{i=1}^N \mathbb{E}[X_i] = \sum\limits_{i=1}^N \Big[ 0 \cdot \mathbb{P}(X_i = 0) + 1 \cdot \mathbb{P}(X_i =1) \Big] = N \, \mathbb{P}(X_i = 1)$$
So, what you have left is to find $p = \mathbb{P}(X_i = 1)$.

For this, it is helpful to consider the following:
$$\mathbb{P}(X_i = 1) = \sum\limits_{r = 0}^m \mathbb{P}(X_i = 1 \mid r \text{ draws})\,p_r$$
with
\begin{align*}
\mathbb{P}(X_i =1 \mid r \text{ draws}) =
\begin{cases}
1 & r > k_2 \\
1 – \frac{{k_2} \choose {r}}{{k_1 + k_2} \choose {r}} & r \leq k_2
\end{cases}
\end{align*}
where the last case with $r \leq k_2$ used: $\mathbb{P}(X_i = 1 \mid r) = 1 – \mathbb{P}(X_i = 0 \mid r)$. From here, you can put these pieces together.