To find the slope, calculate the deviation of each x from mean,
, and calculate the deviation of each y from its mean,
. The numerator is the product of the deviation of each x and y pair; the denominator is the sum of the squared deviations of all of the x-values. Thus, the formula is:

The y-intercept, a, is calculated by substituting
and
into the equation of a line and solving for a:

To draw this line on a graph, substitute two or three values for x, calculate the corresponding y values, plot these x-y pairs as points on the graph, and draw a line through these points.