Two Equations, Two Sides
In a scalar equation such as \(ax=b\), multiplication can be rearranged without changing its order. Matrix multiplication does not generally commute: \(\mathbf{A}\mathbf{B}\) and \(\mathbf{B}\mathbf{A}\) may be different, and one product may not even be defined. So solving a matrix equation means paying attention not only to which matrix is unknown, but also to which side each factor occupies.
We will consider square invertible coefficient matrices \(\mathbf{A}\in\mathbb{R}^{n\times n}\). An inverse of \(\mathbf{A}\) is a matrix \(\mathbf{A}^{-1}\) satisfying \(\mathbf{A}\mathbf{A}^{-1}=\mathbf{A}^{-1}\mathbf{A}=\mathbf{I}_n\). For \(\mathbf{A}\mathbf{X}=\mathbf{B}\), if \(\mathbf{B}\in\mathbb{R}^{n\times p}\), then \(\mathbf{X}\) must be in \(\mathbb{R}^{n\times p}\). For \(\mathbf{X}\mathbf{A}=\mathbf{B}\), if \(\mathbf{B}\in\mathbb{R}^{m\times n}\), then \(\mathbf{X}\) must be in \(\mathbb{R}^{m\times n}\). These dimensions make the products and the proposed solutions well-defined.
The side is determined by the original equation. In the first equation, \(\mathbf{A}\) stands immediately to the left of \(\mathbf{X}\), so its inverse must act on the left to cancel it. In the second, \(\mathbf{A}\) stands to the right of \(\mathbf{X}\), so its inverse must act on the right. The order of the other factors is not free to change.
Solving \(\mathbf{A}\mathbf{X}=\mathbf{B}\)
Proof. For existence, set \(\mathbf{X}=\mathbf{A}^{-1}\mathbf{B}\), which has size \(n\times p\). Then \(\mathbf{A}\mathbf{X}=\mathbf{A}(\mathbf{A}^{-1}\mathbf{B})=(\mathbf{A}\mathbf{A}^{-1})\mathbf{B}=\mathbf{I}_n\mathbf{B}=\mathbf{B}\), using associativity and the identity law. For uniqueness, suppose \(\mathbf{Y}\) is any solution, so \(\mathbf{A}\mathbf{Y}=\mathbf{B}\). Multiplying this equality on the left by \(\mathbf{A}^{-1}\) gives \(\mathbf{A}^{-1}(\mathbf{A}\mathbf{Y})=\mathbf{A}^{-1}\mathbf{B}\), hence \((\mathbf{A}^{-1}\mathbf{A})\mathbf{Y}=\mathbf{A}^{-1}\mathbf{B}\) and \(\mathbf{Y}=\mathbf{A}^{-1}\mathbf{B}\). Thus every solution equals the one already found. \(\square\)
Worked Example: Solve a Left-Multiplication Equation
Solve \(\mathbf{A}\mathbf{X}=\mathbf{B}\), where \(\mathbf{A}=\begin{bmatrix}1&2\\0&1\end{bmatrix}\) and \(\mathbf{B}=\begin{bmatrix}3&1&0\\2&4&1\end{bmatrix}\). Here \(\mathbf{A}\) is \(2\times2\), \(\mathbf{B}\) is \(2\times3\), and \(\mathbf{X}\) must be \(2\times3\).
The inverse is \(\mathbf{A}^{-1}=\begin{bmatrix}1&-2\\0&1\end{bmatrix}\), since multiplying in either order gives \(\mathbf{I}_2\). The inverse goes on the left of \(\mathbf{B}\):
For example, the first row of the product is \((3-4,\;1-8,\;0-2)=(-1,-7,-2)\), and the second row is \((2,4,1)\). Check by multiplying in the original order:
The product has the required size and equals \(\mathbf{B}\), so it verifies the solution. The theorem also guarantees there is no second solution.
Solving \(\mathbf{X}\mathbf{A}=\mathbf{B}\)
Proof. For existence, set \(\mathbf{X}=\mathbf{B}\mathbf{A}^{-1}\), which has size \(m\times n\). Then \(\mathbf{X}\mathbf{A}=(\mathbf{B}\mathbf{A}^{-1})\mathbf{A}=\mathbf{B}(\mathbf{A}^{-1}\mathbf{A})=\mathbf{B}\mathbf{I}_n=\mathbf{B}\). For uniqueness, suppose \(\mathbf{Y}\mathbf{A}=\mathbf{B}\). Multiply on the right by \(\mathbf{A}^{-1}\): \((\mathbf{Y}\mathbf{A})\mathbf{A}^{-1}=\mathbf{B}\mathbf{A}^{-1}\). Associativity gives \(\mathbf{Y}(\mathbf{A}\mathbf{A}^{-1})=\mathbf{B}\mathbf{A}^{-1}\), so \(\mathbf{Y}\mathbf{I}_n=\mathbf{B}\mathbf{A}^{-1}\) and therefore \(\mathbf{Y}=\mathbf{B}\mathbf{A}^{-1}\). Every solution must be this matrix. \(\square\)
Worked Example: Solve a Right-Multiplication Equation
Use the same \(\mathbf{A}=\begin{bmatrix}1&2\\0&1\end{bmatrix}\), and solve \(\mathbf{X}\mathbf{A}=\mathbf{B}\) for \(\mathbf{B}=\begin{bmatrix}3&1\\2&4\\1&0\end{bmatrix}\). Since \(\mathbf{B}\) is \(3\times2\), the unknown \(\mathbf{X}\) must be \(3\times2\).
This time the inverse belongs on the right of \(\mathbf{B}\):
The rows are computed separately: \((3,1)\mathbf{A}^{-1}=(3,-6+1)=(3,-5)\), \((2,4)\mathbf{A}^{-1}=(2,-4+4)=(2,0)\), and \((1,0)\mathbf{A}^{-1}=(1,-2)\). Check by multiplying on the right by \(\mathbf{A}\):
This check confirms the order as well as the arithmetic: the product is \(\mathbf{X}\mathbf{A}\), as required.
Why the Two Answers Can Differ
When \(\mathbf{A}\) and \(\mathbf{B}\) are square, both forms may be written with the same matrices, but they still ask different questions. The equation \(\mathbf{A}\mathbf{X}=\mathbf{B}\) has answer \(\mathbf{A}^{-1}\mathbf{B}\), whereas \(\mathbf{X}\mathbf{A}=\mathbf{B}\) has answer \(\mathbf{B}\mathbf{A}^{-1}\). These expressions need not be equal. They would be equal only in cases where \(\mathbf{A}^{-1}\mathbf{B}=\mathbf{B}\mathbf{A}^{-1}\); no such equality is guaranteed for arbitrary matrices.
Worked Example: Compare the Two Orders
Let \(\mathbf{A}=\begin{bmatrix}1&2\\0&1\end{bmatrix}\) and \(\mathbf{B}=\begin{bmatrix}3&1\\2&4\end{bmatrix}\). First solve \(\mathbf{A}\mathbf{X}=\mathbf{B}\):
Then solve the different equation \(\mathbf{X}\mathbf{A}=\mathbf{B}\):
Check the first answer: \(\begin{bmatrix}1&2\\0&1\end{bmatrix}\begin{bmatrix}-1&-7\\2&4\end{bmatrix}=\begin{bmatrix}3&1\\2&4\end{bmatrix}=\mathbf{B}\). Check the second: \(\begin{bmatrix}3&-5\\2&0\end{bmatrix}\begin{bmatrix}1&2\\0&1\end{bmatrix}=\begin{bmatrix}3&1\\2&4\end{bmatrix}=\mathbf{B}\). The two solutions differ because the equations put \(\mathbf{A}\) on opposite sides of \(\mathbf{X}\).
Common Mistake: Multiplying on the Wrong Side
A frequent error is to remember “multiply by the inverse” but ignore which side it must be on. In the first equation of the example above, a wrong step would be to write \(\mathbf{X}=\mathbf{B}\mathbf{A}^{-1}\). That expression actually solves \(\mathbf{X}\mathbf{A}=\mathbf{B}\), not \(\mathbf{A}\mathbf{X}=\mathbf{B}\). Substituting it into the left-multiplication equation exposes the error:
The correction follows the original order: from \(\mathbf{A}\mathbf{X}=\mathbf{B}\), multiply both sides on the left by \(\mathbf{A}^{-1}\), obtaining \(\mathbf{A}^{-1}\mathbf{A}\mathbf{X}=\mathbf{A}^{-1}\mathbf{B}\), and hence \(\mathbf{X}=\mathbf{A}^{-1}\mathbf{B}\). For \(\mathbf{X}\mathbf{A}=\mathbf{B}\), multiply both sides on the right instead. Always substitute the proposed answer into the original equation; checking a product in a different order is not a valid verification.
When the Inverse Method Does Not Apply
The two theorems require that \(\mathbf{A}\) be square and invertible. If \(\mathbf{A}\) is singular, the inverse formulas are unavailable, but that does not by itself tell us whether an equation has no solution or many solutions. For example, let \(\mathbf{A}=\begin{bmatrix}1&0\\0&0\end{bmatrix}\). For \(\mathbf{A}\mathbf{X}=\mathbf{O}\), both \(\mathbf{X}=\mathbf{O}\) and \(\mathbf{X}=\begin{bmatrix}0&0\\1&0\end{bmatrix}\) are solutions, since multiplying either on the left by \(\mathbf{A}\) gives \(\mathbf{O}\). In contrast, \(\mathbf{A}\mathbf{X}=\mathbf{I}_2\) has no solution: every product \(\mathbf{A}\mathbf{X}\) has a zero second row, but \(\mathbf{I}_2\) has second row \((0,1)\). Thus invertibility guarantees one solution for every right-hand side, while a singular coefficient requires a separate analysis.
Decide whether the unknown appears as \(\mathbf{A}\mathbf{X}\) or \(\mathbf{X}\mathbf{A}\).
Confirm that \(\mathbf{A}\) is square and invertible, and determine the required size of \(\mathbf{X}\).
Use \(\mathbf{A}^{-1}\mathbf{B}\) for \(\mathbf{A}\mathbf{X}=\mathbf{B}\), and \(\mathbf{B}\mathbf{A}^{-1}\) for \(\mathbf{X}\mathbf{A}=\mathbf{B}\).
Multiply the candidate by \(\mathbf{A}\) on the side specified in the equation and confirm that the result is \(\mathbf{B}\).
This method matters because matrix equations often encode several ordinary linear systems at once. The rules above handle all the columns of a left-multiplication equation or all the rows of a right-multiplication equation while preserving the order of matrix products. Keeping dimensions, side, and verification together prevents a plausible-looking inverse formula from solving the wrong equation.
Check Your Understanding
For each problem, identify the required size of the unknown and check any proposed answer by substitution.
- If \(\mathbf{A}\) is an invertible \(3\times3\) matrix and \(\mathbf{B}\) is \(3\times2\), what is the solution formula and size of \(\mathbf{X}\) in \(\mathbf{A}\mathbf{X}=\mathbf{B}\)?
- If \(\mathbf{A}\) is an invertible \(2\times2\) matrix and \(\mathbf{B}\) is \(4\times2\), what is the solution formula and size of \(\mathbf{X}\) in \(\mathbf{X}\mathbf{A}=\mathbf{B}\)?
- For \(\mathbf{A}=\begin{bmatrix}1&1\\0&1\end{bmatrix}\) and \(\mathbf{B}=\begin{bmatrix}2&3\\1&0\end{bmatrix}\), find \(\mathbf{X}\) satisfying \(\mathbf{A}\mathbf{X}=\mathbf{B}\), then verify.
- Explain why \(\mathbf{B}\mathbf{A}^{-1}\) is the appropriate formula for \(\mathbf{X}\mathbf{A}=\mathbf{B}\), not for \(\mathbf{A}\mathbf{X}=\mathbf{B}\).
- Give one reason a singular coefficient matrix can lead to no solution, and one reason it can lead to more than one solution.