シェアする

  • このエントリーをはてなブックマークに追加

Expected value of the number of trials until it occurs with probability p

シェアする

  • このエントリーをはてなブックマークに追加

Hello, guys! It’s me! Warotan!
So…Who are you?→ABOUT ME

Japanese version.

This time let us calculate the expected value of the number of trials until it occors with probability \(p\)!
There are so many ways to do it, but here we use summation of inifinite series.
I write this article in case we need it but can’t remember and panic

I write similar articles and will add contents, so please read more other articles.

Summation of infinite geometric series

First, let us review the formula.

We set the geometric ratio \(r < 1\) for converge and consider the series

\(\begin{equation} S = \sum_{i = 1}^{\infty}r^i \end{equation}\)

The answer is

\(\begin{equation} S = \frac{r}{1-r} \end{equation}\)

Below are the specific calculation to find this, please skip it if you don’t need it.

Starting from the partial sum

\(\begin{equation} S_{n} = \sum_{i = 1}^{n}r^i \end{equation}\)

and multiple \(r\) on it,

\(\begin{eqnarray} S_{n} &=& r+r^2+r^3+\cdots + r^n \\ rS_{n} &=& \,\,\,\,\,\,\,\,\,\,\, r^2+r^3+\cdots + r^n+r^{n+1} \end{eqnarray}\)

Subtract the lower one from the upper one, we get

\(\begin{eqnarray} \left(1-r\right)S_{n} &=& r-r^{n+1} \\ &=& r\left(1-r^n\right) \\ S_{n} &=& \frac{r\left(1-r^n\right)}{1-r}. \end{eqnarray}\)

Letting \(n \to \infty\), we finally reach the answer as \(r < 1\).

Expected value of the number of trials with probability \(p\)

The main part.

We consider an event with probability \(p\) and calculate the expected value of the trials until it occurs.

Setting the value \(E\), the answer is

\(\begin{equation} E = \frac{1}{p}. \end{equation}\)

We will derive this below.
The number can be from 1 time to \(\infty\) times.
According to the definition of an expected value, we can write \(E\) as

\(\begin{eqnarray} E &=& 1\times p+2\times\left(1-p\right)p+3\times\left(1-p\right)^2 p+\cdots \\ &=& \sum_{k = 1}^{\infty}k\times\left(1-p\right)^{k-1}p \end{eqnarray}\)

and dividing this into the part \(k = 1\) and others,

\(\begin{eqnarray} E &=& p+\sum_{k = 2}^{\infty}k\left(1-p\right)^{k-1}p \end{eqnarray}\)

Rewriting the index of the second term from \(k \geq 2\) to \(k \geq 1\) and do some breaking up,

\(\begin{eqnarray} E &=& p+\sum_{k = 1}^{\infty}\left(k+1\right)\left(1-p\right)^{k} p \\ &=& p+\sum_{k = 1}^{\infty}k\left(1-p\right)^{k} p+\sum_{k = 1}^{\infty}\left(1-p\right)^{k} p \\ &=& p+\left(1-p\right)\sum_{k = 1}^{\infty}k\left(1-p\right)^{k-1} p+\sum_{k = 1}^{\infty}\left(1-p\right)^{k} p \end{eqnarray}\)

Here, the summation of the second term of the right hand side is exactly the same of the original form \(E\),

\(\begin{eqnarray} E &=& p+\left(1-p\right)E+\sum_{k = 1}^{\infty}\left(1-p\right)^{k} p, \end{eqnarray}\)

and the third one is just an infinite geometric series and easily calculated from the formula above,

\(\begin{eqnarray} \sum_{k = 1}^{\infty}\left(1-p\right)^{k} p &=& p\times\frac{1-p}{1-\left(1-p\right)} \\ &=& p\times\frac{1-p}{p} \\ &=& 1-p \end{eqnarray}\)

Finally we get

\(\begin{eqnarray} E &=& p+\left(1-p\right)E+\left(1-p\right) \\ &=& 1+\left(1-p\right)E, \end{eqnarray}\)

and

\(\begin{equation} E = \frac{1}{p} \end{equation}\)

However, it’s not so hard to see why.
I feel like an event with probability \(p = 1/n\) happen if we do it \(n\) times and \(p = 2/n\) needs \(n/2\) times.

Summary

Now, that’s all what I wanted to write.

This time, we calculated the expected value of the number of trials until it occurs with probability \(p\).

Thank you for reading and please spread this blog if you like.

If you have any comment, please let me know from the e-mail address below or the CONTACT on the menu bar.
tsunetthi(at)gmail.com
Please change (at) to @.

Or you can also contact me via twitter (@warotan3)

シェアする

  • このエントリーをはてなブックマークに追加

フォローする