Tutorials › Linear Algebra › A Worked Representation of X ↦ AX + XB

Matrix Representations of Linear Maps · Tutorial 440 of 1000

A Worked Representation of X ↦ AX + XB

Learn to turn the images of four matrix units into the representing matrix of \(X\mapsto AX+XB\), and verify the result by applying the map to a general matrix.

Intermediate 9 min read

What You'll Learn

  • Fix the ordered matrix-unit basis used for coordinates in \(M_{2\times2}(\mathbb{R})\).
  • Verify that \(X\mapsto AX+XB\) is a linear map.
  • Compute each column of its representing matrix from a basis image.
  • Derive and use a general \(4\times4\) formula for arbitrary \(2\times2\) matrices \(A\) and \(B\).
  • Check a representing matrix by comparing its coordinate output with direct matrix multiplication.
  • Identify the error caused by reversing multiplication order or changing basis order.

The Map and Its Coordinate Basis

For fixed \(2\times2\) matrices \(A\) and \(B\), the rule \(X\mapsto AX+XB\) takes a matrix \(X\) as input and returns another \(2\times2\) matrix. To represent this rule by an ordinary matrix, we first need to specify how matrices \(X\) are written as coordinate vectors. The order matters: the columns of the representing matrix will follow the chosen order of basis matrices.

Throughout, the scalars are real, and \(M_{2\times2}(\mathbb{R})\) denotes the vector space of \(2\times2\) real matrices. For \(i,j\in\{1,2\}\), let \(E_{ij}\) be the matrix with a \(1\) in row \(i\), column \(j\), and zeros elsewhere. We use the following fixed ordered basis:

$$ \mathcal{B}=(E_{11},E_{12},E_{21},E_{22}) = \left( \begin{bmatrix}1&0\\0&0\end{bmatrix}, \begin{bmatrix}0&1\\0&0\end{bmatrix}, \begin{bmatrix}0&0\\1&0\end{bmatrix}, \begin{bmatrix}0&0\\0&1\end{bmatrix} \right). $$

Every \(X=\begin{bmatrix}x_{11}&x_{12}\\x_{21}&x_{22}\end{bmatrix}\) has the decomposition \(X=x_{11}E_{11}+x_{12}E_{12}+x_{21}E_{21}+x_{22}E_{22}\). Each entry of \(X\) is thereby the coefficient of exactly one basis matrix, so this expression is unique. Consequently, the coordinate vector in this ordered basis is \([X]_{\mathcal{B}}=(x_{11},x_{12},x_{21},x_{22})^{\top}\). These coordinates list entries across the first row and then across the second row; that convention is tied to the specified basis order.

Definition: For fixed \(A,B\in M_{2\times2}(\mathbb{R})\), define \(T:M_{2\times2}(\mathbb{R})\to M_{2\times2}(\mathbb{R})\) by \(T(X)=AX+XB\). The representing matrix of \(T\) in the basis \(\mathcal{B}\), when the same basis is used for input and output, is the \(4\times4\) matrix whose \(j\)-th column is \([T(E_j)]_{\mathcal{B}}\), where \(E_1=E_{11},E_2=E_{12},E_3=E_{21},E_4=E_{22}\).

The map is linear. Indeed, if \(X,Y\in M_{2\times2}(\mathbb{R})\) and \(r,s\in\mathbb{R}\), distributivity of matrix multiplication gives \(T(rX+sY)=A(rX+sY)+(rX+sY)B=r(AX+XB)+s(AY+YB)=rT(X)+sT(Y)\). Thus a representing matrix is appropriate, and its columns can be computed by applying \(T\) to the four basis matrices.

Proposition: If a linear map \(T\) acts on a finite-dimensional vector space with ordered basis \((E_1,\dots,E_4)\), and \(M\) has columns \([T(E_j)]_{\mathcal{B}}\), then \([T(X)]_{\mathcal{B}}=M[X]_{\mathcal{B}}\) for every \(X\).

