Scientists often apply trendlines, or best fit lines, to their data after they graph it on an x, y plot. The idea of a trendline is to reveal a linear relationship between two variables, x and y, in the y = mx + b form. Deriving the line equation that links two variables allows scientists to extrapolate, or predict, how one variable will change given any change in the other. Most of the time you cannot simply draw a line through real life data because rarely will it fit neatly. A statistical tool called regression analysis is required to calculate the best fit line accurately. Regression analysis of a large data set will easily fill both sides of a paper with numbers, so if you can find a program to do it for you, you'll save lots of time.

### Calculating the Slope (m) of the Trendline

Consider this data set of three (x,y) points: (1,3) (2, 5) (3,6.5). Let n = the number of data points, in this case 3.

Let a equal n times the summation of all x-values multiplied by their corresponding y-values, like so:

a = 3 x {(1 x 3) +( 2 x 5) + (3 x 6.5)} = 97.5

Let b equal the sum of all x-values times the sum of all y-values, like so:

b = (1 + 2 + 3) x (3 + 5 + 6.5) = 87

Let c equal n times the sum of all squared x-values, like so:

c = 3 x (1^2 + 2^2 + 3^2) = 42

Let d equal the squared sum of all x-values, like so:

d = (1 + 2 + 3)^2 = 36

Plug the values that you calculated for a, b, c, and d into the following equation to calculate the slope, m, of the regression line:

slope = m = (a - b) / (c - d) = (97.5 - 87) / (42 - 36) = 10.5 / 6 = 1.75

### Calculating the y-intercept (b) of the Trendline

Consider the same data set.

Let e equal the sum of all y-values, like so:

e = (3 + 5 + 6.5) = 14.5

Let f equal the slope times the sum of all x-values, like so:

f = 1.75 x (1 + 2 + 3) = 10.5

Plug the values you have calculated for e and f into the following equation for the y-intercept, b, of the trendline:

y-intercept = b = (e - f) / n = (14.5 - 10.5) / 3 = 1.3

Plug your values for m and b into a linear equation to reveal the final trendline equation:

Trendline equation: y = 1.75x + 1.3

#### Things You Will Need

- Calculator