# Interactive MTA/New York MetroCard Calculator to Avoid Overpaying

Below, I outline the methods used in the above chart for avoiding leftover amounts when purchasing rides on a MetroCard, as well as thresholds for purchasing unlimited rides for both 7-day and 30-day passes.

#### MTA MetroCard Information and Cost Optimization

The Metrocard bonus adds 5% to the total purchase price, which can be represented as follows:

$\large&space;T&space;=&space;P\cdot&space;1.05$

where T is the total added to the MetroCard, P is the amount paid, and the 1.05 is the total plus the added 5%.

Therefore, if we want to purchase 5 rides and avoid having leftover change on the MetroCard, we need to calculate the approximate amount (in multiples of $0.05 per MTA's requirement) to add to the card to get closest to the cost of 5 rides while also incorporating the extra 5%. This can be calculated in the following manner: where Π is the total added to the MetroCard, n is the total number of rides, C is the price per ride. If we input 5 as n and$2.75 for C, we can calculate the amount needed to minimize the leftover change:

$\large&space;\Pi&space;=&space;\frac{(5\cdot&space;\2.75)}{1.05}&space;=&space;\13.095&space;\approx&space;\13.10$

So we follow all of MTA's rules (multiples of $0.05, 5% bonus) and we end up with only$0.01 leftover. If you want to test this, you can go to MTA's website and see their bonus calculator here or check out another calcualtor here (by panix.com).

### NOTE:

Remember to always round -UP- when calculating the total for the desired number of rides, otherwise you will end up with a large amount left over just shy of another ride.

#### Interactive MTA/New York MetroCard Calculator Description

Using the method above and an algorithm that optimizes cost and unlimited ride options, I created the interactive chart at the top of this page that shows subway riders when to buy single purchase amounts, 7-day unlimited passes, and 30-day unlimited passes. For cases beyond 7 days in the city, I have also included an optimized mix of single pay options and 7-day options. For amounts greater than the 30-day unlimited cost, I have recommended the 30-day unlimited pass. In every case, the chart shows the rider which option is financially advantageous based on the days in the city and rides per day.

See More in Programming and Python:

Joshua HriskoComment