Randomly Choosing a Number and Walking Along the Number Line

95 Views Asked by At

Let there be a bug that is on a number line. Let it originally start off at point 0. Each second, it chooses a number in the interval [−2,2] randomly and uniformly and moves from position $x$ to $x+p$. Find the expected time it will take for the bug to leave the interval (−2,2).

I tried a couple of methods none of which worked. The first was using the Irwin-Hall Distribution, I thought to just use the cumulative density function to show the probability that the bug was outside of the interval $[-2,2]$ after $n$ seconds. The problem here was that this solution allows for the bug to leave the interval at say $2$ seconds but then it can come back in at $3$ seconds and then leave again at $5$ seconds and in the solution, it would count as a possibility.

One thing that I tried was that for each $n$, where $n$ represents the # of seconds passed, you could use the Irwin-Hall Distribution for $k=1$ to $n-1$, finding the overall probability that the bug never left the interval $[-2,2]$ for all $n-1$ seconds and THEN you could use the probability density function to calculate the chance that it finally leaves the interval at $n$ seconds. The problem here was that the calculations get super messy and I don't see a clean way to do this.

The last possible solution idea that I have is setting up a function $E(x)$ which calculates the expected amount of time it will take the bug to leave the interval at position $x$. Then, we would have to calculate $E(0)$. The problem here is that I don't see a way to utilize this function well.

When I asked some other friends, they said that I have to use the function method to solve the problem (unfortunately they wouldn't explain to me HOW to use the function :( ).

Any hints or solutions for using this function method (or any method) would be GREATLY appreciated.

1

There are 1 best solutions below

1
On

If $x < -2$ or $x > 2$, then $E(x) = 0$. Otherwise, $$E(x) = 1+\frac{1}{4}\int_{-2}^2 E(x+p) dp \tag 1$$ By symmetry, $E(x) = E(-x)$, so assuming that $x > 0$, this simplifies to $$1+\frac{1}{2}\int_{0}^{2-x}E(p)dp + \frac{1}{4}\int_{2-x}^{2}E(p)dp \tag 2$$

Then, differentiate both sides to get $$E'(x) = -\frac{1}{4}E(2-x) \tag 3$$ Differentiate again to get $$E''(x) = -\frac{1}{16}E(x) \tag 4$$

The solution to this is $E(x) = c_1\cos\left(\frac{x}{4}\right) + c_2\sin\left(\frac{x}{4}\right)$, but since $(2)$ must be satisfied, this means that (skipping the tedious calculus steps) $$c_{1}\cos\left(\frac{x}{4}\right)+c_{2}\sin\left(\frac{x}{4}\right) = 1+c_{1}\sin\left(\frac{1}{2}\right)+\left(2-\cos\left(\frac{1}{2}\right)\right)c_{2}+\left(c_{1}\sin\left(\frac{1}{2}\right)-c_{2}\cos\left(\frac{1}{2}\right)\right)\cos\left(\frac{x}{4}\right)+\left(-c_{1}\cos\left(\frac{1}{2}\right)-c_{2}\sin\left(\frac{1}{2}\right)\right)\sin\left(\frac{x}{4}\right)$$

Skipping the messy algebra again, this means that $c_{1}=\frac{\cos\left(\frac{1}{2}\right)}{2-\cos\left(\frac{1}{2}\right)-2\sin\left(\frac{1}{2}\right)}, c_2 = -\frac{2-\cos\left(\frac{1}{2}\right)-2\sin\left(\frac{1}{2}\right)+\cos\left(\frac{1}{2}\right)\sin\left(\frac{1}{2}\right)}{\left(2-\cos\left(\frac{1}{2}\right)-2\sin\left(\frac{1}{2}\right)\right)\left(2-\cos\left(\frac{1}{2}\right)\right)}$. Plugging in $x = 0$ yields that $$E(0) = c_1 = \frac{\cos\left(\frac{1}{2}\right)}{2-\cos\left(\frac{1}{2}\right)-2\sin\left(\frac{1}{2}\right)} \approx 5.37$$ which matches up numerically with simulations.