Random walks

Richard (aka Bob) is walking on a number line. He begins at 0 0 , and the i t h {i}^{th} step's position, A i {A}_{i} , is A i 1 ± 1 {A}_{i-1}\pm1 . (Both cases equally probable)

If K K is the average value of A 100 2 {{A}_{100}}^{2} , input K \sqrt{K} .


The answer is 10.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Dylan Pentland
May 31, 2015

An easy mistake to make in this problem is to find the average value of A 100 {A}_{100} . This is 0, since for any case with a value of n n there's equally many cases with a value of n -n . This approach is not correct, because while it finds the average the n -n cases would actually count as a positive distance and they would not cancel.

Let's find the average value of the distance to 0 squared, A i 2 {{A}_{i}}^{2} . Suppose the amount we add for step n n is B n {B}_{n} , which becomes 0 0 if it's past i i . The overlines represent average values. A i 2 = ( B 1 + B 2 . . . + B i ) 2 \overline { {{ A }_{ i }}^{2} } = \overline{{\left({B}_{1}+{B}_{2}...+{B}_{i}\right)}^{2}} A i 2 = ( B 1 2 + B 2 2 . . . + B i 2 ) + m n B m B n \overline { {{ A }_{ i }}^{2} } = \left(\overline{{{B}_{1}}^{2}}+\overline{{{B}_{2}}^{2}}...+\overline{{{B}_{i}}^{2}}\right)+\sum _{m\neq n }^{ \quad }{ \overline{{ B }_{ m }B_{ n }} }

We know for each m , n m, n that B m B n = 0 \overline{{ B }_{ m }B_{ n }}=0 since it's equally probable for their product to be 1 -1 or 1 1 . We're left with

A i 2 = ( B 1 2 + B 2 2 . . . + B i 2 ) = i \overline { {{ A }_{ i }}^{2} } = \left(\overline{{{B}_{1}}^{2}}+\overline{{{B}_{2}}^{2}}...+\overline{{{B}_{i}}^{2}}\right) = i

From this A i \left|{A}_{i}\right| can be expected to be about i \sqrt{i} .

This also proves an interesting relation k = 0 n ( 2 n + 1 n + k ) ( 2 k + 1 ) 2 = 4 n ( 2 n + 1 ) \sum_{k=0}^n\dbinom{2n+1}{n+k}(2k+1)^2=4^n(2n+1)

Daniel Liu - 5 years, 11 months ago
Bill Bell
Jun 2, 2015

Cool! It's nice to see some confirmation that your ideas actually work :)

Dylan Pentland - 6 years ago

Log in to reply

Precisely why I do Monte Carlo!

Bill Bell - 6 years ago

I am a scoundrel and a cheater as well.

Python 3.3:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
from random import choice
from time import time
from math import sqrt
steps = 100
def random_walk():
    position = 0
    for step in range(steps):
        position += choice((1, -1))
    return position
total = 0
trials = 0
end = time() + 60
while time() < end:
    total += random_walk()**2
    trials += 1
k = total/trials
print("Answer is about:", sqrt(k))

Brock Brown - 5 years, 11 months ago

Log in to reply

I just input this formula for the Expected value of A_100^2 straight into Wolfram Alpha:

sum(2 (100 choose k) 1/(2^100)*(2(50-k))^2,k=0 to 50)

It yields 100.

Dylan, your method is excellent.

Alex Porush - 5 years, 8 months ago

Log in to reply

Very nice!

Bill Bell - 5 years, 8 months ago
Nicola Mignoni
Aug 27, 2018

Let's conisider the walk as a vector W = ( x 1 , x 2 , . . . , x 100 ) W=(x_1,x_2,...,x_{100}) , such that x i { 1 , 1 } x_i \in \{1,-1\} for 1 i 100 1 \leq i \leq 100 . The displacement after 100 100 steps is A 100 = k = 1 100 x i \displaystyle A_{100}=\bigg|\sum_{k=1}^{100} x_i\bigg| . Since 100 100 is even, the possible value of the final displacement are A i = 2 n A_i=2n , 0 n 50 0\leq n \leq 50 , n N n \in \mathbb{N} . Hence,

P ( A 100 = 0 ) = 2 1 2 100 ( 100 50 ) P ( A 100 = 2 ) = 2 1 2 100 ( 100 49 ) P ( A 100 = 2 n ) = 2 1 2 100 ( 100 50 n ) \displaystyle \mathbb{P}(A_{100}=0)=2 \cdot \frac{1}{2^{100}} \binom{100}{50} \\ \displaystyle \mathbb{P}(A_{100}=2)=2 \cdot \frac{1}{2^{100}} \binom{100}{49} \\ \hspace{60pt} \vdots \\ \displaystyle \mathbb{P}(A_{100}=2n)=2 \cdot \frac{1}{2^{100}} \binom{100}{50-n}

So, the expected value of the random variable A 100 2 A_{100}^2 is

E ( A 100 2 = 4 n 2 ) = 1 2 99 n = 0 50 4 n 2 ( 100 50 n ) = 100 = K 2 \displaystyle \mathbb{E}(A_{100}^2=4n^2)=\frac{1}{2^{99}} \sum_{n=0}^{50} 4n^2 \binom{100}{50-n}=100=K^2

Eventually

K = 10 \displaystyle \sqrt{K}=\boxed{10}

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...