Interview Q&A / Data Science

BeginnerQuick answer1 min readUpdated 3 Oct 2026

What do the slope and intercept mean in a simple linear regression?

SHORT ANSWER

The slope is the average change in y for a one-unit increase in x, and the intercept is the predicted y when x is zero. Least squares picks the line that minimises the sum of squared vertical errors.

Explain it simply

Regression draws the best straight line through a cloud of points: y = intercept + slope x x.

The intercept is where the line crosses the y-axis, the baseline when x is 0. The slope tells you how much y moves for each extra unit of x. The line is "best" in the least-squares sense: it makes the total of squared gaps between the points and the line as small as possible.

Example

Hours studied (x) and marks (y) for 5 students: x = 1, 2, 3, 4, 5 and y = 40, 50, 55, 65, 70.

  • Mean x = 3, mean y = 56
  • Slope = sum of (x - 3)(y - 56) / sum of (x - 3)^2 = 75 / 10 = 7.5
  • Intercept = 56 - 7.5 x 3 = 33.5

So marks = 33.5 + 7.5 x hours. Each extra hour is linked with about 7.5 more marks. A student who studies 6 hours is predicted to score 78.5.

python
import numpy as np
x = np.array([1, 2, 3, 4, 5])
y = np.array([40, 50, 55, 65, 70])
slope, intercept = np.polyfit(x, y, 1)
print(round(slope, 1), round(intercept, 1))  # 7.5 33.5

What to say in the interview

"The slope is the expected change in the target per unit change in the feature, holding other features constant in multiple regression. The intercept is the prediction when all features are zero, which may not be meaningful. I should not predict far outside the range of the data."

Common mistakes

  • Reading the slope as proof of cause.
  • Interpreting the intercept literally when x = 0 is outside the data.

#linear-regression#slope#regression

Related questions

Practise more Data Science questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Data Science quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.