Proof. Write \(X=x_1E_1+x_2E_2+x_3E_3+x_4E_4\), so \([X]_{\mathcal{B}}=(x_1,x_2,x_3,x_4)^{\top}\). Linearity gives \(T(X)=\sum_{j=1}^{4}x_jT(E_j)\). Taking coordinates preserves sums and scalar multiples, so \([T(X)]_{\mathcal{B}}=\sum_{j=1}^{4}x_j[T(E_j)]_{\mathcal{B}}\). The vectors \([T(E_j)]_{\mathcal{B}}\) are precisely the columns of \(M\), and their weighted sum is the matrix-vector product \(M[X]_{\mathcal{B}}\). \(\square\)

A General Formula for the Representing Matrix

Let the fixed matrices be \(A=\begin{bmatrix}a&b\\c&d\end{bmatrix}\) and \(B=\begin{bmatrix}e&f\\g&h\end{bmatrix}\). For a general input \(X=\begin{bmatrix}x_{11}&x_{12}\\x_{21}&x_{22}\end{bmatrix}\), calculate the two products separately. Their sum is

$$ AX+XB = \begin{bmatrix} ax_{11}+bx_{21}+ex_{11}+gx_{12} & ax_{12}+bx_{22}+fx_{11}+hx_{12} \\ cx_{11}+dx_{21}+ex_{21}+gx_{22} & cx_{12}+dx_{22}+fx_{21}+hx_{22} \end{bmatrix}. $$

Collect the coefficients of \(x_{11},x_{12},x_{21},x_{22}\) in that order. This yields the coordinate vector of the output and hence the representing matrix:

$$ [T(X)]_{\mathcal{B}} = \begin{bmatrix} a+e&g&b&0\\ f&a+h&0&b\\ c&0&d+e&g\\ 0&c&f&d+h \end{bmatrix} \begin{bmatrix}x_{11}\\x_{12}\\x_{21}\\x_{22}\end{bmatrix}. $$

Each column has a direct meaning: it records the coordinates of the output when the corresponding input is one matrix unit. For example, the first column is the coordinate vector of \(T(E_{11})\). It is not obtained by reading the entries of \(A\) or \(B\) in isolation; it comes from carrying out both products \(AE_{11}\) and \(E_{11}B\), then adding them. The formula is a useful check, but computing images of the basis matrices is often the clearest way to see why each entry appears where it does.

Worked Representation from Basis Images

Worked Example: A Nondiagonal Pair

Take \(A=\begin{bmatrix}1&2\\0&1\end{bmatrix}\) and \(B=\begin{bmatrix}3&0\\1&-1\end{bmatrix}\). Find the matrix of \(T(X)=AX+XB\) in \(\mathcal{B}\), using basis images.

For \(E_{11}\), the two products are \(AE_{11}=\begin{bmatrix}1&0\\0&0\end{bmatrix}\) and \(E_{11}B=\begin{bmatrix}3&0\\0&0\end{bmatrix}\). Therefore \(T(E_{11})=\begin{bmatrix}4&0\\0&0\end{bmatrix}\), so \([T(E_{11})]_{\mathcal{B}}=(4,0,0,0)^{\top}\).

For \(E_{12}\), multiplication gives \(AE_{12}=\begin{bmatrix}0&1\\0&0\end{bmatrix}\) and \(E_{12}B=\begin{bmatrix}1&-1\\0&0\end{bmatrix}\). Their sum is \(T(E_{12})=\begin{bmatrix}1&0\\0&0\end{bmatrix}\), with coordinate vector \((1,0,0,0)^{\top}\).

For \(E_{21}\), the products are \(AE_{21}=\begin{bmatrix}2&0\\1&0\end{bmatrix}\) and \(E_{21}B=\begin{bmatrix}0&0\\3&0\end{bmatrix}\). Thus \(T(E_{21})=\begin{bmatrix}2&0\\4&0\end{bmatrix}\) and \([T(E_{21})]_{\mathcal{B}}=(2,0,4,0)^{\top}\).

