latent state // log
Sep 11, 2026 // ML // 1 min

The Normal Equation: Linear Regression in One Line

Spike copy. A paragraph of prose before the lab, with an inline formula θ^=(XX)1Xy\hat\theta = (X^\top X)^{-1} X^\top y to confirm KaTeX and the lab coexist on one page.

Ten noisy points around a straight line, the least-squares fit, and the vertical residuals
fig 1 — noisy points, the true line (dashed), the normal-equation fit and its residuals; the live version needs JavaScript
Ten noisy points around a straight line, the least-squares fit, and the vertical residuals
fig 1 — noisy points, the true line (dashed), the normal-equation fit and its residuals; the live version needs JavaScript

A paragraph after the lab. Display math:

θ^=arg minθXθy2=(XX)1Xy.\hat\theta = \argmin_\theta \norm{X\theta - y}^2 = (X^\top X)^{-1} X^\top y .
theta = np.linalg.inv(X_b.T @ X_b) @ X_b.T @ y