# B Expectation of the number of successes in Bernoulli trial

#### Mentz114

Gold Member
I'm trying calculate the expected number of steps in one node in a random walk , $\langle s\rangle=\sum sp^s$. By deduction I have a possible solution (for rational probabilities $p=n/m,\ n< m$) in $\bar{s}=\langle s\rangle= nm/(m-n)^2$, which looks pretty weird but I have not found a counterexample.

I thought I might prove it by calculating $\Delta_k = \sum_k sp^s - \bar{s}$ and showing that this tends to 0 as $k\rightarrow \infty$. The general term is $\Delta_k = \frac{n^{k+1}\left((k+1)n-km\right)}{m^k(m-n)^2}$ and using $k\approx k+1$ this gives $\frac{n}{n-m}kp^k$.

I suspect this is not a proof and if not is there another way ?

Related Set Theory, Logic, Probability, Statistics News on Phys.org

#### haruspex

Science Advisor
Homework Helper
Gold Member
2018 Award
the expected number of steps in one node in a random walk
It's not clear to me what you mean by this.
Is it 1 dimensional?
Are you asking (on average) how many out of n steps land at a particular node (at a given offset from the start point)?

#### Mentz114

Gold Member
Yes, a 1 dimensional walk with a node that has probability $p$ of remaining there. Given that the walk is in that node it will remain there for n steps with probability $p^n$. So the expected length of the stay follows.

(@haruspex I used the reply button but there is no sign of your post)

#### Attachments

• 493 bytes Views: 32

#### haruspex

Science Advisor
Homework Helper
Gold Member
2018 Award
Yes, a 1 dimensional walk with a node that has probability $p$ of remaining there. Given that the walk is in that node it will remain there for n steps with probability $p^n$. So the expected length of the stay follows.

(@haruspex I used the reply button but there is no sign of your post)
If you include the initial arrival, I think you want $\Sigma _{s=0}(s+1)p^s$. Usual way to solve that is to integrate wrt p.
Another approach is to let the expected sojourn be x. Having arrived, we either leave immediately or we don't. If we don't we expect to stay another x: x=1+px.
But you seem to have got $x=\frac p{(1-p)^2}$

#### Mentz114

Gold Member
If you include the initial arrival, I think you want $\Sigma _{s=0}(s+1)p^s$. Usual way to solve that is to integrate wrt p.
Another approach is to let the expected sojourn be x. Having arrived, we either leave immediately or we don't. If we don't we expect to stay another x: x=1+px.
But you seem to have got $x=\frac p{(1-p)^2}$
Thanks. I don't understand your approach so I'll think about it.

#### Mentz114

Gold Member
If you include the initial arrival, I think you want $\Sigma _{s=0}(s+1)p^s$. Usual way to solve that is to integrate wrt p.
Another approach is to let the expected sojourn be x. Having arrived, we either leave immediately or we don't. If we don't we expect to stay another x: x=1+px.
But you seem to have got $x=\frac p{(1-p)^2}$
This was helpful and I now propose as the average length of the sojourn
\begin{align*}
\langle s\rangle = {\sum\limits_{s=0}^{\infty}sp^s}/{\sum\limits_{s=0}^{\infty}p^s}=\frac{p}{1-p}
\end{align*}
My attempted proof of convergence to this value is unchanged.

#### Ray Vickson

Science Advisor
Homework Helper
Dearly Missed
I'm trying calculate the expected number of steps in one node in a random walk , $\langle s\rangle=\sum sp^s$. By deduction I have a possible solution (for rational probabilities $p=n/m,\ n< m$) in $\bar{s}=\langle s\rangle= nm/(m-n)^2$, which looks pretty weird but I have not found a counterexample.

I thought I might prove it by calculating $\Delta_k = \sum_k sp^s - \bar{s}$ and showing that this tends to 0 as $k\rightarrow \infty$. The general term is $\Delta_k = \frac{n^{k+1}\left((k+1)n-km\right)}{m^k(m-n)^2}$ and using $k\approx k+1$ this gives $\frac{n}{n-m}kp^k$.

I suspect this is not a proof and if not is there another way ?
$$\sum_{s=0}^\infty s p^s = p \frac{d}{dp} \sum_{s=0}^\infty p^s = p \frac{d}{dp} \frac{1}{1-p}$$

#### Mentz114

Gold Member
$$\sum_{s=0}^\infty s p^s = p \frac{d}{dp} \sum_{s=0}^\infty p^s = p \frac{d}{dp} \frac{1}{1-p}$$
Many thanks. That gives $p/(1-p)^2$ and normalising with $\sum p^s = 1/(1-p)$ gives my conjectured sum. Accord ?

I found by brute force that $$\sum_{s=0}^\infty s^2 p^s/N =\frac{p\,\left( p+1\right) }{{\left( 1-p\right) }^{2}}$$ ($N$ is the normalisation constant as in post#6) but this is still guesswork.

Using $1/(1-x)=1+x+{x}^{2}+{x}^{3}+{x}^{4}+{x}^{5}+{x}^{6}+...$ it is clear that
$\sum s^2p^s = p\left[d_x (p d_x (1/1-p))\right]=\frac{p(p+1)}{{\left( p-1\right) }^{3}}$ and after normalisation we get my conjecture.

Applyng the operator $p\tfrac{d}{dp}$ n times to $1/(1-p)$ gives the n'th moment.

Thanks again for the pointer, Ray.

Last edited:

### Want to reply to this thread?

"Expectation of the number of successes in Bernoulli trial"

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving