Skip to content

The matrix of a linear map

Turn differentiation of polynomials into a matrix, build any linear map’s matrix column by column, and see the same map get different matrices in different bases.

Helps to know firstChange of basis

Helps to know first
This topic

First, the picture

Can taking a derivative be a matrix? Watch a table of numbers turn a cubic curve into its slope curve.

Differentiation is a matrix

The coefficients of a cubic, times one fixed matrix, give the coefficients of its derivative.

p(x) = 2 − 3x + x^2 + 4x^3, written as its coefficients (2, −3, 1, 4).

p
(2, −3, 1, 4)
Dp = p'
–
2
-3
1
4
0.00 / 10.40 s
Describe this picture

Two panels (stacked on a phone). On the left, a 4×44\times4 grid of cells, the matrix D=[0100002000030000]\mathbf{D}=\begin{bmatrix}0&1&0&0\\0&0&2&0\\0&0&0&3\\0&0&0&0\end{bmatrix}, times the column of coefficients (2,−3,1,4)(2,-3,1,4) of the cubic p(x)=2−3x+x2+4x3p(x)=2-3x+x^2+4x^3. Row by row, the row of D\mathbf{D} in use lights up and the output column fills: (−3,2,12,0)(-3,2,12,0). On the right, the curve p(x)p(x) from −1.2-1.2 to 1.21.2, and then the curve p′(x)=−3+2x+12x2p'(x)=-3+2x+12x^2 that those numbers describe. At five points, x=−1,−0.5,0,0.5,1x=-1,-0.5,0,0.5,1, a short line shows the slope of pp and a dot on the second curve shows the same value. The clip runs for about 10 s. One control after the clip: four sliders, one per coefficient, from −5-5 to 5; the product and both curves redraw.

Linear maps beyond arrows

On A gallery of linear maps a map was linear when it kept adding and scaling. Nothing in that test needs arrows. Take “differentiate”: the derivative of a sum is the sum of the derivatives, and the derivative of cc times a function is cc times its derivative. So differentiation is a linear map on functions. I’ll write a map with braces, T{f}T\{f\}, as the gallery page does and as signal processing writes a system. The test is

T{c f+d g}=c T{f}+d T{g}.T\{c\,f+d\,g\}=c\,T\{f\}+d\,T\{g\}.

Other linear maps: integrating, turning, projecting, delaying a signal by one sample. Not linear: adding 1, since T{0}T\{0\} would be 1, not 0.

Columns are images

Polynomials of degree at most 3 are a vector space with the basis 1, x, x2, x31,\ x,\ x^2,\ x^3, as on Vector spaces and subspaces. Each polynomial’s coordinates in that basis are its four coefficients, constant first: 2−3x+x2+4x32-3x+x^2+4x^3 has the coordinates (2,−3,1,4)(2,-3,1,4). To find the matrix of differentiation, do what A matrix moves the plane did with the unit arrows: see where each basis vector goes, and write its coordinates as a column.

  • 1↦01\mapsto0: column (0,0,0,0)(0,0,0,0).
  • x↦1x\mapsto1: column (1,0,0,0)(1,0,0,0).
  • x2↦2xx^2\mapsto2x: column (0,2,0,0)(0,2,0,0).
  • x3↦3x2x^3\mapsto3x^2: column (0,0,3,0)(0,0,3,0).
D=[0100002000030000].\mathbf{D}=\begin{bmatrix}0&1&0&0\\0&0&2&0\\0&0&0&3\\0&0&0&0\end{bmatrix}.

For p(x)=2−3x+x2+4x3p(x)=2-3x+x^2+4x^3: D(2,−3,1,4)=(−3,  2,  12,  0)\mathbf{D}(2,-3,1,4)=(-3,\;2,\;12,\;0), which is p′(x)=−3+2x+12x2p'(x)=-3+2x+12x^2. The table of numbers does calculus.

Drag the coefficients in the picture and watch the output. Its last entry is always 0, since differentiating lowers the degree, and the constant term never reaches the output at all.

Kernel and range

The null space of a map is also called its kernel, and its column space its range. For D\mathbf{D}:

  • the kernel is the constants, N(D)=span{(1,0,0,0)}N(\mathbf{D})=\mathrm{span}\{(1,0,0,0)\}, since only constants have derivative 0: dimension 1;
  • the range is the polynomials of degree at most 2: dimension 3, the rank.

And 3+1=43+1=4, the number of inputs, as on The four fundamental subspaces: rank plus the dimension of the kernel equals the number of columns.

Composing maps multiplies matrices. Differentiating twice is D2\mathbf{D}^2:

D2=[0020000600000000],\mathbf{D}^2=\begin{bmatrix}0&0&2&0\\0&0&0&6\\0&0&0&0\\0&0&0&0\end{bmatrix},

and D2(2,−3,1,4)=(2,24,0,0)\mathbf{D}^2(2,-3,1,4)=(2,24,0,0), which is p′′(x)=2+24xp''(x)=2+24x. Four derivatives kill every cubic: D4\mathbf{D}^4 is the zero matrix.

Undoing, up to a constant. Integration from degree 2 to degree 3, starting at 0, sends 1↦x1\mapsto x, x↦x2/2x\mapsto x^2/2, x2↦x3/3x^2\mapsto x^3/3. Its matrix is 4×34\times3:

Aint=[00010001200013].\mathbf{A}_\text{int}=\begin{bmatrix}0&0&0\\1&0&0\\0&\tfrac12&0\\0&0&\tfrac13\end{bmatrix}.

Integrate then differentiate and you are back where you started: DAint\mathbf{D}\mathbf{A}_\text{int}, restricted to degree 2, is the 3×33\times3 identity. The other order loses the constant: you get p(x)−p(0)p(x)-p(0).

One map, many matrices

A map’s matrix depends on the basis. Use the basis 1, x, x2/2, x3/61,\ x,\ x^2/2,\ x^3/6 instead, with V=diag(1,1,12,16)\mathbf{V}=\mathrm{diag}(1,1,\tfrac12,\tfrac16). By Change of basis, the same map becomes

V−1DV=[0100001000010000]:\mathbf{V}^{-1}\mathbf{D}\mathbf{V}=\begin{bmatrix}0&1&0&0\\0&0&1&0\\0&0&0&1\\0&0&0&0\end{bmatrix}:

every entry above the diagonal is 1. Each basis polynomial is sent to the one before it, and the matrix is the Jordan block for the eigenvalue 0, from Similar matrices and the Jordan form. In this basis pp has coordinates (2,−3,2,24)(2,-3,2,24), and the output (−3,2,24,0)(-3,2,24,0) means −3+2x+24⋅x22-3+2x+24\cdot\tfrac{x^2}2: the same p′(x)p'(x).

The picture below makes the same point with arrows.

One map, two matrices

Projection onto the line y = x, written on two grids.

Three arrows, twice: on the usual grid (left) and on the grid of (1, 1) and (1, −1) (right).

0.00 / 7.20 s
Describe this picture

Two panels with the same three arrows, (2,0)(2,0), (1,2)(1,2) and (−1,2)(-1,2), and the line y=xy=x (stacked on a phone). On the left they sit on the usual grid, with the matrix [0.50.50.50.5]\begin{bmatrix}0.5&0.5\\0.5&0.5\end{bmatrix} in the corner. On the right they sit on the grid of (1,1)(1,1) and (1,−1)(1,-1), with axes marked c1c_1 and c2c_2, and the matrix [1000]\begin{bmatrix}1&0\\0&0\end{bmatrix}. Over 3 s the arrows are projected onto the line, the same in both panels, to (1,1)(1,1), (1.5,1.5)(1.5,1.5) and (0.5,0.5)(0.5,0.5); dashed drops from the old tips then meet the line at a right angle. The clip runs for about 7 s. There is no control.

The projection is one map. On the usual grid its table is full of halves; on a grid along and across the line it is diag(1,0)\mathrm{diag}(1,0), keep one coordinate, drop the other. A matrix is a map written in one basis, not the map itself.

In signal processing · realisations of a filter

Filter structures, in the signal processing course, builds one filter in many ways. Each is a state-space matrix in a different basis for the stored values, so all of them have the same transfer function: one map, many matrices. Signal samples count from n=0n=0, while vector entries count from 1.

Worked example

1. Differentiate. D(2,−3,1,4)=(−3,  2⋅1,  3⋅4,  0)=(−3,2,12,0)\mathbf{D}(2,-3,1,4)=(-3,\;2\cdot1,\;3\cdot4,\;0)=(-3,2,12,0).

2. Twice. D2(2,−3,1,4)=(2,24,0,0)\mathbf{D}^2(2,-3,1,4)=(2,24,0,0), and D2\mathbf{D}^2 applied to x3x^3, coordinates (0,0,0,1)(0,0,0,1), gives (0,6,0,0)(0,6,0,0), that is 6x6x.

3. Kernel and range. Kernel: constants, dimension 1. Range: degree at most 2, dimension 3. Total 4.

4. A scaled basis. V−1DV\mathbf{V}^{-1}\mathbf{D}\mathbf{V} has ones above the diagonal: entry (1,2)(1,2) is 1, entry (2,3)(2,3) is 2⋅12=12\cdot\tfrac12=1, entry (3,4)(3,4) is 3⋅16⋅2=13\cdot\tfrac16\cdot2=1.

5. A projection in two bases. [0.50.50.50.5]\begin{bmatrix}0.5&0.5\\0.5&0.5\end{bmatrix} in the usual basis, diag(1,0)\mathrm{diag}(1,0) in the basis (1,1)(1,1), (1,−1)(1,-1). This is the projection matrix of Projections.

Try these before you read the answers.

  • Is f↦f+1f\mapsto f+1 linear? No: it sends 0 to 1.
  • The matrix of “double every polynomial”, in any basis? 2I2\mathbf{I}.
  • Which matrix undoes D\mathbf{D} on polynomials of degree at most 2, up to a constant? The integration matrix.

Where you’ll meet this

Numerical solvers. Programs that solve differential equations with polynomials or smooth series store differentiation as a matrix, then solve the equation as a linear system.

Filters. A filter acting on a block of samples is a matrix, as on A matrix moves the plane, and its different structures are that map in different bases.

Reference card

QuantityFormulaNotes
Linear mapT{c f+d g}=c T{f}+d T{g}T\{c\,f+d\,g\}=c\,T\{f\}+d\,T\{g\}functions, signals, arrows alike
Its matrixcolumn qq = coordinates of T{vq}T\{\mathbf{v}_q\}depends on the basis
DifferentiationD\mathbf{D}, entries 1,2,31,2,3 above the diagonalon the basis 1,x,x2,x31,x,x^2,x^3
CompositionT2{T1{f}}T_2\{T_1\{f\}\} has matrix A2A1\mathbf{A}_2\mathbf{A}_1D2\mathbf{D}^2 differentiates twice
Kernel and rangeN(A)N(\mathbf{A}) and C(A)C(\mathbf{A})rank ++ kernel dimension == number of inputs
New basisB=V−1AV\mathbf{B}=\mathbf{V}^{-1}\mathbf{A}\mathbf{V}the same map, another table

Keep reading with a free account.

By creating an account you accept the terms of use.

Sign in

Already have an account? Use the service you signed up with.

Or keep reading: get new lessons by email

Are you 13 or over?

Accounts and email updates are for people aged 13 or over. We keep only your answer, never your date of birth.

End of the lesson

Where to go next.

Phasorium

Account

Sign inKeep your place on any device

Subjects

Site

Look