Functions that respect addition and scaling: $T(\mathbf{u}+\mathbf{v})=T(\mathbf{u})+T(\mathbf{v})$ and $T(c\mathbf{u})=cT(\mathbf{u})$. Every such map $\mathbb{R}^n\to\mathbb{R}^m$ is multiplication by a matrix.
When a game engine turns a character, a robot controller converts joint angles into a hand position, or a photo app turns a colour image grey, a computer is applying a function to vectors. Most such functions would be hopeless to describe point by point: a single image has millions of pixels. Yet a huge family of them can be described completely by a small table of numbers, because they respect the two basic operations of linear algebra โ adding vectors and multiplying them by scalars.
These functions are called linear transformations. They are the reason matrices matter: in Chapter 2 a matrix was a rectangular array that we added and multiplied; in this section we see that a matrix is a linear transformation, and that every linear transformation between $\mathbb{R}^n$ and $\mathbb{R}^m$ is a matrix in disguise. The same idea also lets us treat transposing a matrix, evaluating a polynomial, or (for readers who know calculus) differentiating, as members of one family.
Functions between Vector Spaces
A function $T$ from a vector space $V$ to a vector space $W$ is a rule that assigns to each vector $\mathbf{v}$ in $V$ exactly one vector $T(\mathbf{v})$ in $W$. We write $T:V\to W$. The space $V$ is the domain, $W$ is the codomain, and $T(\mathbf{v})$ is the image of $\mathbf{v}$ under $T$. A function from a space to itself ($V=W$) is often called an operator on $V$.
๐ Definition 6.1 โ Linear transformation
Let $V$ and $W$ be vector spaces. A function $T:V\to W$ is a linear transformation (or linear map) if, for all vectors $\mathbf{u},\mathbf{v}$ in $V$ and every scalar $c$,
$$\text{(i)}\ \ T(\mathbf{u}+\mathbf{v})=T(\mathbf{u})+T(\mathbf{v})\qquad\text{and}\qquad\text{(ii)}\ \ T(c\mathbf{u})=c\,T(\mathbf{u}).$$
Condition (i) says $T$ preserves addition; condition (ii) says $T$ preserves scalar multiplication. A linear transformation from $V$ to itself is called a linear operator on $V$.
In words: it does not matter whether you add (or scale) first and then apply $T$, or apply $T$ first and then add (or scale) โ you land in the same place. Several useful facts follow immediately.
๐ Theorem 6.1 โ Basic properties of linear transformations
Let $T:V\to W$ be a linear transformation. Then for all $\mathbf{u},\mathbf{v},\mathbf{v}_1,\dots,\mathbf{v}_k$ in $V$ and all scalars $c_1,\dots,c_k$:
$T(\mathbf{0})=\mathbf{0}$ (the zero of $V$ goes to the zero of $W$);
$T(-\mathbf{v})=-T(\mathbf{v})$ and $T(\mathbf{u}-\mathbf{v})=T(\mathbf{u})-T(\mathbf{v})$;
$T(c_1\mathbf{v}_1+\cdots+c_k\mathbf{v}_k)=c_1T(\mathbf{v}_1)+\cdots+c_kT(\mathbf{v}_k)$ โ linear maps send linear combinations to the same linear combinations of the images.
Conversely, a function $T:V\to W$ is linear if and only if $T(c\mathbf{u}+d\mathbf{v})=c\,T(\mathbf{u})+d\,T(\mathbf{v})$ for all $\mathbf{u},\mathbf{v}$ in $V$ and all scalars $c,d$.
๐ก Show proofโถ
1 Since $0\mathbf{v}=\mathbf{0}$ for any vector, condition (ii) with $c=0$ gives $T(\mathbf{0})=T(0\cdot\mathbf{0})=0\cdot T(\mathbf{0})=\mathbf{0}$.
2 $T(-\mathbf{v})=T((-1)\mathbf{v})=(-1)T(\mathbf{v})=-T(\mathbf{v})$, and then $T(\mathbf{u}-\mathbf{v})=T(\mathbf{u})+T(-\mathbf{v})=T(\mathbf{u})-T(\mathbf{v})$.
3 Apply (i) repeatedly to split the sum, then (ii) to pull out each scalar. For the converse, taking $c=d=1$ gives (i) and taking $d=0$ gives (ii) (using $T(\mathbf{0})=\mathbf{0}$, which follows from $c=d=0$).
๐งญ Problem-solving strategy โ is $T$ linear?
Quick test: compute $T(\mathbf{0})$. If $T(\mathbf{0})\ne\mathbf{0}$, stop โ $T$ is not linear.
Suspicious features: constants added on, squares, products of components, absolute values, square roots, $\sin$, $\det$ โฆ usually break linearity. To prove that $T$ is not linear, give one specific counterexample (numbers!) to (i) or (ii).
To prove linearity: take general vectors $\mathbf{u},\mathbf{v}$ and a general scalar $c$, and verify (i) and (ii) by algebra. A few numerical checks are never a proof.
Shortcut for $\mathbb{R}^n\to\mathbb{R}^m$: if every component of $T(\mathbf{x})$ is a sum of constant multiples of $x_1,\dots,x_n$ (no constant terms, no powers, no products), then $T(\mathbf{x})=A\mathbf{x}$ for a matrix $A$, and it is linear (Theorem 6.2 below).
โ๏ธ Example 1 โ Proving that a map is linear
Let $T:\mathbb{R}^2\to\mathbb{R}^3$ be defined by $T\left(\begin{bmatrix}x_1\\x_2\end{bmatrix}\right)=\begin{bmatrix}x_1-x_2\\2x_1+x_2\\3x_2\end{bmatrix}$. Show that $T$ is linear, and find $T\left(\begin{bmatrix}2\\-1\end{bmatrix}\right)$.
๐ก Show solutionโถ
Addition Let $\mathbf{u}=\begin{bmatrix}u_1\\u_2\end{bmatrix}$ and $\mathbf{v}=\begin{bmatrix}v_1\\v_2\end{bmatrix}$. Then $$T(\mathbf{u}+\mathbf{v})=\begin{bmatrix}(u_1+v_1)-(u_2+v_2)\\2(u_1+v_1)+(u_2+v_2)\\3(u_2+v_2)\end{bmatrix}=\begin{bmatrix}u_1-u_2\\2u_1+u_2\\3u_2\end{bmatrix}+\begin{bmatrix}v_1-v_2\\2v_1+v_2\\3v_2\end{bmatrix}=T(\mathbf{u})+T(\mathbf{v}).$$
Scaling For any scalar $c$: $$T(c\mathbf{u})=\begin{bmatrix}cu_1-cu_2\\2cu_1+cu_2\\3cu_2\end{bmatrix}=c\begin{bmatrix}u_1-u_2\\2u_1+u_2\\3u_2\end{bmatrix}=c\,T(\mathbf{u}).$$ Both conditions hold for all $\mathbf{u},\mathbf{v},c$, so $T$ is linear.
โ๏ธ Example 2 โ Three maps that are not linear
Show that none of these maps $\mathbb{R}^2\to\mathbb{R}^2$ is linear: (a) the translation $T\left(\begin{bmatrix}x\\y\end{bmatrix}\right)=\begin{bmatrix}x+1\\y\end{bmatrix}$; (b) $S\left(\begin{bmatrix}x\\y\end{bmatrix}\right)=\begin{bmatrix}x^2\\y\end{bmatrix}$; (c) $F\left(\begin{bmatrix}x\\y\end{bmatrix}\right)=\begin{bmatrix}xy\\x\end{bmatrix}$.
๐ก Show solutionโถ
(a) $T(\mathbf{0})=\begin{bmatrix}1\\0\end{bmatrix}\ne\mathbf{0}$, so by Theorem 6.1 $T$ is not linear. Translations move the origin, and linear maps never do.
(b) Here $S(\mathbf{0})=\mathbf{0}$, so the quick test is passed โ we need a counterexample. Take $\mathbf{u}=\begin{bmatrix}1\\0\end{bmatrix}$ and $c=2$: $$S(2\mathbf{u})=\begin{bmatrix}4\\0\end{bmatrix}\quad\text{but}\quad2S(\mathbf{u})=\begin{bmatrix}2\\0\end{bmatrix}.$$ Condition (ii) fails, so $S$ is not linear.
(c) $F(\mathbf{0})=\mathbf{0}$ again. With $\mathbf{u}=\begin{bmatrix}1\\1\end{bmatrix}$, $c=2$: $F(2\mathbf{u})=\begin{bmatrix}4\\2\end{bmatrix}$ while $2F(\mathbf{u})=\begin{bmatrix}2\\2\end{bmatrix}$. Not linear.
Lesson $T(\mathbf{0})=\mathbf{0}$ is necessary for linearity but not sufficient: (b) and (c) pass it and still fail.
โ ๏ธ Common mistakes
1. "Linear" at school is not "linear" here. The straight line $f(x)=3x+2$ is not a linear transformation $\mathbb{R}\to\mathbb{R}$, because $f(0)=2\ne0$. Only $f(x)=mx$ is. (Maps of the form $\mathbf{x}\mapsto A\mathbf{x}+\mathbf{b}$ are called affine.)
2. Checking examples is not a proof. A map may satisfy $T(\mathbf{u}+\mathbf{v})=T(\mathbf{u})+T(\mathbf{v})$ for the two vectors you tried and fail for others. Prove linearity with general vectors; disprove it with one specific failure.
3. Both conditions matter. A map must preserve sums and scalar multiples; checking only one is incomplete.
Interactive 1 โ The Linearity Tester
Two input vectors $\mathbf{u}$ and $\mathbf{v}$ (faint grey) turn slowly. The map sends them to $T(\mathbf{u})$ and $T(\mathbf{v})$; the dashed parallelogram ends at $T(\mathbf{u})+T(\mathbf{v})$. The green arrow is $T(\mathbf{u}+\mathbf{v})$. For a linear map the green arrow always ends exactly at the corner of the parallelogram; any gap (drawn in orange) is a counterexample. Switch the test to compare $T(c\mathbf{u})$ with $c\,T(\mathbf{u})$.
โ1.5
$T(\mathbf{u}+\mathbf{v})$โ
$T(\mathbf{u})+T(\mathbf{v})$โ
gap (length of the difference)โ
largest gap seen so farโ
Matrix Transformations and the Standard Matrix
The most important source of linear maps is matrix multiplication. If $A$ is an $m\times n$ matrix and $\mathbf{x}$ is in $\mathbb{R}^n$, then $A\mathbf{x}$ is in $\mathbb{R}^m$, and the rules of matrix algebra from Section 2.1 say exactly that $A(\mathbf{u}+\mathbf{v})=A\mathbf{u}+A\mathbf{v}$ and $A(c\mathbf{u})=c(A\mathbf{u})$.
๐ Definition 6.2 โ Matrix transformation
Let $A$ be an $m\times n$ matrix. The function $T_A:\mathbb{R}^n\to\mathbb{R}^m$ defined by $T_A(\mathbf{x})=A\mathbf{x}$ is called the matrix transformation (or multiplication by $A$). It is linear. Note the sizes: an $m\times n$ matrix maps $\mathbb{R}^n$ (n columns = number of inputs) to $\mathbb{R}^m$ (m rows = number of outputs).
The surprise is that there are no others. Write $\mathbf{e}_1,\dots,\mathbf{e}_n$ for the standard basis of $\mathbb{R}^n$ (the columns of $I_n$). Any $\mathbf{x}$ is the combination $\mathbf{x}=x_1\mathbf{e}_1+\cdots+x_n\mathbf{e}_n$, so if $T$ is linear, Theorem 6.1(3) gives
$$T(\mathbf{x})=x_1T(\mathbf{e}_1)+\cdots+x_nT(\mathbf{e}_n)=\begin{bmatrix}T(\mathbf{e}_1)&\cdots&T(\mathbf{e}_n)\end{bmatrix}\begin{bmatrix}x_1\\\vdots\\x_n\end{bmatrix}.$$
The last step is the "column view" of a matrixโvector product: $A\mathbf{x}$ is the combination of the columns of $A$ with weights $x_1,\dots,x_n$.
๐ Theorem 6.2 โ The standard matrix of a linear transformation
Let $T:\mathbb{R}^n\to\mathbb{R}^m$ be a linear transformation. Then there is exactly one $m\times n$ matrix $A$ such that $T(\mathbf{x})=A\mathbf{x}$ for every $\mathbf{x}$ in $\mathbb{R}^n$, namely
$$A=\begin{bmatrix}T(\mathbf{e}_1)&T(\mathbf{e}_2)&\cdots&T(\mathbf{e}_n)\end{bmatrix},$$
whose $j$-th column is the image of the $j$-th standard basis vector. $A$ is called the standard matrix of $T$. In particular, a linear map is completely determined by what it does to a basis.
โ๏ธ Example 3 โ Reading off a standard matrix
Find the standard matrix of the map $T$ in Example 1 and use it to compute $T\left(\begin{bmatrix}1\\4\end{bmatrix}\right)$.
๐ก Show solutionโถ
Columns $T(\mathbf{e}_1)=T\left(\begin{bmatrix}1\\0\end{bmatrix}\right)=\begin{bmatrix}1\\2\\0\end{bmatrix}$ and $T(\mathbf{e}_2)=T\left(\begin{bmatrix}0\\1\end{bmatrix}\right)=\begin{bmatrix}-1\\1\\3\end{bmatrix}$.
Matrix $$A=\begin{bmatrix}1&-1\\2&1\\0&3\end{bmatrix}\quad(3\times2:\ \text{from }\mathbb{R}^2\text{ to }\mathbb{R}^3).$$ Notice the rows of $A$ are just the coefficients of $x_1,x_2$ in each component of $T$.
Use it $$A\begin{bmatrix}1\\4\end{bmatrix}=\begin{bmatrix}1-4\\2+4\\0+12\end{bmatrix}=\begin{bmatrix}-3\\6\\12\end{bmatrix}.$$
Check From the formula: $T(1,4)=(1-4,\ 2+4,\ 12)=(-3,6,12)$. โ
โ๏ธ Example 4 โ A map known only on another basis
A linear operator $T$ on $\mathbb{R}^2$ satisfies $T\left(\begin{bmatrix}1\\1\end{bmatrix}\right)=\begin{bmatrix}3\\1\end{bmatrix}$ and $T\left(\begin{bmatrix}1\\-1\end{bmatrix}\right)=\begin{bmatrix}1\\5\end{bmatrix}$. Find its standard matrix and $T\left(\begin{bmatrix}4\\-2\end{bmatrix}\right)$.
๐ก Show solutionโถ
Express $\mathbf{e}_1,\mathbf{e}_2$ $\mathbf{e}_1=\tfrac12\begin{bmatrix}1\\1\end{bmatrix}+\tfrac12\begin{bmatrix}1\\-1\end{bmatrix}$ and $\mathbf{e}_2=\tfrac12\begin{bmatrix}1\\1\end{bmatrix}-\tfrac12\begin{bmatrix}1\\-1\end{bmatrix}$.
Use linearity $$T(\mathbf{e}_1)=\tfrac12\begin{bmatrix}3\\1\end{bmatrix}+\tfrac12\begin{bmatrix}1\\5\end{bmatrix}=\begin{bmatrix}2\\3\end{bmatrix},\qquad T(\mathbf{e}_2)=\tfrac12\begin{bmatrix}3\\1\end{bmatrix}-\tfrac12\begin{bmatrix}1\\5\end{bmatrix}=\begin{bmatrix}1\\-2\end{bmatrix}.$$ So $A=\begin{bmatrix}2&1\\3&-2\end{bmatrix}$.
Check $A\begin{bmatrix}1\\1\end{bmatrix}=\begin{bmatrix}3\\1\end{bmatrix}$ and $A\begin{bmatrix}1\\-1\end{bmatrix}=\begin{bmatrix}1\\5\end{bmatrix}$. โ Since $\begin{bmatrix}1\\1\end{bmatrix},\begin{bmatrix}1\\-1\end{bmatrix}$ form a basis of $\mathbb{R}^2$, these two images determine $T$ completely.
Interactive 2 โ Drag $T(\mathbf{e}_1)$ and $T(\mathbf{e}_2)$: the Matrix Builds Itself
Drag the round handles at the tips of the red arrow $T(\mathbf{e}_1)$ and the blue arrow $T(\mathbf{e}_2)$ (or press Play to tour some classic maps). The whole grid, the unit square and the flag follow, because $T(x\mathbf{e}_1+y\mathbf{e}_2)=x\,T(\mathbf{e}_1)+y\,T(\mathbf{e}_2)$. The two arrows are the two columns of the standard matrix. The point $\mathbf{x}=(2,1)$ is tracked: its image is $2T(\mathbf{e}_1)+1T(\mathbf{e}_2)$.
$T(\mathbf{e}_1)$ = column 1โ
$T(\mathbf{e}_2)$ = column 2โ
standard matrix $A$โ
$T(2,1)=2T(\mathbf{e}_1)+T(\mathbf{e}_2)$โ
Linear Maps on Other Vector Spaces
Linearity makes sense in any vector space from Chapter 5, not only $\mathbb{R}^n$. Here are some maps on the polynomial spaces $P_n$ and the matrix space $M_{2\times2}$.
โ๏ธ Example 5 โ Transpose, evaluation and determinant
Decide whether each map is linear. (a) $T:M_{2\times2}\to M_{2\times2}$, $T(A)=A^{T}$. (b) $E:P_2\to\mathbb{R}^2$, $E(p)=\begin{bmatrix}p(0)\\p(1)\end{bmatrix}$; also compute $E(1+2t-t^2)$. (c) $D:M_{2\times2}\to\mathbb{R}$, $D(A)=\det A$.
๐ก Show solutionโถ
(a) The transpose rules from Chapter 2 say $(A+B)^{T}=A^{T}+B^{T}$ and $(cA)^{T}=cA^{T}$. These are precisely conditions (i) and (ii), so $T$ is a linear operator on $M_{2\times2}$.
(b) Polynomials are added and scaled value by value: $(p+q)(0)=p(0)+q(0)$ and $(cp)(0)=c\,p(0)$, and the same at $t=1$. Hence $E(p+q)=E(p)+E(q)$ and $E(cp)=cE(p)$: $E$ is linear. For $p(t)=1+2t-t^2$: $p(0)=1$, $p(1)=1+2-1=2$, so $E(p)=\begin{bmatrix}1\\2\end{bmatrix}$.
(c) Not linear. Counterexample to (ii): $\det(2I_2)=4$, but $2\det I_2=2$. (In general $\det(cA)=c^2\det A$ for $2\times2$ matrices.) Condition (i) fails too: $\det\begin{bmatrix}1&0\\0&0\end{bmatrix}+\det\begin{bmatrix}0&0\\0&1\end{bmatrix}=0+0$, yet the sum of the matrices is $I_2$, with determinant $1$.
Bonus (uses calculus) Differentiation $D:P_3\to P_2$, $D(p)=p^{\prime}$, is linear: the sum rule $(p+q)^{\prime}=p^{\prime}+q^{\prime}$ and the constant-multiple rule $(cp)^{\prime}=cp^{\prime}$ are conditions (i) and (ii). For example $D(2-5t+t^3)=-5+3t^2$.
โ ๏ธ Analysis โ what makes a map linear?
The linear maps in Example 5 all act on their input "one piece at a time": transposing moves entries around, evaluating adds up coefficients times fixed numbers, differentiating multiplies each coefficient by a fixed number and shifts it. The determinant multiplies entries together ($ad-bc$), and products of the input with itself are never linear โ just as $x^2$ and $xy$ were not in Example 2. Other useful linear maps of this kind are the trace $\operatorname{tr}:M_{n\times n}\to\mathbb{R}$, multiplication by a fixed matrix $X\mapsto MX$, and the substitution $p(t)\mapsto p(t+1)$ on $P_n$.
Composition: Doing One Map after Another
A robot arm with two joints first rotates by the shoulder angle, then by the elbow angle; a graphics program first scales a model, then rotates it, then projects it onto the screen. Applying linear maps one after another is called composition. If $T:U\to V$ and $S:V\to W$, the composition $S\circ T:U\to W$ is $(S\circ T)(\mathbf{u})=S(T(\mathbf{u}))$ โ first $T$, then $S$.
๐ Theorem 6.3 โ Composition of linear maps is matrix multiplication
If $T:U\to V$ and $S:V\to W$ are linear transformations, then $S\circ T:U\to W$ is linear.
If $T:\mathbb{R}^n\to\mathbb{R}^m$ has standard matrix $A$ ($m\times n$) and $S:\mathbb{R}^m\to\mathbb{R}^p$ has standard matrix $B$ ($p\times m$), then $S\circ T:\mathbb{R}^n\to\mathbb{R}^p$ has standard matrix $BA$:
$$(S\circ T)(\mathbf{x})=B(A\mathbf{x})=(BA)\mathbf{x}.$$
Linearity of $S\circ T$ is a one-line check: $$S(T(c\mathbf{u}+d\mathbf{v}))=S(cT(\mathbf{u})+dT(\mathbf{v}))=cS(T(\mathbf{u}))+dS(T(\mathbf{v})).$$ The matrix statement is associativity of matrix multiplication. In fact this theorem is why matrix multiplication is defined the way it is โ the row-times-column rule is exactly what composition requires.
โ๏ธ Example 6 โ The order of composition matters
Let $T$ be the rotation of $\mathbb{R}^2$ by $90^\circ$ anticlockwise and $S$ the reflection in the $x$-axis. Find the standard matrices of $S\circ T$ and $T\circ S$, describe them geometrically, and find where each sends $\mathbf{x}=\begin{bmatrix}2\\1\end{bmatrix}$.
๐ก Show solutionโถ
Matrices Rotating by $90^\circ$ sends $\mathbf{e}_1\mapsto\mathbf{e}_2$ and $\mathbf{e}_2\mapsto-\mathbf{e}_1$; reflecting in the $x$-axis fixes $\mathbf{e}_1$ and sends $\mathbf{e}_2\mapsto-\mathbf{e}_2$: $$A_T=\begin{bmatrix}0&-1\\1&0\end{bmatrix},\qquad A_S=\begin{bmatrix}1&0\\0&-1\end{bmatrix}.$$
$S\circ T$ First $T$, then $S$, so the matrix is $A_SA_T$: $$A_SA_T=\begin{bmatrix}1&0\\0&-1\end{bmatrix}\begin{bmatrix}0&-1\\1&0\end{bmatrix}=\begin{bmatrix}0&-1\\-1&0\end{bmatrix}.$$ This swaps the coordinates and changes both signs: it is the reflection in the line $y=-x$. It sends $\mathbf{x}$ to $\begin{bmatrix}-1\\-2\end{bmatrix}$.
$T\circ S$ $$A_TA_S=\begin{bmatrix}0&-1\\1&0\end{bmatrix}\begin{bmatrix}1&0\\0&-1\end{bmatrix}=\begin{bmatrix}0&1\\1&0\end{bmatrix},$$ the reflection in the line $y=x$. It sends $\mathbf{x}$ to $\begin{bmatrix}1\\2\end{bmatrix}$.
Check Directly: $T(2,1)=(-1,2)$, then $S(-1,2)=(-1,-2)$ โ. And $S(2,1)=(2,-1)$, then $T(2,-1)=(1,2)$ โ. Different answers โ $AB\ne BA$ in general is the algebraic shadow of "rotate then reflect" $\ne$ "reflect then rotate".
โ ๏ธ Watch the order
In $S\circ T$ the map written on the right acts first, and its matrix is also written on the right: $(S\circ T)\leftrightarrow BA$. For three maps, "first $T_1$, then $T_2$, then $T_3$" has matrix $A_3A_2A_1$. Sizes must match: $B$ needs as many columns as $A$ has rows.
Exercises
I
Linear or not? Prove linearity, or give a specific counterexample.
1linear Each component is a combination of $x,y$ with no constant term: $T(\mathbf{x})=\begin{bmatrix}2&-1\\1&3\end{bmatrix}\mathbf{x}$, a matrix transformation. (Directly: $T(\mathbf{u}+\mathbf{v})=(2(u_1+v_1)-(u_2+v_2),\dots)=T(\mathbf{u})+T(\mathbf{v})$, and similarly for $c\mathbf{u}$.)
2not linear $T(0,0)=(0,1)\ne\mathbf{0}$.
3linear $T(\mathbf{x})=\begin{bmatrix}0&1\\1&0\end{bmatrix}\mathbf{x}$ (reflection in $y=x$).
8 $T(\mathbf{e}_2)=T(0,1)=(1,-1)$. Since $\mathbf{e}_1=(1,2)-2(0,1)$, $T(\mathbf{e}_1)=(4,1)-2(1,-1)=(2,3)$. So $A=\begin{bmatrix}2&1\\3&-1\end{bmatrix}$. Check: $A\begin{bmatrix}1\\2\end{bmatrix}=\begin{bmatrix}4\\1\end{bmatrix}$ โ.
9 $T(\mathbf{x})=2x_1-x_2+4x_3$, so $A=\begin{bmatrix}2&-1&4\end{bmatrix}$ ($1\times3$). Every linear map $\mathbb{R}^n\to\mathbb{R}$ is a dot product with a fixed vector.
III
Maps on polynomials and matrices. Decide whether each map is linear and do the computation asked.
1 $T:M_{2\times2}\to\mathbb{R}$, $T(A)=\operatorname{tr}A$ (the sum of the diagonal entries).
2 $T:M_{2\times2}\to\mathbb{R}$, $T(A)=\det A$. (Give a counterexample to additivity different from Example 5.)
1linear $\operatorname{tr}(A+B)=(a_{11}+b_{11})+(a_{22}+b_{22})=\operatorname{tr}A+\operatorname{tr}B$ and $\operatorname{tr}(cA)=c\operatorname{tr}A$.
2not linear For example $A=\begin{bmatrix}1&2\\3&4\end{bmatrix}$, $B=I_2$: $\det(A+B)=\det\begin{bmatrix}2&2\\3&5\end{bmatrix}=10-6=4$, but $\det A+\det B=-2+1=-1$. (Any example with $\det(A+B)\ne\det A+\det B$ works.)
3linear $(p+q)(t+1)=p(t+1)+q(t+1)$ and $(cp)(t+1)=c\,p(t+1)$. $T(1+t^2)=1+(t+1)^2=2+2t+t^2$.
5not linear $T(\mathbf{0})=0+1=1$, the constant polynomial $1$, not the zero polynomial.
6linear $T(X+Y)=X+Y+X^{T}+Y^{T}=T(X)+T(Y)$ and $T(cX)=cT(X)$. $T\left(\begin{bmatrix}1&2\\3&4\end{bmatrix}\right)=\begin{bmatrix}1&2\\3&4\end{bmatrix}+\begin{bmatrix}1&3\\2&4\end{bmatrix}=\begin{bmatrix}2&5\\5&8\end{bmatrix}$ โ always a symmetric matrix.
7linear By the sum and constant-multiple rules of differentiation, $(p+q)^{\prime}=p^{\prime}+q^{\prime}$ and $(cp)^{\prime}=cp^{\prime}$. $D(2-5t+t^3)=-5+3t^2$.
8linear (values add and scale, as in Example 5). With $p=1+t+t^2$: $p(-1)=1$, $p(0)=1$, $p(1)=3$, so $T(p)=(1,1,3)$.
IV
Composition, reasoning and applications.
1 $T(x,y)=(x+y,\ y)$ and $S(x,y)=(2x,\ x-y)$. Find the standard matrices of $S\circ T$ and $T\circ S$. Are they equal?
2 Let $R$ be the rotation of $\mathbb{R}^2$ by $90^\circ$. Use matrices to show that $R\circ R$ is the rotation by $180^\circ$.
3 $T$ is linear with $T(\mathbf{u})=(1,2)$ and $T(\mathbf{v})=(3,-1)$. Find $T(2\mathbf{u}-3\mathbf{v})$.
4Graphics. A sprite is first sheared by $H=\begin{bmatrix}1&0.5\\0&1\end{bmatrix}$ and then enlarged by a factor $2$ in every direction. Find the single matrix that does both, the image of the corner $(1,1)$ of the unit square, and the factor by which areas change.
5Bakery. A cake needs $0.5$ kg flour, $0.2$ kg sugar and $0.25$ kg butter; a batch of biscuits needs $0.3$ kg flour, $0.1$ kg sugar and $0.15$ kg butter. (a) Write the linear map $T:\mathbb{R}^2\to\mathbb{R}^3$ from (cakes, batches) to (flour, sugar, butter) as a matrix and find $T(10,20)$. (b) Flour costs $0.80$ USD/kg, sugar $1.20$ USD/kg and butter $6.00$ USD/kg. Find the matrix of the cost map $S\circ T$ and the cost of the order in (a).
6Proof. Let $T:V\to W$ be linear and suppose $\{\mathbf{v}_1,\dots,\mathbf{v}_k\}$ is linearly dependent in $V$. Show that $\{T(\mathbf{v}_1),\dots,T(\mathbf{v}_k)\}$ is linearly dependent in $W$.
7Challenge. Is there a linear map $T:\mathbb{R}^2\to\mathbb{R}^2$ with $T(1,2)=(1,0)$ and $T(2,4)=(1,1)$? Explain.
๐ก Show solutionsโถ
1 $A_T=\begin{bmatrix}1&1\\0&1\end{bmatrix}$, $A_S=\begin{bmatrix}2&0\\1&-1\end{bmatrix}$. $S\circ T$: $A_SA_T=\begin{bmatrix}2&2\\1&0\end{bmatrix}$; $T\circ S$: $A_TA_S=\begin{bmatrix}3&-1\\1&-1\end{bmatrix}$. Not equal. (Check one: $S(T(1,0))=S(1,0)=(2,1)$, the first column of $A_SA_T$ โ.)
2 $\begin{bmatrix}0&-1\\1&0\end{bmatrix}^2=\begin{bmatrix}-1&0\\0&-1\end{bmatrix}=-I_2$, which sends every $\mathbf{x}$ to $-\mathbf{x}$: the rotation by $180^\circ$.
4 First $H$, then $2I_2$: matrix $(2I_2)H=\begin{bmatrix}2&1\\0&2\end{bmatrix}$. The corner $(1,1)$ goes to $(3,2)$. Areas are multiplied by $|\det|=4$ (determinants as area factors: Section 3.3).
5 (a) $A=\begin{bmatrix}0.5&0.3\\0.2&0.1\\0.25&0.15\end{bmatrix}$ ($3\times2$), and $T(10,20)=(5+6,\ 2+2,\ 2.5+3)=(11,\ 4,\ 5.5)$ kg. (b) The price map is $S(f,s,b)=0.8f+1.2s+6b$ with matrix $B=\begin{bmatrix}0.8&1.2&6\end{bmatrix}$, so $S\circ T$ has matrix $BA=\begin{bmatrix}2.14&1.26\end{bmatrix}$: each cake costs $2.14$ USD and each batch $1.26$ USD in ingredients. The order costs $10(2.14)+20(1.26)=46.60$ USD (check: $0.8(11)+1.2(4)+6(5.5)=8.8+4.8+33=46.6$ โ).
6 Dependence means there are scalars $c_1,\dots,c_k$, not all zero, with $c_1\mathbf{v}_1+\cdots+c_k\mathbf{v}_k=\mathbf{0}$. Apply $T$ and use Theorem 6.1: $c_1T(\mathbf{v}_1)+\cdots+c_kT(\mathbf{v}_k)=T(\mathbf{0})=\mathbf{0}$, with the same not-all-zero scalars. So the images are dependent.
7 No. $(2,4)=2(1,2)$, so linearity forces $T(2,4)=2T(1,2)=(2,0)\ne(1,1)$. (Prescribed values determine a linear map only on independent vectors โ compare Example 4.)
๐ฌ ResearchโTeaching NexusResearch-tutored ยท optional, about 30 minutes
Research question. Which photo filters are linear transformations of the colour space, and which are not?
Why it matters. A colour pixel is a vector $(R,G,B)$ in $\mathbb{R}^3$. Phone cameras, medical-image viewers and satellite software apply colour filters to millions of pixels per second; filters that are linear are a single $3\times3$ (or $1\times3$) matrix, can be combined by multiplying matrices, and run extremely fast on graphics chips.
What to do.
A widely used greyscale conversion (from television standards) is $Y=0.299R+0.587G+0.114B$. Write its standard matrix and compute $Y$ for the pixel $(200,120,40)$.
A popular "sepia" filter uses $$\begin{bmatrix}R'\\G'\\B'\end{bmatrix}=\begin{bmatrix}0.393&0.769&0.189\\0.349&0.686&0.168\\0.272&0.534&0.131\end{bmatrix}\begin{bmatrix}R\\G\\B\end{bmatrix}.$$ Apply it to $(200,120,40)$ and to $(250,250,250)$. Real images store values from $0$ to $255$, so results above $255$ are cut back ("clipped") to $255$. Explain why clipping makes the real filter not linear.
Test these filters for linearity with Definition 6.1: brightness $\mathbf{x}\mapsto\mathbf{x}+(20,20,20)$; contrast $\mathbf{x}\mapsto1.3\mathbf{x}$; "gamma correction" $R\mapsto255(R/255)^{2.2}$ applied to each channel.
Find the single matrix for "sepia, then greyscale" using Theorem 6.3.
Tools: Calculator or spreadsheet; optionally any photo editor to compare with real filters.
Hand in: A half-page note listing which filters are linear (with a one-line reason or counterexample each), your computed pixels, and the combined matrix.
Going further. Colour-blindness simulators and the conversion between the RGB and YCbCr colour spaces used in JPEG compression are also (almost) linear maps of $\mathbb{R}^3$. Look one up and identify its matrix.
Instructor note: $Y=59.8+70.44+4.56=134.8$. Sepia of $(200,120,40)$ is $(178.44,\,158.84,\,123.72)$; of $(250,250,250)$ it is $(337.75,\,300.75,\,234.25)$, clipped to $(255,255,234.25)$ โ doubling the input no longer doubles the output. Brightness is affine (moves $\mathbf{0}$), contrast is linear (until clipping), gamma is not linear. The combined matrix is the $1\times3$ product $\begin{bmatrix}0.299&0.587&0.114\end{bmatrix}S$.
๐งช Self-check quiz
0/5 correct
Q1. Which map $\mathbb{R}^2\to\mathbb{R}^2$ is linear?
Q2. The standard matrix of a linear map $T:\mathbb{R}^3\to\mathbb{R}^2$ has size
Q3. $T$ is linear with $T(\mathbf{e}_1)=(1,2)$ and $T(\mathbf{e}_2)=(0,-1)$. Then $T(3,4)=$
Q4. $T$ has standard matrix $A$ and $S$ has standard matrix $B$. The standard matrix of $S\circ T$ (first $T$, then $S$) is
Q5. A function $T:V\to W$ satisfies $T(\mathbf{0})=\mathbf{0}$. What can you conclude?