For \(E_{22}\), we obtain \(AE_{22}=\begin{bmatrix}0&2\\0&1\end{bmatrix}\) and \(E_{22}B=\begin{bmatrix}0&0\\1&-1\end{bmatrix}\). Hence \(T(E_{22})=\begin{bmatrix}0&2\\1&0\end{bmatrix}\), whose coordinate vector is \((0,2,1,0)^{\top}\).

Place these four coordinate vectors in order as columns. The resulting representing matrix is

$$ [T]_{\mathcal{B}\leftarrow\mathcal{B}} = \begin{bmatrix} 4&1&2&0\\ 0&0&0&2\\ 0&0&4&1\\ 0&0&0&0 \end{bmatrix}. $$

Check: Let \(X=\begin{bmatrix}1&2\\3&4\end{bmatrix}\), so \([X]_{\mathcal{B}}=(1,2,3,4)^{\top}\). The representing matrix gives \((12,8,16,0)^{\top}\). Directly, \(AX=\begin{bmatrix}7&10\\3&4\end{bmatrix}\), \(XB=\begin{bmatrix}5&-2\\13&-4\end{bmatrix}\), and their sum is \(\begin{bmatrix}12&8\\16&0\end{bmatrix}\), with the same coordinate vector.

Worked Example: Diagonal Matrices

Let \(A=\begin{bmatrix}2&0\\0&-1\end{bmatrix}\) and \(B=\begin{bmatrix}3&0\\0&4\end{bmatrix}\). Find the representing matrix and interpret its action on the four entries of \(X\).

Using the general formula, \(a=2,b=0,c=0,d=-1,e=3,f=0,g=0,h=4\). Substituting each value gives

$$ [T]_{\mathcal{B}\leftarrow\mathcal{B}} = \begin{bmatrix} 5&0&0&0\\ 0&6&0&0\\ 0&0&2&0\\ 0&0&0&3 \end{bmatrix}. $$

In matrix form, the output is \(T(X)=\begin{bmatrix}5x_{11}&6x_{12}\\2x_{21}&3x_{22}\end{bmatrix}\). For instance, if \(X=\begin{bmatrix}1&2\\3&4\end{bmatrix}\), then \(AX=\begin{bmatrix}2&4\\-3&-4\end{bmatrix}\) and \(XB=\begin{bmatrix}3&8\\9&16\end{bmatrix}\). Adding gives \(\begin{bmatrix}5&12\\6&12\end{bmatrix}\).

Check: The coordinate vector of this output is \((5,12,6,12)^{\top}\). Multiplying the representing matrix by \((1,2,3,4)^{\top}\) gives \((5\cdot1,6\cdot2,2\cdot3,3\cdot4)^{\top}=(5,12,6,12)^{\top}\), as required.

Worked Example: Off-Diagonal Entries Mix Coordinates

Take \(A=\begin{bmatrix}0&1\\1&0\end{bmatrix}\) and \(B=\begin{bmatrix}0&2\\3&0\end{bmatrix}\). Apply the general formula with \(a=d=e=h=0\), \(b=c=1\), \(f=2\), and \(g=3\):

$$ [T]_{\mathcal{B}\leftarrow\mathcal{B}} = \begin{bmatrix} 0&3&1&0\\ 2&0&0&1\\ 1&0&0&3\\ 0&1&2&0 \end{bmatrix}. $$

To make the columns concrete, \(T(E_{11})=\begin{bmatrix}0&2\\1&0\end{bmatrix}\), \(T(E_{12})=\begin{bmatrix}3&0\\0&1\end{bmatrix}\), \(T(E_{21})=\begin{bmatrix}1&0\\0&3\end{bmatrix}\), and \(T(E_{22})=\begin{bmatrix}0&1\\3&0\end{bmatrix}\). Their coordinate vectors are, in order, \((0,2,1,0)^{\top}\), \((3,0,0,1)^{\top}\), \((1,0,0,3)^{\top}\), and \((0,1,3,0)^{\top}\), exactly the columns displayed.

