The page you are reading is part of a draft (v2.0) of the "No bullshit guide to math and physics."

The text has since gone through many edits and is now available in print and electronic format. The current edition of the book is v4.0, which is a substantial improvement in terms of content and language (I hired a professional editor) from the draft version.

I'm leaving the old wiki content up for the time being, but I highly engourage you to check out the finished book. You can check out an extended preview here (PDF, 106 pages, 5MB).


Matrix equations

If $a,b$ and $c$ were three numbers, and I told you to solve for $a$ in the equation \[ ab = c, \] then you would know to tell me that the answer is $a = c/b = c\frac{1}{b}=\frac{1}{b}c$, and that would be the end of it.

Now suppose that $A$, $B$ and $C$ are matrices and you want to solve for $A$ in the matrix equation \[ AB = C. \]

The naive answer $A=C/B$ is not allowed. So far, we have defined a matrix product and matrix inverse, but not matrix division. Instead of division, we must do a multiplication by $B^{-1}$, which plays the role of the “divide by $B$” operation since the product of $B$ and $B^{-1}$ gives the identity matrix: \[ BB^{-1} = I, \qquad B^{-1}B = I. \] When applying the inverse matrix $B^{-1}$ to the equation, we must specify whether we are multiplying from the left or from the right because the matrix product is not commutative. What do you think is the right answer for $A$ in the above equations? Is it this one $A = CB^{-1}$ or this one $A = B^{-1}C$?

Matrix equations

To solve a matrix equation we will employ the same technique as we used to solve equations in the first chapter of the book. Recall that doing the same thing to both sides of any equation gives us a new equation that is equally valid as the first. There are only two new things you need to keep in mind for matrix equations:

  • The order in which the matrices are multiplied matters

because the matrix product is not a commutative operation $AB \neq BA$.

  This means that the two expressions $ABC$ and $BAC$ are different,
  despite the fact that they are the product of the same matrices.
* When performing operations on matrix equations you can act 
  either from the //left// or from the //right// side of the equation.

The best way to get you used to the peculiarities of matrix equations is to look at some examples together. Don't worry there will be nothing too mathematically demanding. We will just explain what is going on with pictures.

In the following examples, the unknown (matrix) we are trying to solve is shaded in. Your task is to solve this equation for the unknown by isolating it on one side of the equation. Let us see what is going on.

Matrix times a matrix

Let us continue with the equation we were trying to solve in the introduction: $AB=C$. In order to solve for $A$ in

,

we will can multiply by $B^{-1}$ from the right on both sides of the equation:

.

This is good stuff because $B$ and $B^{-1}$ will cancel out ($BB^{-1}=I$) and give us the answer:

.

Matrix times a matrix variation

Okay, but what if we were trying to solve for $B$ in $AB=C$. How would we proceed then?

The answer is, again, to do the same to both sides of the equation. If we want to cancel $A$, then we have to multiply by $A^{-1}$ from the left:

.

The result will be:

.

Matrix times a vector

We start with the equation \[ A\vec{x}=\vec{b}, \] which shows some $n\times n$ matrix $A$, and the vectors $\vec{x}$ and $\vec{b}$, which are nothing more than tall and skinny matrices of dimensions $n \times 1$.

Assuming that $A$ is invertible, there is nothing special to do here and we proceed by multiplying by the inverse $A^{-1}$ on the left of both sides of the equation. We get:

By definition, $A^{-1}$ times its inverse $A$ is equal to the identity $I$, which is a diagonal matrix with ones on the diagonal and zeros everywhere else:

The product of anything with the identity is the thing itself:

,

which is our final answer.

Note however that the question “Solve for $\vec{x}$ in $A\vec{x} = \vec{b}$” can sometimes be asked in situations where the matrix $A$ is not invertible. If the system of equations is under-specified (A is wider than it is tall), then there will be a whole subspace of acceptable solutions $\vec{x}$. If the system is over-specified (A is taller than it is wide) then we might be interested in finding the best fit vector $\vec{x}$ such that $A\vec{x} \approx \vec{b}$. Such approximate solutions are of great practical importance in much of science.

\[ \ \]

This completes our lightning tour of matrix equations. There is nothing really new to learn here, I just had to make you aware of the fact that the order in which you apply do matrix operations matters and remind you the general principle of “doing the same thing to both sides of the equation”. Acting according to this principle is really important when manipulating matrices.

In the next section we look at matrix equations in more details as we analyze the properties of matrix multiplication. We will also discuss several algorithms for computing the matrix inverse.

Exercises

Solve for X

Solve for the matrix $X$ the following equations: (1) $XA = B$, (2) $ABCXD = E$, (3) $AC = XDC$. Assume the matrices $A,B,C$ and $D$ are all invertible.

Ans: (1) $X = BA^{-1}$, (2) $X = C^{-1}B^{-1}A^{-1}E D^{-1}$, (3) $X=AD^{-1}$.

 
home about buy book