8
$\begingroup$

I walk $\pi$ km in one direction followed by $\pi$ km in another direction. In expectation how far am I now from my starting location? Both directions are chosen uniformly at random between $0^{\circ}$ and $360^{\circ}$.

P.S. The answer may surprise you.

$\endgroup$
2
  • $\begingroup$ On a Euclidean plane? Or on a sphere? Or on a torus? Or… $\endgroup$ Feb 4 at 7:55
  • $\begingroup$ On the plane ... $\endgroup$ Feb 4 at 10:56

3 Answers 3

14
$\begingroup$

Start at the origin $(0,0)$. If the two directions are $t$ and $u$, the ending location is $\pi(\cos t+\cos u, \sin t+\sin u)$ and the distance from the origin is $$\pi\sqrt{(\cos t+\cos u)^2+(\sin t+\sin u)^2} = \pi \sqrt{2+2\cos(t-u)}.$$ So the expected distance from the origin is $$\int_0^{2\pi} \int_0^{2\pi} \frac{\pi \sqrt{2+2\cos(t-u)}}{(2\pi)^2} \mathrm{d}t\, \mathrm{d}u = 4.$$

$\endgroup$
10
  • $\begingroup$ Yep you got it! $\endgroup$ Feb 2 at 15:49
  • 8
    $\begingroup$ Wow a solution without integer programming! ;) $\endgroup$ Feb 3 at 8:53
  • $\begingroup$ @DmitryKamenetsky I was not expecting integer programming, and in fact a double integration is very intuitive. $\endgroup$
    – iBug
    Feb 4 at 13:40
  • 1
    $\begingroup$ @Dragongeek Yes, $2\pi$ and $0$ are the extreme values of the distribution, and the expected value $4$ is between them. $\endgroup$
    – RobPratt
    Feb 4 at 20:03
  • 1
    $\begingroup$ @Dragongeek Makes sense intuitively. After the first walk, you're a distance pi from the origin. From there, over half of the angles will send you even further away, so on average, you wind up a bit further away than pi. $\endgroup$ Feb 5 at 17:31
5
$\begingroup$

If we consider the angle between the two walks to be $2\alpha$, in which $0\le\alpha<\pi/2$ (since the case for $\pi/2\le\alpha<\pi$ is equivalent), then the distance between the two points is $2\pi\sin\alpha$. Therefore, taking the integral of that in the range yields $\pi$. Finally, we divide by $\pi/2$, which is our range, to get the expected value of $2$.

$\endgroup$
4
  • $\begingroup$ I recall seeing this as a way to estimate $\pi$. Perhaps it is the needle-on-floor approximation? $\endgroup$
    – Sunny Lu
    Feb 2 at 15:47
  • $\begingroup$ This is the nicest and easiest way to do the integration, but there must be a factor 2 missing somewhere. I think your integral should yield $2\pi$ rather than $\pi$. $\endgroup$ Feb 2 at 15:52
  • $\begingroup$ I agree that 4 makes more sense $\endgroup$
    – Sunny Lu
    Feb 2 at 16:00
  • 2
    $\begingroup$ $[-2\pi \cos \alpha]_0^{\pi/2}=2\pi$ $\endgroup$ Feb 2 at 16:03
2
$\begingroup$

Let the smaller angle between the two walks be $\alpha$, where $0\le\alpha\le\pi.$ Using the law of cosines, the distance from where you started is $\sqrt{\pi^2+\pi^2-2\pi^2\cos\alpha}$. Taking the integral of this, we get $\frac{1}{\pi}\int^\pi_0 \sqrt{\pi^2+\pi^2-2\pi^2\cos\alpha}d\alpha=4.$ So the expected value of $\sqrt{\pi^2+\pi^2-2\pi^2\cos\alpha}$ is $4$

$\endgroup$
1
  • $\begingroup$ I got a hateful downvote, so I fixed my solution. $\endgroup$ Feb 4 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.