14. Matrix representation of a linear transformation
§18.0 closed with the key fact that a linear transformation is determined entirely by its action on a basis. This lesson turns that fact into an actual matrix — for transformations between \mathbb{R}^n and \mathbb{R}^m, "linear transformation" and "matrix" turn out to be the same idea wearing two different names.
The standard matrix
For T:\mathbb{R}^n\to\mathbb{R}^m linear, define
A=\begin{pmatrix}|&&|\\T(\vec e_1)&\cdots&T(\vec e_n)\\|&&|\end{pmatrix}
— the standard matrix of T, built by applying T to each standard basis vector (§16.0) and stacking the results as columns. Then T(\vec x)=A\vec x for every \vec x\in\mathbb{R}^n: write \vec x=x_1\vec e_1+\cdots+x_n\vec e_n (§16.0), and by §18.0's basis-determination fact,
T(\vec x)=x_1T(\vec e_1)+\cdots+x_nT(\vec e_n)=A\vec x
using exactly §16.2's column-combination reading of A\vec x in the last step. This is the precise sense in which "linear transformation \mathbb{R}^n\to\mathbb{R}^m" and "m\times n matrix" are the same object — every matrix defines a linear transformation (§18.0's first example), and every linear transformation between Euclidean spaces arises this way, uniquely.
Building the matrix from any description
The standard matrix's columns are just T applied to \vec e_1,\dots, \vec e_n — so building it is always the same three-step recipe:
- Compute T(\vec e_1),\dots,T(\vec e_n).
- Stack them as columns.
- Done — A\vec x=T(\vec x) for every \vec x, guaranteed.
This works whether T was originally described by a formula (as in §18.0's examples), a geometric rule (§18.2), or a table of a few values plus "extend linearly" (§18.0's basis-determination argument again, now put to direct use).
Matrix representation relative to other bases
If V has basis B and W has basis C (not necessarily standard), the matrix of T relative to B,C is built the same way but in coordinates: its columns are [T(\vec b_i)]_C (§17.3's coordinate vectors, applied to each image), so that
[T(\vec v)]_C=[T]_{C\leftarrow B}\,[\vec v]_B
This single formula subsumes the standard matrix above (the case B=C= standard basis, where every coordinate vector is just the vector itself) and previews exactly why the right choice of basis can turn a complicated-looking transformation into something almost trivial: §19.1 picks B=C= an eigenbasis, and [T]_{C\leftarrow B} becomes diagonal.
Doing it in Python
import numpy as np
# T(x, y, z) = (x + 2y - z, 3y + z) -- read the matrix off the formula
A = np.array([
[1, 2, -1],
[0, 3, 1],
])
v = np.array([2, -1, 4])
print("T(v) via formula components:", [2 - 2 - 4, -3 + 4])
print("A @ v: ", list(A @ v))
T(v) via formula components: [-4, 1]
A @ v: [-4, 1]
Building the standard matrix purely from images of the standard basis, without ever writing down a formula for T:
import numpy as np
def T(v):
x, y = v
return np.array([2*x - y, x + y, -3*y])
e1, e2 = np.array([1., 0.]), np.array([0., 1.])
A = np.column_stack([T(e1), T(e2)])
print("standard matrix A =")
for row in A.tolist():
print([v or 0.0 for v in row])
v = np.array([4., -2.])
print("\nT(v) directly:", list(T(v)))
print("A @ v: ", list(A @ v))
standard matrix A =
[2.0, -1.0]
[1.0, 1.0]
[0.0, -3.0]
T(v) directly: [10.0, 2.0, 6.0]
A @ v: [10.0, 2.0, 6.0]
Worked example
Find the standard matrix of T(x,y)=(3x-y,\,x+2y,\,-y).
T(\vec e_1)=T(1,0)=(3,1,0). T(\vec e_2)=T(0,1)=(-1,2,-1). Stack as columns:
\boxed{A=\begin{pmatrix}3&-1\\1&2\\0&-1\end{pmatrix}}
Sanity check. A(2,5)^T=\begin{pmatrix}3(2)-1(5)\\1(2)+2(5)\\0(2)-1(5)\end{pmatrix}=\begin{pmatrix}1\\12\\-5\end{pmatrix}. Direct substitution: T(2,5)=(3(2)-5,\,2+2(5),\,-5)=(1,12,-5) ✓ — the matrix built purely from basis images reproduces the original formula exactly, for an input that wasn't one of the basis vectors used to build it.
Your turn
1. Find the standard matrix of T(x,y,z)=(x-z,\,2y+z).
2. A linear T:\mathbb{R}^2\to\mathbb{R}^2 satisfies T(1,0)=(0,1) and T(0,1)=(-1,0). Find T(3,4) using the matrix.
3. True or false: two different linear transformations \mathbb{R}^n\to\mathbb{R}^m can share the same standard matrix.
Solutions
1. T(1,0,0)=(1,0), T(0,1,0)=(0,2), T(0,0,1)=(-1,1). A=\begin{pmatrix}1&0&-1\\0&2&1\end{pmatrix}
2. A=\begin{pmatrix}0&-1\\1&0\end{pmatrix} (columns are the given images). T(3,4)=A(3,4)^T=\begin{pmatrix}0(3)-1(4)\\1(3)+0(4)\end{pmatrix}=\begin{pmatrix}-4\\3\end{pmatrix}. (This particular A is a 90° rotation — confirmed geometrically in §18.2.)
3. False. This is the uniqueness half of the correspondence proven above: A\vec x=T(\vec x) for every \vec x pins T down completely once A is known, since A itself determines the output for every input, with nothing left unspecified. Two transformations agreeing on every input are, by definition, the same function — so a shared standard matrix means they were never actually different transformations to begin with.
Check yourself in code
Find the standard matrix of T(x,y,z)=(2x+y-z,\,x-3z,\,4y) and use it to compute T(1,-2,3).
Print exactly this:
A =
[2, 1, -1]
[1, 0, -3]
[0, 4, 0]
T(v) = [-3, -8, -8]
import numpy as np
A = np.array([
[2, 1, -1],
[1, 0, -3],
[0, 4, 0],
])
print("A =")
for row in A.tolist():
print(row)
v = np.array([1, -2, 3])
# print "T(v) = ..." using A @ v
import numpy as np
A = np.array([
[2, 1, -1],
[1, 0, -3],
[0, 4, 0],
])
print("A =")
for row in A.tolist():
print(row)
v = np.array([1, -2, 3])
print("T(v) =", list(A @ v))
Every linear transformation \mathbb{R}^n\to\mathbb{R}^m has a unique standard matrix — T applied to each standard basis vector, stacked as columns — and T(\vec x)=A\vec x for every input. "Linear transformation" and "matrix" are the same object viewed two ways; relative to non-standard bases the same idea holds in coordinates, [T(\vec v)]_C=[T]_{C\leftarrow B}[\vec v]_B.
Next: the most concrete illustrations of this correspondence — rotation, reflection, scaling, and shear, each one a small 2\times2 matrix with an immediate geometric picture.