Over the past four posts, I developed a simulation of a bicycle sharing problem that appeared in Parade Magazine’s Ask Marilyn column a few years ago. For what I *hope* will be the final post in this series, I’m going to derive some analytical results.

First of all, the graphs of completion time vs. distance ahead showed that in both the simple case (*rA = rB *and *wA = wB*) and the general case with all velocities different, there was a distinct minimum completion time. In order to determine that time, begin by defining the following quantities:

= total distance A walks

= total distance A rides the bicycle

= total distance B walks

= total distance B rides the bicycle

and as before,

= A’s walking speed

= B’s walking speed

= A’s speed on the bicycle

= B’s speed on the bicycle

The minimum completion time is then given by:

Since and the walking distances can be eliminated:

The identity permits further simplification:

Gathering terms:

The pair within the brackets of Eq. (5.4) are both linear functions of , and with *rA > wA *and *rB > wB*, the slopes of the two lines have opposite parity. So if these two lines intersect on the interval , then the point of intersection defines . Setting the two expressions equal and solving for gives:

is the distance that A rides the bicycle. If Eq. (5.5) evaluates to a value less than zero (for example if *rB < wA*) then the optimal strategy is for A to walk () and B to ride the bicycle for the entire journey. The minimum time is the larger of *s/wA *and *s/rB*. If Eq. (5.5) evaluates to a quantity greater than *d*, then the optimal strategy is for A to ride the bicycle and B to walk the entire journey; the minimum completion time is the larger of *s/wB *and *s/rA*. Otherwise, is as given by (5.5), and substituting (5.5) into (5.4) gives:

Part 3 of this series presented a graph of completion time vs. distance ahead for the case of *wA* = 2.9333, *wB* = 4, *rA* = 8.8, *rB* = 12. Substituting into the expression above gives = 1015.4 sec. This is quite close to the figure of 1010 seconds that I estimated from the graph.

Unfortunately, this formula doesn’t tell us what values of *h* (and there are obviously many of them) result in the minimum time. However, as shown above, the minimum completion time occurs when A and B complete the journey at the same time. Take another look at the figure from part 4 of this series:

A and B coincide on the route at three different places as denoted on Figure 5.1:

- At about t=285 when A is walking, B is riding for the first time, and B passes A.
- At about t=660 when B is walking, A is riding for the second time, and A passes B.
- At about t=940 when A is walking, B is riding for the second time, and B passes A.

Clearly A and B can only coincide during Steps 1 and 3, when one of the friends is walking and the other friend is riding the bike.

Finding expressions for *h* in each case as a function of the other variables is a matter of algebra, and to avoid errors I used *Wolfram Mathematica*. Omitting the derivation, the longest distance h is given by:

With *s, rA, wA, rB *and *wB* as above, this gives *h* = 1883.087. The plot of position vs. time is as follows:

The next largest value that results in the minimum travel time is:

With *s, rA, wA, rB *and *wB* as above, this gives *h* = 796.685. The plot of position vs. time is as follows:

Both have a completion time of 1015.4 seconds, and in both cases A and B arrive at the end at the same time. I will leave the third distance as an exercise for interested readers.

That’s all for the bike sharing problem (unless I think of something else)!