# Consumer Price Index (CPI) and inflation rate formula

In economics, we often wish to know whether the cost of goods and services we purchase have increased or decreased over time.

The consumer price index measures the ratio of the total cost of a basket of goods today compared to a base period, holding prices constant.

The 'basket of goods' is just a collection of goods and services that consumers buy. We need to have a fixed basket of goods so that we are comparing the same goods and services across time periods.

## Consumer price index (CPI) formula

The formula for CPI is calculated:

$CPI =100* \frac{\text{basket of goods using prices from current year}}{\text{basket of goods using prices from base year}}$

### Calculating CPI with only one good

Consider an economy which only has one commodity being produced such that

 Year Quantity of good Price of good 2018 10 $5 2019 15$7

We firstly would define the basket of goods as 10 units of the good . The CPI in the year 2019 using 2018 as the base year is calculated:

$CPI_2019 = 100*\frac{7*10}{5*10} = 140$

To be able to calculate the inflation later in this post, we need the CPI for the year 2018 using 2018 as the base year. This is an easy calculating as the numerator and denominator is both the basket of goods from 2018 using 2018 prices. Therefore, the CPI will always be 100 for the base year.

### Calculating CPI for two goods

Suppose now that we have an economy with two goods with the following set of quantity (Qty) and prices:

 Year Qty of cheese Price of cheese Qty of wine Price of wine 2018 10 $5 5$10 2019 14 $6 7$12

Using the quantities from 2018 as our basket of goods, the cost of the basket of goods for the year 2018 is calculated:

Basket of goods using 2018 prices $= 10*5 + 5*10 = 100$

The cost of the basket of goods using the prices from 2019 is calculated:

Basket of goods using 2019 prices $= 10*6 + 5*12 = 120$

The CPI for the year 2019 is calculated as

$CPI = \frac{120}{100}*100 = 120$

## Inflation rate formula

The inflation rate measures the percentage change in the price level from one year to another. The inflate rate formula is defined:

$\pi = 100*\frac{P_1 - P_0}{P_0}$

where $\pi$ is the symbol for inflation, $P_0$ is the current year and $P_1$ is the next year. Usually, we use the consumer price index to calculate the inflation rate, thus:

$\pi = 100*\frac{CPI_1-CPI_0}{CPI_0}$

where $CPI_0$ is the consumer price index for the current year and $CPI_1$ is the consumer price index for the next year.

### Calculating inflation rate for one good

For the example above with only one good the CPI in the first year (2018) was 100 and the price in the second year was 140. Therefore, the inflation rate is:

$\pi = 100*\frac{140 - 100}{100}$

therefore the inflation rate is 40%.

### Calculating inflation rate for two goods

For the example above with only one good the CPI in the first year (2018) was 100 and the price in the second year (2019) was 140. Therefore, the inflation rate is:

$\pi = 100*\frac{120 - 100}{100}$

therefore the inflation rate is 20%.