Background image of landing

Unrivalled
Education
Solutions for your
Family

How do you calculate the slope of the line of best fit?

To calculate the slope of the line of best fit, commonly referred to as the regression line, you can use the following formula:

slope=Σ(xy)n(yˉ)(xˉ)Σ(x2)n(xˉ)2\text{slope} = \frac{\Sigma(xy) - n(\bar{y})(\bar{x})}{\Sigma(x^2) - n(\bar{x})^2}

The slope represents how much the variable yy changes for each unit change in the variable xx. To compute this slope, follow these steps:

  1. Gather Data Points: Collect your data points.
  2. Calculate Means: Compute the mean of the xx-values, denoted as xˉ\bar{x}, and the mean of the yy-values, denoted as yˉ\bar{y}.
  3. Compute the Products: For each data point, multiply the corresponding xx-value by the yy-value. Sum these products to find Σ(xy)\Sigma(xy).
  4. Square the xx-Values: Square each xx-value and sum these squares to obtain Σ(x2)\Sigma(x^2).

Next, determine the number of data points, denoted as nn. With all the required values at hand, you can substitute them into the slope formula:

slope=Σ(xy)n(yˉ)(xˉ)Σ(x2)n(xˉ)2\text{slope} = \frac{\Sigma(xy) - n(\bar{y})(\bar{x})}{\Sigma(x^2) - n(\bar{x})^2}

This formula effectively measures the covariance of xx and yy (indicating how they vary together) divided by the variance of xx (showing how much xx varies).

Example Calculation

Consider the data points (1,2)(1, 2), (2,3)(2, 3), and (3,5)(3, 5). We will compute the slope step by step:

  1. Calculate Means:

    • For xx: xˉ=1+2+33=2\bar{x} = \frac{1 + 2 + 3}{3} = 2
    • For yy: yˉ=2+3+53=3\bar{y} = \frac{2 + 3 + 5}{3} = 3
  2. Compute Σ(xy)\Sigma(xy):

    • Σ(xy)=(12)+(23)+(35)=2+6+15=23\Sigma(xy) = (1 \cdot 2) + (2 \cdot 3) + (3 \cdot 5) = 2 + 6 + 15 = 23
  3. Compute Σ(x2)\Sigma(x^2):

    • Σ(x2)=12+22+32=1+4+9=14\Sigma(x^2) = 1^2 + 2^2 + 3^2 = 1 + 4 + 9 = 14
  4. Count Data Points:

    • Here, n=3n = 3.

Now, substitute these values into the slope formula:

slope=2333214322=23181412=52=2.5\text{slope} = \frac{23 - 3 \cdot 3 \cdot 2}{14 - 3 \cdot 2^2} = \frac{23 - 18}{14 - 12} = \frac{5}{2} = 2.5

Thus, the slope of the line of best fit for the given data points is 2.52.5.

Answered by: Dr. Angela Davis
GCSE Maths Tutor
Medal Icon

100%

Globe Icon

Global

Crest Icon

97%

Professional Tutors

International Tuition

Independent School Entrance Success

All of our elite tutors are full-time professionals, with at least five years of tuition experience and over 5000 accrued teaching hours in their subject.

Based in Cambridge, with operations spanning the globe, we can provide our services to support your family anywhere.

Our families consistently gain offers from at least one of their target schools, including Eton, Harrow, Wellington and Wycombe Abbey.

Medal Icon

100%

Professional Tutors

All of our elite tutors are full-time professionals, with at least five years of tuition experience and over 5000 accrued teaching hours in their subject.

Globe Icon

Global

International Tuition

Based in Cambridge, with operations spanning the globe, we can provide our services to support your family anywhere.

Crest Icon

97%

Independent School Entrance Success

Our families consistently gain offers from at least one of their target schools, including Eton, Harrow, Wellington and Wycombe Abbey.

Book a free
30-minute consultation
session

At the Beyond Tutors we recognise that no two students are the same. 

That’s why we’ve transcended the traditional online tutoring model of cookie-cutter solutions to intricate educational problems. Instead, we devise a bespoke tutoring plan for each individual student, to support you on your path to academic success.

To help us understand your unique educational needs, we provide a free 30-minute consultation with one of our founding partners, so we can devise the tutoring plan that’s right for you.

To ensure we can best prepare for this consultation, we ask you to fill out the short form below.

Hire a Tutor

All the form fields are optional, but we ask you to provide as much information as possible so that we are in a better position to quickly meet your tutoring requirements.

Still have questions?
Let's get in touch