Linear Algebra
8.38 min read

Linear Functions

A homogeneous linear function on Rn\mathbb{R}^n has the form f(x)=cx=c1x1+c2x2++cnxnf(\mathbf{x}) = \mathbf{c}^\top \mathbf{x} = c_1 x_1 + c_2 x_2 + \cdots + c_n x_n for some fixed vector c\mathbf{c}. Every term involves exactly one variable to the first power (degree 1), and there is no constant offset. The function passes through the origin: f(0)=0f(\mathbf{0}) = 0.

An affine function adds a constant offset: f(x)=cx+df(\mathbf{x}) = \mathbf{c}^\top \mathbf{x} + d. Affine functions are sometimes loosely called "linear," but technically they are only truly linear (in the linear algebra sense) when d=0d = 0. The graph of an affine function on R2\mathbb{R}^2 is a tilted plane.

In matrix notation, the vector c\mathbf{c} is called the coefficient vector, and cx\mathbf{c}^\top \mathbf{x} is just a dot product. As we will see in Chapter 12, c\mathbf{c} will turn out to be the gradient of the linear function — the direction of steepest ascent.

Formal View

Definition 8.3 — Linear and Affine Functions
A function f:RnRf: \mathbb{R}^n \to \mathbb{R} is homogeneous linear if f(x)=cxf(\mathbf{x}) = \mathbf{c}^\top \mathbf{x} for some cRn\mathbf{c} \in \mathbb{R}^n. It is affine if f(x)=cx+df(\mathbf{x}) = \mathbf{c}^\top \mathbf{x} + d for some cRn\mathbf{c} \in \mathbb{R}^n and dRd \in \mathbb{R}. Both have polynomial degree 1 (assuming c0\mathbf{c} \neq \mathbf{0}).

Homogeneous linear functions satisfy f(αx)=αf(x)f(\alpha \mathbf{x}) = \alpha f(\mathbf{x}) and f(x+y)=f(x)+f(y)f(\mathbf{x} + \mathbf{y}) = f(\mathbf{x}) + f(\mathbf{y}). Affine functions satisfy neither unless d=0d = 0.

Interactive Visualization

Matrix-Vector Multiplication

Why This Matters

Linear functions are the foundation of calculus: every smooth function looks linear when you zoom in close enough (this is the local linear approximation idea).

  • Linear regression predictions: y^=wx\hat{y} = \mathbf{w}^\top \mathbf{x} is an affine function of the weight vector w\mathbf{w}.
  • Signal processing: inner products cx\mathbf{c}^\top \mathbf{x} compute projections and filter responses.
  • Economics: linear utility functions U(x1,,xn)=p1x1++pnxnU(x_1, \ldots, x_n) = p_1 x_1 + \cdots + p_n x_n measure total value at prices p\mathbf{p}.

Quiz

Question 1

Which of the following is a homogeneous linear function on R3\mathbb{R}^3?

Question 2

Every homogeneous linear function satisfies f(0)=0f(\mathbf{0}) = 0.

Common Mistakes

  • Calling f(x)=3x1+5f(\mathbf{x}) = 3x_1 + 5 a linear function in the algebraic sense — it is affine, not homogeneous linear, because of the +5+5.
  • Forgetting that the coefficient vector c\mathbf{c} is fixed, not a variable — cx\mathbf{c}^\top \mathbf{x} is linear in x\mathbf{x}, not in c\mathbf{c}.