Math foundations
Matrices and Linear Systems: Regression Is Ax = b
The idea
A matrix is a compact way to write many linear equations at once. Each row can be one data point constraint; each column is one unknown coefficient. Fitting a line through points is solving for intercept and slope that best satisfy all rows.
Linear systems answer: What values of x make Ax as close as possible to b across all rows?
Example: Ax = b in 2×2 form
Two equations, two unknowns. Regression normal equations use the same structure with more rows.
Two weeks, two levers: solve for intercept and ad slope from normal equations.
Matrix A
[4.0, 10.0]
[10.0, 30.0]
Vector b
[20.0]
[58.0]
intercept a
1.0
slope b
1.6
Solution: intercept a = 2.5, slope b = 1.0. Regression with two unknowns (intercept + slope) is the same pattern: matrix A from data sums, vector b from targets.
The math
System form
A holds coefficients, x holds unknowns, b holds targets or totals from data.
Regression notation
Design matrix X (rows = weeks, columns = intercept + drivers), coefficient vector β, outcome vector y. Same structure as Ax = b.
Least squares solution
When rows outnumber unknowns, you solve this system instead of exact equality. That is what your regression code implements under the hood.
A simple application
When someone asks what regression did, say it found β that solves a linear system built from your data table. The linear models post draws the line; this post names the matrix behind it.