Imagine two points in $ℝ^2$ at $(-1, 0)$ and $(1, 0)$. You would like to walk from one point to the next in the shortest distance possible. However, there is a line segment coming from the origin to a point $(0, S)$ and $(0,-S)$. In this instance, $S$ is a continuous uniform random variable picked between $0$ and $1$. You will not be able to how far the line goes up until coming into contact with it.
What follows is my work thus far on a solution. Let's say we walk the hypotenuse path to the center with a height $y$. Then, there are two scenarios when we get to the center: We have either walked under or over the center line.
In the case that we walked over the line, the optimal solution back from our point will simply be to walk in a straight line from $(0,y)$ to $(1, 0)$. Therefore, we will walk exactly $2\sqrt{1+y^2}$ meters.
In our second case, we have walked under the line. Now we will have to travel the remaining distance up the center line, and then walk on the hypotenuse from $(0,S)$ to $(1,0)$. Therefore, we will walk exactly $S-y+\sqrt{1+y^2}+\sqrt{1+S^2}$.
Since $S$ is a uniform continuous variable on the interval $[0, 1]$, we can write the probability that each of these events occur in terms of the value of $y$ that we choose.
- Specifically, $P(y>S)=y$ and $P(y<S)=1-y$.
Therefore, depending on our choice of $y$, the expected distance for us to travel can be modeled by:
$$y(S-y+\sqrt{1+y^2}+\sqrt{1+S^2})+(1-y)(2\sqrt{1+y^2})$$
And we need to minimize this function for $y\in 0\le y \le 1$. However, I have noticed that the second derivative of our expected distance is always negative for $y,S \in [0, 1]$. From this can I deduce that the best strategy will to always be to either go up to $(0, 1)$ or move in a horizontal line? This does not make sense to me.
Another possible error that I have found is that when I plug in a specific case for $S$, the expected distance walked does not make sense. For example, let's assume that $S=0$. In that case, the expected distance can be modeled by $$y(1-y+\sqrt{1+y^2})+(1-y)(2\sqrt{1+y^2})$$ For a chosen $y$ of $0$ meters, we get the expected value of $2$ expected meters. This makes sense. However, with a value of $y=1$, somehow the expected distance decreases to $\sqrt{2}$. This is obviously impossible.
I am sure that I have made a mistake somewhere in my logic. I am looking for any hints or different approaches to solve the problem. Thank you all for your time in reading this very long question!
If you were lucky enough to choose $y\geq S$, the distance will be $2\sqrt{1+y^2}$. Great. But if you weren't, the distance will be, as you said: $$d=\sqrt{1+y^2}+S-y+\sqrt{1+S^2}$$. Since this depends on $S$, the distance you will have to walk is itself another random variable. You didn't specify this in your statement of the problem, but I'll assume you want to minimize the expected distance. The expected distance is:
$$E\left[d\right]=P\left(\mathrm{y>S}\right)E\left[2\sqrt{1+y^2}\right] + P\left(\mathrm{y\leq S}\right)E\left[\sqrt{1+y^2}+S-y+\sqrt{1+S^2}\right]$$
This is:
$$E\left[d\right] = y\cdot 2\sqrt{1+y^2} + \left(1-y\right)\cdot\left[\sqrt{1+y^2}+0.5-y+E\left[\sqrt{1+S^2}\right]\right]$$
Now, the expected value of $\sqrt{1+S^2}$ is:
$$E\left[\sqrt{1+S^2}\right]=\int_0^1 \sqrt{1+s^2}\, ds$$
When you replace it in the equation, you will have a function depending only on $y$, which you can now try to minimize.
Using the value in the comments for this integral, I plotted the expected distance:
You can see that if you choose to be greedy, going "straight ahead" at first, that is, $y=0$, you will walk on average approximately $1$ (to reach the origin) $+0.5$ (going up) $+1.1$ (to reach the destination). On the other side, if you don't want to risk having to go straight up, choosing $y=1$, you will just walk $\sqrt 2+\sqrt 2$.