# 4.18 Matrix of a linear map

Linear maps are abstractly defined things. We’d like to make them concrete. We do this by making the following observation: once you know what a linear transformation does on a basis, you know what it does everywhere.

Here’s what that means exactly. Let $T:V\to W$ be linear. Let $\mathbf{b}_{1},\ldots,\mathbf{b}_{n}$ be a basis of V. Then we can write any $\mathbf{v}$ as $\sum_{i=1}^{n}\lambda_{i}\mathbf{b}_{i}$ for some scalars $\lambda_{i}$, and so by linearity $T(\mathbf{v})=T(\sum_{i=1}^{n}\lambda_{i}\mathbf{b}_{i})=\sum_{i=1}^{n}\lambda% _{i}T(\mathbf{b}_{i}).$

This means that if we want to describe a linear map, we can just say what it does on a basis $\mathbf{b}_{1},\ldots,\mathbf{b}_{n}$. You can then work out $T(\mathbf{v})$ for any $\mathbf{v}\in V$ just by knowing the $T(\mathbf{b}_{i})$.

We can record what $T$ does to each $\mathbf{b}_{i}$ by giving the coefficients needed to write the $T(\mathbf{b}_{i})$ in terms of some fixed basis of $W$. Putting all this together, to completely describe a linear map $T:V\to W$ we only need to give a basis $\mathbf{b}_{1},\ldots,\mathbf{b}_{n}$ of $V$, a basis $\mathbf{c}_{1},\ldots,\mathbf{c}_{m}$ of $W$, and the coefficients needed to express $T(\mathbf{b}_{j})$ in terms of the $\mathbf{c}_{i}$. These coefficients naturally fit into an $m\times n$ matrix which will be called the matrix of $T$ with respect to initial basis $\mathbf{b}_{1},\ldots,\mathbf{b}_{n}$ and final basis $\mathbf{c}_{1},\ldots,\mathbf{c}_{m}$.

## 4.18.1 Definition of the matrix of a linear map

###### Definition 4.18.1.

Let $T:V\to W$ be linear, and let

• $\mathcal{B}=\mathbf{b}_{1},\ldots,\mathbf{b}_{n}$ be a basis of $V$

• $\mathcal{C}=\mathbf{c}_{1},\ldots,\mathbf{c}_{m}$ be a basis of $W$.

Define scalars $a_{ij}$ by $T(\mathbf{b}_{j})=\sum_{i=1}^{m}a_{ij}\mathbf{c}_{i}$. Then the matrix of $T$ with respect to initial basis $\mathcal{B}$ and final basis $\mathcal{C}$, written $[T]_{\mathcal{C}}^{\mathcal{B}}$, is the $m\times n$ matrix $(a_{ij})$.

Another way to think of this definition is that the $j$th column of $[T]_{\mathcal{C}}^{\mathcal{B}}$ records the image of the $j$th basis element from $\mathcal{B}$ under $T$, in the sense that the entries are the coefficients used in expressing $T(\mathbf{b}_{j})$ as a linear combination of $\mathcal{C}$.

When we have a linear map from a vector space to itself, we sometimes use a slightly different terminology. If $T:V\to V$ and $\mathcal{B}$ is a basis of V, the matrix of $T$ with respect to $\mathcal{B}$ means $[T]_{\mathcal{B}}^{\mathcal{B}}$.

Notice that the order of the basis matters in this definition. If you order the basis elements differently, you change the order of the columns or rows in the matrix. That’s why our bases are sequences, not sets.

## 4.18.2 Examples of the matrix of a linear map

###### Example 4.18.1.

Let $T:\mathbb{R}^{2}\to\mathbb{R}^{3}$ be defined by $T\begin{pmatrix}a\\ b\end{pmatrix}=\begin{pmatrix}a+b\\ a-b\\ 2a+b\end{pmatrix}$. This is linear. Let’s find the matrix of $T$ with respect to

• initial basis $\mathcal{E}=\mathbf{e}_{1},\mathbf{e}_{2}$, the standard basis for $\mathbb{R}^{2}$, and

