## One bicycle for two

**R**obin showed me a mathematical puzzle today that reminded me of a story my grand-father used to tell. When he was young, he and his cousin were working in the same place and on Sundays they used to visit my great-grand-mother in another village. However, they only had one bicycle between them, so they would share the bicyle by alternating walking and cycling episodes, every 200 meters or so! Robin’s problem is to find the optimal portions of the distance spent by each of both cousins on the bicycle if one knows their respective walking and cycling speeds.

**I**f *d* is the distance to my great-grand-mother’s village, *m*_{a} and *v _{a}* are the walking and cycling speeds of André, my grand-father, and

*m*and

_{b}*v*the walking and cycling speeds of Bernard, his cousin, and if

_{b}*α*is the portion of the distance spent by André on the bicycle, his overall travel takes is

*αd/v*, while Bernard’s overall traveling time is

_{a}+(1-α)d/m_{a}*αd/m*. The optimal proportion

_{b}+(1-α)d/v_{b}*α*of the distance is then such that both durations equate, namely

which gives 1/2 when both cousins have the same speeds. (I first tried using the speeds rather than the times, but this involves an additional parameter, namely the portion of the time *γ* no-one is riding the bicycle…)

**A** more challenging problem is to sequentially optimise the proportion *α *without knowing of the speeds *m*_{a}, *v _{a, }*

*m*and

_{b}*v*of both cousins. However, since the above solution does not depend on the overall distance, we can think of a gradient algorithm that would produce fractions

_{b}*α*at each kilometer

_{i}*i*, fractions updated by something like

where the sequence of *δ _{i}*‘s slowly decreases to zero and where

*T*and

_{A}*T*are the times taken by André and Bernard to complete the current kilometer. (Granted, this assumes some unrealistic equipment for the 1920’s!) Here is an R code that replicates this scheme

_{B}#true but unknown values v=c(30,20) m=c(4,8) #gradient optimisation alpha=delta=.5 nonstop=1 while (nonstop){ ta=(alpha/v[1])+((1-alpha)/m[1]) tb=(alpha/m[2])+((1-alpha)/v[2]) alpha=alpha+delta*(ta-tb) if (abs(alpha-.5)>.5) alpha=runif(1) delta=delta*.99 nonstop=(abs(ta-tb)>.01*ta) print(alpha) }

March 28, 2011 at 12:21 am

[…] One bicycle for two […]

March 25, 2011 at 2:23 pm

In adventure racing, the so called Run and Bike race is based on that, with additional orienteering issues..