Sharing a bicycle (part 2)

The last post described a problem in which two friends share a bicycle to go from one friend’s house to the other’s. In this post, I’ll describe my analysis of the problem. Then in the next post I’ll turn this analysis into R code and present some graphics to describe the results.

Recall that there are four basic steps to this problem:

  1. A rides the bike and B walks, until A is a distance h ahead of B, at which time A dismounts and leaves the bike on the sidewalk.
  2. A and B walk until B comes to the bike, at which time B picks it up.
  3. B rides the bike and A walks, until B is a distance h ahead of A, at which time B dismounts and leaves the bike on the sidewalk.
  4. A and B walk until A gets to the bike, at which time A picks it up.

Define the following quantities:

s:         Distance between the houses, i.e. the total distance to be covered.
h:         Distance ahead of the walker that the rider leaves the bike.
rA:       A’s speed on the bike.
rB:       B’s speed on the bike.
wA:      A’s walking speed.
wB:      B’s walking speed.
xA:       A’s distance from the start.
xB:       B’s distance from the start.
t:          Time.
Δt:        Time increment.

where s, h, rA, rB, wA and wB are constants. I will assume that both friends ride the bicycle faster than they walk, so rA > wA and rB > wB.

At the beginning of any step, A is at xA and B is at xB. At the end of the step, A is at xA + vA·Δt and B is at xB + vB·Δt, where A’s velocity vA is either wA or rA, and B’s velocity vB is either wB or rB, depending on what is happening in that particular step; Δt is calculated from the corresponding velocities and distances. It must then be determined whether A or B will reach the other house before the time increment Δt elapses.

This formula is then applied to each of the four steps in turn:

Step 1
When Step 1 is completed, A is h units ahead of B. Since A is riding the bike and B is walking, we have the equation xA + rA·Δt = xB + wB·Δt + h. Solving for Δt gives Δt = (xB – xA + h) / (rA – wB). Thus at the end of Step 1, A is at xA + rA·Δt, B is at xB + wB·Δt, and the time is incremented by Δt. A then puts down the bicycle.

Of course if rA wB then A will never catch up with B. The distance h essentially drops out of the problem, and the completion time is the time for A to ride the bike the entire distance s.

If xA + rA·Δt > s or xB + wB·Δt > s then one of the friends will reach the other house before the end of the time step. We must determine which friend arrives first; the total time for the journey is then the time at the beginning of Step 1 plus the time required for the other friend to reach the end of the journey.

Step 2
In Step 2, B walks the distance h and reaches the bike. This takes Δt = h/wB time units. At the end of Step 2, B is at xB + h, A is at xA + wA·Δt, and the time is incremented by Δt.

If xA + wA·Δt > s, then A reaches the other house on this step. The total time for the journey is then the current time plus the time required for B to get to the bike and ride it to the other house.

Step 3
Step 3 is identical to Step 1, except that B is riding the bike and A is walking. Reasoning as in Step 1, we find Δt = (xA – xB + h) / (rB – wA). So at the end of Step 3, A is at xA + wA·Δt. B is at xB + rB·Δt, and the time increments by Δt.

As in Step 1, if rB wA then B will never catch up to A, and the completion time is then the current time plus the time required for B to complete the journey on the bike.

If xA + wA·Δt > s or xB + rB·Δt > s, then one of the friends reaches the other house on this step. As in step 1, we determine which friend arrives first. The total time for the journey is then the time at the beginning of Step 3 plus the time required for the other friend to reach the other house. The time increments by Δt.

Step 4
Step 4 is identical to Step 2, except that A walks the distance h and reaches the bike. This takes Δth/wA time units. At the end of step 2, A is at xA + h, B is at xB + wB·Δt, and the time is incremented by Δt.

However, if xB + wB·Δt > s then B reaches the other house before A reaches the bike. So the total time to complete the journey is the time at the beginning of Step 4 plus the time required for A to get to the bike and ride it to the second house.

That’s it! In the next post, I will translate the above into R code.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s