• final basis $\mathcal{E}^{\prime}=\mathbf{e}_{1}^{\prime},\mathbf{e}_{2}^{\prime},\mathbf{e% }_{3}^{\prime}$, the standard basis for $\mathbb{R}^{3}$.

We have

 $\displaystyle T(\mathbf{e}_{1})$ $\displaystyle=\begin{pmatrix}1\\ 1\\ 2\end{pmatrix}={\color[rgb]{1,0,0}1}\mathbf{e}_{1}^{\prime}+{\color[rgb]{1,0,0% }1}\mathbf{e}_{2}^{\prime}+{\color[rgb]{1,0,0}2}\mathbf{e}_{3}^{\prime}$ $\displaystyle T(\mathbf{e}_{2})$ $\displaystyle=\begin{pmatrix}1\\ -1\\ 1\end{pmatrix}={\color[rgb]{0,0,1}1}\mathbf{e}_{1}^{\prime}{\color[rgb]{0,0,1}% -1}\mathbf{e}_{2}^{\prime}+{\color[rgb]{0,0,1}1}\mathbf{e}_{3}$

so the matrix $[T]_{\mathcal{E}^{\prime}}^{\mathcal{E}}$ is $\begin{pmatrix}{\color[rgb]{1,0,0}1}&{\color[rgb]{0,0,1}1}\\ {\color[rgb]{1,0,0}1}&{\color[rgb]{0,0,1}-1}\\ {\color[rgb]{1,0,0}2}&{\color[rgb]{0,0,1}1}\end{pmatrix}$.

###### Example 4.18.2.

Let

• $V$ be the vector space of all polynomials with real coefficients of degree $\leqslant 3$ in one variable $x$

• $D:V\to V$ be the differentiation map

• $\mathcal{B}$ be the basis $1,x,x^{2},x^{3}$ of $V$.

$D$ is a linear map, so let’s find the matrix $[D]_{\mathcal{B}}^{\mathcal{B}}$ of $D$ with respect to $\mathcal{B}$. We have

 $\displaystyle D(1)$ $\displaystyle=0={\color[rgb]{1,0,0}0}\times 1+{\color[rgb]{1,0,0}0}\times x+{% \color[rgb]{1,0,0}0}\times x^{2}+{\color[rgb]{1,0,0}0}\times x^{3}$ $\displaystyle D(x)$ $\displaystyle=1={\color[rgb]{0,0,1}1}\times 1+{\color[rgb]{0,0,1}0}\times x+{% \color[rgb]{0,0,1}0}\times x^{2}+{\color[rgb]{0,0,1}0}\times x^{3}$ $\displaystyle D(x^{2})$ $\displaystyle=2x={\color[rgb]{0.5,0.5,0}0}\times 1+{\color[rgb]{0.5,0.5,0}2}% \times x+{\color[rgb]{0.5,0.5,0}0}\times x^{2}+{\color[rgb]{0.5,0.5,0}0}\times x% ^{3}$ $\displaystyle D(x^{3})$ $\displaystyle=3x^{2}={\color[rgb]{.5,0,.5}0}\times 1+{\color[rgb]{.5,0,.5}0}% \times x+{\color[rgb]{.5,0,.5}3}\times x^{2}+{\color[rgb]{.5,0,.5}0}\times x^{3}$

and so

 $[D]_{\mathcal{B}}^{\mathcal{B}}=\begin{pmatrix}{\color[rgb]{1,0,0}0}&{\color[% rgb]{0,0,1}1}&{\color[rgb]{0.5,0.5,0}0}&{\color[rgb]{.5,0,.5}0}\\ {\color[rgb]{1,0,0}0}&{\color[rgb]{0,0,1}0}&{\color[rgb]{0.5,0.5,0}2}&{\color[% rgb]{.5,0,.5}0}\\ {\color[rgb]{1,0,0}0}&{\color[rgb]{0,0,1}0}&{\color[rgb]{0.5,0.5,0}0}&{\color[% rgb]{.5,0,.5}3}\\ {\color[rgb]{1,0,0}0}&{\color[rgb]{0,0,1}0}&{\color[rgb]{0.5,0.5,0}0}&{\color[% rgb]{.5,0,.5}0}\end{pmatrix}$