Check: For \(X=\begin{bmatrix}1&2\\3&4\end{bmatrix}\), the representing matrix sends \((1,2,3,4)^{\top}\) to \((5,6,13,8)^{\top}\). Direct multiplication gives \(AX=\begin{bmatrix}3&4\\1&2\end{bmatrix}\) and \(XB=\begin{bmatrix}6&2\\12&6\end{bmatrix}\). Their sum \(\begin{bmatrix}9&6\\13&8\end{bmatrix}\) appears not to match the coordinate vector just computed. This discrepancy signals an arithmetic error in the matrix-vector multiplication: its first coordinate is \(0\cdot1+3\cdot2+1\cdot3+0\cdot4=9\), not \(5\). The correct product is \((9,6,13,8)^{\top}\), agreeing with direct multiplication.

Common Pitfall: Reversing the Side of Multiplication

In the last example, the contribution from \(E_{12}B\) is \(\begin{bmatrix}3&0\\0&0\end{bmatrix}\). A tempting but incorrect step is to use \(BE_{12}\) instead: that product is \(\begin{bmatrix}0&0\\0&3\end{bmatrix}\). These are different matrices, so reversing the order changes the map and therefore its representing matrix. The rule is specifically \(AX+XB\): multiply \(A\) on the left of \(X\), and multiply \(B\) on its right.

There is a second related risk: changing the coordinate order partway through a calculation. With \(\mathcal{B}=(E_{11},E_{12},E_{21},E_{22})\), the second coordinate is the \((1,2)\) entry. If instead one lists \(E_{11},E_{21},E_{12},E_{22}\), the coordinate vector and the columns of the representing matrix must both be reordered. A matrix computed for one ordered basis cannot be read as the matrix for another without making that change.

1
Fix the order.
Write the ordered basis and use it for every input and output coordinate vector.
2
Compute the images.
For each basis matrix \(E_{ij}\), calculate \(AE_{ij}\) and \(E_{ij}B\) separately, then add.
3
Make columns.
Read the four entries of each image in the fixed coordinate order; place that coordinate vector in the corresponding column.
4
Check with a general input.
Apply the matrix to one coordinate vector and compare with direct evaluation of \(AX+XB\).

This procedure works because every input matrix is a unique linear combination of the four basis matrices, and linearity carries that combination to the same weighted sum of their images. The representation therefore captures the map on every input, not just on the four basis matrices used to build its columns.

Check Your Understanding

Use the ordered basis \(\mathcal{B}=(E_{11},E_{12},E_{21},E_{22})\) unless a question says otherwise.

  1. For \(A=\begin{bmatrix}1&0\\2&1\end{bmatrix}\) and \(B=\begin{bmatrix}0&1\\0&2\end{bmatrix}\), write the representing matrix of \(X\mapsto AX+XB\).
  2. For \(A=\begin{bmatrix}2&0\\0&1\end{bmatrix}\) and \(B=\begin{bmatrix}1&0\\0&3\end{bmatrix}\), state the coefficient multiplying each entry of \(X\) in the output.
  3. Explain why the columns of the representing matrix are coordinate vectors of images, rather than the images written as \(2\times2\) arrays.
  4. For \(A=\begin{bmatrix}0&1\\1&0\end{bmatrix}\), \(B=\begin{bmatrix}0&2\\3&0\end{bmatrix}\), and \(X=\begin{bmatrix}1&0\\0&0\end{bmatrix}\), calculate \(AX+XB\) directly and read the same answer from the first column of the representation.
  5. Give an example of how changing the order of the matrix-unit basis affects the coordinate vector of a matrix.

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon