Course contentsShow
← Machine Learning and Deep Learning
Lesson 188 of 3,5383. Linear RegressionFree lesson

The Simple Linear Model: y = mx + b

Breaking down the equation of a line with slope and intercept parameters for making predictions.

The Simple Linear Model: y = mx + b

What you'll learn: How the classic equation of a line serves as the foundation for making predictions in linear regression.

The Core Equation

You've likely seen y = mx + b in high school algebra, but in machine learning it becomes your prediction engine. Here's what each part means:

  • y: The output we're predicting (called the "target" or "dependent variable")
  • x: The input feature we're using to make predictions (the "independent variable")
  • m: The slope—how much y changes when x increases by 1 unit
  • b: The y-intercept—the baseline value of y when x equals zero

From Geometry to Predictions

Think of this equation as a recipe for predictions. If you want to predict house prices (y) based on square footage (x), the model learns:

  • m (slope): "Each additional square foot adds $150 to the price"
  • b (intercept): "A house with 0 square feet would theoretically cost $50,000" (baseline construction costs)

Given a new house with 1,500 square feet:

y = 150 × 1500 + 50000 = $275,000

Why This Matters in ML

Linear regression's job is to find the best values for m and b by learning from your training data. Once trained, the model uses this equation to predict y for any new x value. It's deterministic, interpretable, and surprisingly powerful for relationships that are approximately linear.

The beauty? Every prediction is just plugging a number into this simple formula.

Key Takeaway: The equation y = mx + b transforms input features (x) into predictions (y) using learned parameters—slope (m) captures the relationship strength, while intercept (b) sets the baseline.