###### Example 4.18.3.

Let $\operatorname{id}:V\to V$ be the identity map $\operatorname{id}(\mathbf{v})=\mathbf{v}$. Let $\mathcal{B}=\mathbf{b}_{1},\ldots,\mathbf{b}_{n}$ be any basis for $V$. We’re going to work out $[\operatorname{id}]_{\mathcal{B}}^{\mathcal{B}}$. For any $j$,

 $\operatorname{id}(\mathbf{b}_{j})=\mathbf{b}_{j}=0\times\mathbf{b}_{1}+\cdots+% 1\times\mathbf{b}_{j}+\cdots+0\times\mathbf{b}_{n}.$

This means the $j$th column of $[\operatorname{id}]^{\mathcal{B}}_{\mathcal{B}}$ is all 0s, except a 1 in position $j$. In other words, $[\operatorname{id}]^{\mathcal{B}}_{\mathcal{B}}=I_{n}$, the $n\times n$ identity matrix.

This shows that the matrix of the identity map is the identity matrix, so long as the initial basis and the final basis are the same.

On the other hand, if $\mathcal{C}=\mathbf{c}_{1},\ldots,\mathbf{c}_{n}$ is a different basis of $V$ then $[\operatorname{id}]^{\mathcal{C}}_{\mathcal{B}}$ will not be the identity matrix. To figure out what goes in the $j$th column of this matrix we have to work out $\operatorname{id}(\mathbf{b}_{j})$, which is just $\mathbf{b}_{j}$ of course, as a linear combination of the $\mathbf{c}_{i}$s. The coefficients we have to use, whatever they are, make up this column of the matrix.

###### Example 4.18.4.

Consider two bases for $\mathbb{R}^{2}$

 $\displaystyle\mathcal{B}:$ $\displaystyle\;\;\mathbf{e}_{1}=\begin{pmatrix}1\\ 0\end{pmatrix},\mathbf{e}_{2}=\begin{pmatrix}0\\ 1\end{pmatrix}$ $\displaystyle\mathcal{C}:$ $\displaystyle\;\;\mathbf{c}_{1}=\begin{pmatrix}1\\ 1\end{pmatrix},\mathbf{c}_{2}=\begin{pmatrix}1\\ -1\end{pmatrix}$

Both $[\operatorname{id}]^{\mathcal{B}}_{\mathcal{B}}$ and $[\operatorname{id}]^{\mathcal{C}}_{\mathcal{C}}$ will be the identity matrix $I_{2}$. Let’s work out $[\operatorname{id}]^{\mathcal{C}}_{\mathcal{B}}$. To do that, we have to express $\operatorname{id}(c_{j})$ as a linear combination of the $\mathbf{e}_{i}$ for $j=1,2$:

 $\displaystyle\operatorname{id}(\mathbf{c}_{1})$ $\displaystyle=\mathbf{c}_{1}=\mathbf{e}_{1}+\mathbf{e}_{2}$ $\displaystyle\operatorname{id}(\mathbf{c}_{2})$ $\displaystyle=\mathbf{c}_{2}=\mathbf{e}_{1}-\mathbf{e}_{2}$

and so $[\operatorname{id}]^{\mathcal{C}}_{\mathcal{B}}=\begin{pmatrix}1&1\\ 1&-1\end{pmatrix}$.

###### Example 4.18.5.

Let $A$ be an m by n matrix, and $T_{A}:\mathbb{R}^{n}\to\mathbb{R}^{m}$ be the linear map $T_{A}(\mathbf{x})=A\mathbf{x}$. Then the matrix of $T_{A}$ with respect to the standard bases of $\mathbb{R}^{n}$ and $\mathbb{R}^{m}$ is $A$.