The Taxi Algorithm

Random filler photo: Teddy bear on a bench (outside apartment)

Many years ago, I was at a corporate work function in downtown Auckland for a soulless telephony giant who shall remain nameless.

Now in Auckland bars usually close at 2.30am, at which point it is taxi chaos.  So, the sober part of me remembered this, and at 2am, I decided to venture outside to call a cab.

After 1/2 hour my taxi finally arrived. As I was about to hop in, my colleagues stumbled outside, and excitedly offered to share the taxi with me. Very well I thought. We’ll go to my apartment first, a mere 2km away, and then they can continue on to their destination, and avoid the one hour wait for the next taxi.

I was mistaken.

Their destination was closer, by way of a detour to my own apartment.

Scenario: Taxi route to Michelle’s house, M, from downtown Auckland, via colleagues’ destination

Now at this point it is worth mentioning a taxi home for myself was usually between $15 – $20 NZD, depending on the phase of the traffic lights.

As we got to my colleague’s destination, they all stumbled out of the car, and one generously offered me $5 NZD towards my fare.

The taxi then continued on towards my apartment.

The final fare was around $45 NZD more than twice what I would normally pay.  (Meanwhile, my three colleagues paid the equivalent of $1,75 each.)

Since, then I’ve been rather self-conscious when sharing taxis. If I get out first I ensure I pay the full fare as is on the meter.

Yesterday was no exception. After a lovely evening, celebrating a friend’s 40th, and also

Random filler photo: Ugly kitten – as found in the gutter

engaging in a mental preparatory event for Brian, the clock struck 2am, and it was time to call it a day. We could already see the red hue in the sky from the sunrise (or maybe it was sunset. It’s so hard to know for sure).

There were seven of us, all with destinations in and around the CBD. We split into two groups and two taxies.

The first taxi arrived, and Brian, I, and our Russian friends jumped in. We asked the taxi to stop on the main road after the tunnel, let us out, and then continue on over the Puddefjord Bridge into town.

As we reached our destination we tumbled out of the taxi and handed our friends 200 NOK.  But, feeling tired and emotional, we had completely neglected to see what was the actual rate on the meter.

Consequently, this led to the inevitable taxi algorithm discussion.

Let’s consider the basic scenario, which had applied to us right now.

Scenario 1: The ideal taxi sharing scenario – your house, J, is exactly half way between where you are now, W, and your friend’s house, A.

We are at point W. We want to get to point J. Our friends want to get to Point A. J, is exactly half way between W and A.

We get out, we pay what is on the meter. The taxi continues on to A, and A pays the remaining fare, roughly about the same as it was to point J.

Even split. Fair enough.

But now let’s consider a slightly different scenario.

Imagine we are at point W, and share a taxi with some other friends who want to get to point M, just on the other side of Puddefjordbruen.

J pays 220 NOK. M pays 50 NOK.  Furthermore, maybe J is on their own, while M has two friends.

Scenario 2: Super cheap taxi for M and friends

Now, we have a classical psychological experiment.

Consider the scenario where a philanthropist offers a stranger (J) $20. The only catch is, another stranger, M (and possibly his three friends), get(s) $80. Most people in this situation decline the $20, rather than letting another person have a $60 advantage.

Psychologically, Scenario 2 above, is the same situation. J now requires a financial incentive to share a taxi with M. M ideally should contribute to some of J’s fare.

We now consider the first factor of the equation:

  • FR, the flat rate.

Most taxis have some flat rates.  Hiring a taxi usually incurs a flat fee of around 50NOK, in addition there is a 20 NOK charge for any tolls.

To  get to point J, we calculated: FR = approx 80 NOK.

So the easy solution is for J to pay a rate based on the Current Metered Rate (CMR):

  • FR = 80 NOK
  • RPJ (Ratio of People getting out at point J) = 0.5
  • CMR = 200 NOK
  • Amount to Pay1 = CMR – (FR * RPJ)  

That way J gets a cheaper taxi as does M.

But what if the flat rates are very low, and have a negligible financial impact on the overall fare?

M and his two friends still have a much cheaper ride home than J.

A fairer split would be for J to pay a fraction of the Total Metered Rate (TMR) to point M:

  • Amount to Pay2 = TMR * RPJ – (FR * RPJ)

However, what if you then have the inverse situation?

Scenario 3: J and F share a taxi, but J lives only 1/3 of the distance from W as F.

Now it gets more complicated. Using the above formula, what possible motivation does J have to share a taxi?  Furthermore, is there any motivation for F to share a taxi?  Maybe the taxi takes a detour to get to J, incurring a larger fare on F (as was the case in Scenario 1).

Scenario 4: J does not live on route to F, and to share a taxi with F requires taking a detour. J should only share a taxi with F if the scarcity factor is high.

Two new factors come into the equation, which also form the deciding factor of whether to share a taxi

  • SF: The scarcity factor (measured in hours) – how long the wait is for a separate taxi.  We can use this to decide whether it is worthwhile to share a taxi.
  • CF: What is the cost to both parties of sharing the taxi, compared to if they did not share a taxi.  0 = no cost. 0.5 = 50% more if sharing a taxi. 1 = 100% more.


  • if SF >1, and CF < 1: Share a taxi
  • if SF = 0 and CF < 0.5: Share a taxi
  •  if SF <= 0.5  and CF >= 0.5: Do not share a taxi

So now, the only complication then is that J has no idea of what the final fare will be.

This was also the case earlier this morning.

The only way to be sure, (and in our case ensure we didn’t short-change our friends), is to meet up over a cup of coffee the following day, fire up an excel spreadsheet, and calculate exactly how much was on the meter when they reached their destination (unknown), the flat rates to point J, and the ratio of people getting out of the taxi at that point.

There. Problem solved.

I can now go to sleep.


This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to The Taxi Algorithm

  1. david says:

    The main benefit of sharing a taxi is Simon is coherent so can tell the driver where we’re going, and he can wake me up when we get there.

  2. Anonymous says:

    that was just so confusing

Leave a Reply

Your email address will not be published.