# Math Help - Distance of random walk from the origin

1. ## Distance of random walk from the origin

Suppose you take two unit-length steps from the origin, and suppose that the respective angles A and B of each step with the x-axis are independent random variables uniformly distributed between 0 and 2pi. What's the expected distance you'll end up from the origin?

It's easy to see visually that the answer is independent of the direction of the first step; so if we assume our first step goes one unit in the y-direction (i.e., with A = pi/2), we can see that at the end of the second step that the distance from the origin is given by $\sqrt{(\cos B)^2 + (1 + \sin B)^2} = \sqrt{2}\sqrt{\sin B + 1}.$ So the expectation in question should be equal to $\frac{\sqrt{2}}{2\pi}\displaystyle\int_{0}^{2\pi}\ sqrt{\sin t + 1}\mathrm dt.$ To evaluate this integral directly, I had to use the online Wolfram Integrator and then use l'Hopital's rule multiple times on messy functions. The answer I ended up getting is 4/pi, which I'm reasonably confident is correct; but (assuming it is correct) is there a better way to go about finding the solution?

Also, and probably much harder, is there a way to calculate the expected distance from the origin after n steps? Or a way to find the probability distribution for the distance after n steps?

2. Originally Posted by rn443
Suppose you take two unit-length steps from the origin, and suppose that the respective angles A and B of each step with the x-axis are independent random variables uniformly distributed between 0 and 2pi. What's the expected distance you'll end up from the origin?

It's easy to see visually that the answer is independent of the direction of the first step; so if we assume our first step goes one unit in the y-direction (i.e., with A = pi/2), we can see that at the end of the second step that the distance from the origin is given by $\sqrt{(\cos B)^2 + (1 + \sin B)^2} = \sqrt{2}\sqrt{\sin B + 1}.$ So the expectation in question should be equal to $\frac{\sqrt{2}}{2\pi}\displaystyle\int_{0}^{2\pi}\ sqrt{\sin t + 1}\mathrm dt.$ To evaluate this integral directly, I had to use the online Wolfram Integrator and then use l'Hopital's rule multiple times on messy functions. The answer I ended up getting is 4/pi, which I'm reasonably confident is correct; but (assuming it is correct) is there a better way to go about finding the solution?

Also, and probably much harder, is there a way to calculate the expected distance from the origin after n steps? Or a way to find the probability distribution for the distance after n steps?
I know this does not answer your question, but it seems you get a much simpler problem if you ask for the root mean square distance from the origin after n steps (since there is a nice recursion for the mean square distance after n steps).

CB

3. O.K., I guess it seems you could calculate the cumulative distribution function of the distance by $F(b) = P(D \leq b) = P(\sqrt{2}\sqrt{\sin B + 1} \leq b) = P(B \leq \arcsin (b^2/2 - 1))$, and then express this as $\displaystyle\frac{1}{2\pi}\int_{0}^{\arcsin (b^2/2 - 1)} \mathrm dt = \frac{\arcsin (b^2/2 - 1)}{2\pi}$, then take the derivative with respect to b for the density of the distance D. Then you could calculate the expected value normally. However, I think I may be being sloppy with arcsin and could use some help setting all of this up.

EDIT: Ah, this seems to work! The integral I ended up evaluating was $\frac{1}{\pi}\displaystyle\int_{0}^{2}\frac{t}{\sq rt{1 - t^2/4}}\mathrm dt = -\frac{2\sqrt{4 - t^2}}{\pi}\Bigg|_{0}^{2} = \frac{4}{\pi}.$

4. Originally Posted by CaptainBlack
I know this does not answer your question, but it seems you get a much simpler problem if you ask for the root mean square distance from the origin after n steps (since there is a nice recursion for the mean square distance after n steps).

CB
Yeah, this problem was actually inspired by an example from Sheldon Ross' introductory probability book where he showed that the expected value of the distance squared after n steps is just n (IIRC).