๐ Have you ever needed to estimate a value between two known points on a graph or dataset? Thatโs exactly what linear interpolation is for. Itโs a quick and reliable way to find missing values between two known data points by assuming a straight-line relationship between them.
In this article, youโll learn what linear interpolation is, how to calculate it, and when to use itโwith an easy-to-follow example.
Table of Contents
๐ What Is Linear Interpolation?
Linear interpolation is a method of estimating an unknown value that lies between two known values. It assumes the data points lie on a straight line and uses that line to fill in the gaps.
Itโs commonly used in:
- Physics and engineering
- Finance and economics
- Data science and statistics
- Everyday problem solving
๐งฎ The Formula
If you know two points:
- (x0, y0)
- (x1, y1)
You can estimate the value of y for any x between x0 and x1โ using the formula:
y = yโ + (x – xโ) * (yโ – yโ) / (xโ – xโ)
This calculates the slope of the line between the two points and applies it to estimate the new value.
Try the calculator below. Enter 5 values x0, y0, x1, y1, x to find y
โ When to Use It
Use linear interpolation when:
- You have two known data points
- You want to estimate a value between them
- You assume the data behaves linearly (like a straight line)
Linear interpolation is not ideal for data with curves or sudden changesโit’s best for predictable, gradual trends.
๐งโ๐ซ Example: Estimating Temperature
Letโs say youโre tracking temperature and have the following data:
- At 8 AM, the temperature was 15ยฐC โ (xโ = 8, yโ = 15)
- At 10 AM, the temperature was 25ยฐC โ (xโ = 10, yโ = 25)
Now, you want to estimate the temperature at 9 AM (x = 9).
Using the formula:
y = 15 + (9 – 8) * (25 – 15) / (10 – 8)
y = 15 + (1) * (10) / (2)
y = 15 + 5
y = 20
So, the estimated temperature at 9 AM is 20ยฐC.
๐ Why It Matters
Linear interpolation is:
- Simple to use
- Quick to calculate
- Widely used across industries
- Great for real-time data estimation
Itโs a basic but powerful tool for estimating unknown values using only two points.