If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

# Introduction to residuals

Build a basic understanding of what a residual is.
We run into a problem in stats when we're trying to fit a line to data points in a scatter plot. The problem is this: It's hard to say for sure which line fits the data best.
For example, imagine three scientists, start text, start color #ca337c, A, n, d, r, e, a, end color #ca337c, end text, start text, start color #01a995, J, e, r, e, m, y, end color #01a995, end text, and start text, start color #aa87ff, B, r, o, o, k, e, end color #aa87ff, end text, are working with the same data set. If each scientist draws a different line of fit, how do they decide which line is best?
A graph plots points on an x y plane. Points are rising diagonally in a weak scatter between (1 half, 1 half) and (10, 7). Three different colored lines are plotted. The red line passes through (1, 3) and (10 and 1 half, 5 and 1 half). The green line passes through (1, 2) and (10 , 6). The blue line passes through (0, 1 half) and (10 and 1 half, 7 and 1 half). All values are estimated.
If only we had some way to measure how well each line fit each data point...

## Residuals to the rescue!

A residual is a measure of how well a line fits an individual data point.
Consider this simple data set with a line of fit drawn through it
A graph plots points on an x y plane. Points are at (1, 2), (2, 8), (4, 3), (6, 7), and (8, 8). A line increases diagonally from the point (0, 3) through the point (10, 8). All values are estimated.
and notice how point left parenthesis, 2, comma, 8, right parenthesis is start color #1fab54, 4, end color #1fab54 units above the line:
A graph plots points on an x y plane. Points are at (1, 2), (2, 8), (4, 3), (6, 7), and (8, 8). A line increases diagonally from the point (0, 3) through the point (10, 8). An green arrow labeled 4 extends vertically from the line up to the point at (2, 8). All values are estimated.
This vertical distance is known as a residual. For data points above the line, the residual is positive, and for data points below the line, the residual is negative.
For example, the residual for the point left parenthesis, 4, comma, 3, right parenthesis is start color #e84d39, minus, 2, end color #e84d39:
A graph plots points on an x y plane. Points are at (1, 2), (2, 8), (4, 3), (6, 7), and (8, 8). A line increases diagonally from the point (0, 3) through the point (10, 8). An green arrow labeled 4 extends up vertically from the line up to the point at (2, 8). A red arrow labeled negative 2 extends down vertically from the line to the point at (4, 3). All values are estimated.
The closer a data point's residual is to 0, the better the fit. In this case, the line fits the point left parenthesis, 4, comma, 3, right parenthesis better than it fits the point left parenthesis, 2, comma, 8, right parenthesis.

## Try to find the remaining residuals yourself

What is the residual of the point left parenthesis, 6, comma, 7, right parenthesis in the graph above?

What is the residual of the point left parenthesis, 8, comma, 8, right parenthesis in the graph above?

What is the residual of the point left parenthesis, 1, comma, 2, right parenthesis in the graph above?