Inferensys

Glossary

Normal Equation

The Normal Equation is the closed-form analytical solution to the linear least squares problem, obtained by setting the derivative of the cost function to zero and solving the resulting linear system for the optimal coefficient vector.
Developer building agentic RAG system, retrieval pipeline diagram on laptop, technical workspace with notes.
CLOSED-FORM LINEAR REGRESSION

What is the Normal Equation?

The Normal Equation provides a direct, analytical solution to the linear least squares problem, bypassing the need for iterative gradient descent.

The Normal Equation is the closed-form solution to the linear least squares problem, obtained by setting the derivative of the mean squared error cost function to zero and solving the resulting linear system. It directly computes the optimal coefficient vector θ that minimizes the sum of squared residuals via the formula θ = (XᵀX)⁻¹Xᵀy, where X is the design matrix and y is the target vector.

This analytical method guarantees finding the global minimum for linear models without requiring iterative tuning of a learning rate or convergence monitoring. However, computing the inverse of the Gram matrix XᵀX has a computational complexity of O(n³), making it impractical for high-dimensional feature spaces where iterative methods like Stochastic Gradient Descent are preferred.

NORMAL EQUATION

Frequently Asked Questions

Clear, direct answers to the most common questions about the Normal Equation and its application in solving linear least squares problems for coefficient estimation.

The Normal Equation is a closed-form analytical solution to the linear least squares problem that directly computes the optimal coefficient vector without iteration. It is derived by setting the gradient of the Mean Squared Error (MSE) cost function to zero and solving the resulting linear system. Mathematically, for a design matrix X and target vector y, the solution is θ = (XᵀX)⁻¹Xᵀy. The term "normal" refers to the geometric property that the residual error vector is orthogonal (normal) to the column space of X. This method provides the exact minimizer in a single computation, making it ideal for offline training and parameter extraction where the dataset is fixed and the number of features is manageable. However, the computational cost of inverting the XᵀX matrix scales as O(n³), where n is the number of parameters, limiting its practicality for high-dimensional or real-time adaptive systems.

CLOSED-FORM ESTIMATION

Key Properties of the Normal Equation

The Normal Equation provides a direct, non-iterative solution to the linear least squares problem. Understanding its core properties is essential for determining when to use this batch method versus adaptive alternatives like LMS or RLS.

01

Closed-Form Solution

The Normal Equation solves for optimal coefficients θ̂ in a single step using the formula θ̂ = (XᵀX)⁻¹ Xᵀ y. Unlike gradient descent methods, there is no iteration, no learning rate to tune, and no convergence monitoring required. The solution is deterministic: given the same design matrix X and target vector y, the result is always identical. This makes it ideal for offline coefficient extraction where computational determinism is critical.

1 Step
Computation
02

Computational Complexity

The computational cost is dominated by the matrix inversion of XᵀX, which is an (n × n) matrix where n is the number of model coefficients. Standard inversion requires O(n³) operations. For a memory polynomial predistorter with 50 coefficients, this is trivial. However, for models with thousands of parameters, the cubic scaling becomes prohibitive, making iterative methods like Stochastic Gradient Descent or Recursive Least Squares more practical.

O(n³)
Time Complexity
03

Numerical Stability Requirements

The Normal Equation explicitly computes (XᵀX)⁻¹, which squares the condition number of the original design matrix X. If X is nearly rank-deficient—common with highly correlated basis functions in Volterra series—the inversion becomes numerically unstable. In such cases, more robust factorization methods are preferred:

  • QR Decomposition: Solves Rx = Qᵀy without forming XᵀX
  • Singular Value Decomposition (SVD) : Handles rank deficiency by discarding near-zero singular values
04

Optimality Under Gauss-Markov Assumptions

When the noise in the observed data is zero-mean, uncorrelated (white), and has constant variance (homoscedastic), the Normal Equation yields the Best Linear Unbiased Estimator (BLUE) . This is the Gauss-Markov theorem. In power amplifier modeling, measurement noise from vector signal analyzers typically satisfies these conditions, making the Normal Equation the statistically optimal batch estimator for extracting Memory Polynomial coefficients.

05

No Hyperparameter Tuning

Unlike iterative algorithms, the Normal Equation has no step size (μ), no forgetting factor (λ), and no momentum parameter. This eliminates the need for hyperparameter sweeps and convergence analysis. The trade-off is the inability to track time-varying systems. For static PA behavioral models extracted in a controlled lab environment, this zero-tuning property significantly reduces engineering time compared to tuning an LMS or NLMS algorithm.

06

Regularization for Ill-Conditioned Problems

When XᵀX is ill-conditioned, a regularization parameter (δ) is added to the diagonal: θ̂ = (XᵀX + δI)⁻¹ Xᵀ y. This is known as ridge regression or Tikhonov regularization. The parameter δ introduces a small bias but dramatically reduces variance, preventing the coefficient vector from exploding due to near-singularity. This is essential when extracting high-order polynomial models where basis functions become highly correlated.

COEFFICIENT ESTIMATION COMPARISON

Normal Equation vs. Iterative Methods

A comparison of the closed-form Normal Equation solution against gradient-based and recursive iterative methods for linear least squares coefficient estimation in digital predistortion.

FeatureNormal EquationStochastic Gradient DescentRecursive Least Squares

Solution Type

Closed-form (batch)

Iterative (stochastic)

Iterative (recursive)

Computational Complexity

O(n³) for matrix inversion

O(n²) per iteration

O(n²) per iteration

Convergence Speed

One-step (instantaneous)

Slow, depends on step size

Fast, typically < 2n iterations

Online Adaptation

Numerical Stability

Poor for ill-conditioned matrices

Robust with proper step size

Excellent (QR-RLS variant)

Memory Requirements

High (stores full matrix)

Low (gradient vector only)

Moderate (correlation matrix)

Tracking Time-Varying Systems

Regularization Integration

Direct (add λI to XᵀX)

Implicit via early stopping

Explicit via forgetting factor

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.