# Distance of random walk from the origin

• Aug 22nd 2009, 02:44 AM
rn443
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 $\displaystyle \sqrt{(\cos B)^2 + (1 + \sin B)^2} = \sqrt{2}\sqrt{\sin B + 1}.$ So the expectation in question should be equal to $\displaystyle \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?
• Aug 22nd 2009, 03:15 AM
CaptainBlack
Quote:

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 $\displaystyle \sqrt{(\cos B)^2 + (1 + \sin B)^2} = \sqrt{2}\sqrt{\sin B + 1}.$ So the expectation in question should be equal to $\displaystyle \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
• Aug 22nd 2009, 03:26 AM
rn443
O.K., I guess it seems you could calculate the cumulative distribution function of the distance by $\displaystyle 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 \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 $\displaystyle \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}.$
• Aug 22nd 2009, 03:32 AM
rn443
Quote:

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).