LearnViz Math
Expert ▦ Linear Algebra Topic 59 of 104

Linear Regression via Matrices

Fit a line using normal equations.

Key idea

Fit a line using normal equations.

In depth

Regression fits a line (or plane) by least squares: build the design matrix X with a column of ones, then β̂ = (XᵀX)⁻¹Xᵀy. The residuals are perpendicular to the columns of X.

Worked example

For data (1, 2), (2, 3), (3, 5): slope = 1.5, intercept ≈ 0.33.

Real-world uses

Common mistake

Having correlated columns, making XᵀX nearly singular.

How to learn this

  1. Read the key idea and say it in your own words.
  2. Work through the worked example, then try a similar problem.
  3. Use the interactive lesson’s visual and mini-quiz to check the pattern.

Frequently asked questions

What is Linear Regression via Matrices?

Fit a line using normal equations. It is a topic at the expert level in Linear Algebra.

Where is Linear Regression via Matrices used in real life?

Real-world examples: Predicting sales or grades from several variables using matrix formulas in data science.

What should I learn before Linear Regression via Matrices?

Make sure you are comfortable with Least Squares, the previous topic in Linear Algebra.

What is a common mistake with Linear Regression via Matrices?

Having correlated columns, making XᵀX nearly singular.

How can I practise Linear Regression via Matrices?

Open the interactive lesson, play with the visual, then answer the three-question mini-quiz. Getting two right marks the topic complete.

What comes after Linear Regression via Matrices?

Move on to Orthogonal Projections next.

Related expert topics in Linear Algebra