First thing every morning I walk through the park to the local shop for a newspaper.
I can walk in a straight line for two miles to get to the shop, and after exactly one mile I cross a gated bridge over the canal that runs straight across the park, perpendicular to my walk.
Unfortunately I often reach the gate before the Park Keeper has unlocked it. If the gate is locked I can walk one mile along the towpath, cross another bridge that is always open, and then walk straight to the shop.
If I know the gate is locked I can walk straight to the open canal bridge, but I don't know if the gate is open until I reach it.
If I beat the Park Keeper to the gate one morning in two, what is my best route to minimise the distance that I walk?
And if I beat the Park Keeper to the gate two mornings in three, what is my best route to minimise the distance that I walk?
If the gate is open the distance to the shop is two miles.
If I walk straight to the open canal bridge I walk approximately 1.4 miles, from Pythagoras.
And the walk from the open canal bridge to the shop is also 1.4 miles.
So if the gate is locked I walk one mile to the gate, one mile to the open bridge and 1.4 miles to the shop. A distance of 3.4 miles.
Taking that route I will walk two miles one day and 3.4 miles the other day, and average of 2.7 miles.
If I walk straight to the open bridge every day I will walk 2.8 miles, so it is better to try the gate first if it is open one time in two.
But if it is open only one time in three, I will walk two miles on one day and 3.4 miles on two days, with an average of 2.9 miles. In this case it is better to go straight to the open bridge.