### The determinant of a matrix

A matrix is an array of many numbers. For a **square matrix**, i.e., a matrix with the same number of rows and columns, one can capture important information about the matrix in a just single number, called the *determinant*. The determinant is useful for solving linear equations, capturing how linear transformation change area or volume, and changing variables in integrals.

The determinant can be viewed as a function whose input is a square matrix and whose output is a number. If $n$ is the number of rows and columns in the matrix (remember, we are dealing with square matrices), we can call our matrix an $n \times n$ matrix. The simplest square matrix is a $1 \times 1$ matrix, which isn't very interesting since it contains just a single number. The determinant of a $1 \times 1$ matrix is that number itself.

Moving up in complexity, the next square matrix is a $2 \times 2$ matrix, which we can write as \begin{align*} \left[ \begin{array}{cc} a & b\\ c & d \end{array} \right]. \end{align*}

We calculate the determinant of this matrix as follows. We proceed along the first row, starting with the upper left component $a$. We multiply the component $a$ by the determinant of the “submatrix” formed by ignoring $a$'s row and column. In this case, this submatrix is the $1 \times 1$ matrix consisting of $d$, and its determinant is just $d$. So the first term of the determinant is $ad$.

Next, we proceed to the second component of the first row, which is
the upper right component $b$. We multiply $b$ by the determinant of
the submatrix formed by ignoring $b$'s row and column, which is $c$.
So, the next term of the determinant is $bc$. The total determinant
is simply the first term $ad$ **minus** the second term $bc$. We
denote this as
\begin{align*}
\det \left(\left[
\begin{array}{cc}
a & b\\
c & d
\end{array}
\right]\right)
= ad-bc.
\end{align*}

Okay, that was a lot of work for a simple fact. Most students don't have any trouble memorizing the determinant of a $2 \times 2$ matrix without such rigmarole. The reason for going through this process was to make calculating a $3 \times 3$ (and larger) determinant easy.

We calculate the determinant of a $3 \times 3$ matrix \begin{align*} \left[ \begin{array}{ccc} a & b & c\\ d & e & f\\ g & h & i \end{array} \right] \end{align*} in the exact same way. We proceed along the first row and multiply each component by the determinant of the submatrix formed by ignoring that component's row and column. Through this procedure we calculate three terms, one for $a$, one for $b$, and one for $c$. Each of these terms is added together, only with alternating signs (i.e., the first term minus the second term plus the third term).

We can now write down the determinant of a $3 \times 3$ matrix. \begin{align*} \det \left(\left[ \begin{array}{ccc} a & b & c\\ d & e & f\\ g & h & i \end{array} \right]\right) &= a \det \left(\left[ \begin{array}{cc} e & f\\ h & i \end{array} \right]\right) -b \det \left(\left[ \begin{array}{cc} d & f\\ g & i \end{array} \right]\right) +c \det \left(\left[ \begin{array}{cc} d & e\\ g & h \end{array} \right]\right)\\ &=a(ei-fh) - b(di-fg) + c(dh-eg)\\ &=aei +bfg + cdh -afh -bdi -ceg \end{align*}

Now, I guess you **could** memorize the final formula for a $3
\times 3$ determinant. But I'd rather use my brain's synaptic
connections to do something more useful. In fact, I'm afraid if I
tried to memorize it, I might forget something else important, like
how to combine like terms in algebra.

The above procedure generalizes to larger determinants. For example, to calculate the determinant of a $4 \times 4$ matrix, we'd have four terms, each of which would contain a $3 \times 3$ determinant. If we expanded all of those terms using the above formula for a $3 \times 3$ determinant, you can imagine we'd have a pretty ugly formula. That's too messy to write down. But if you had to, you could do it. Usually, though, we'd offload such an ugly and boring calculation to a computer.

**Key fact to remember**: the determinant is a single number calculated from a matrix.

#### Alternative notation

We often write a $2 \times 2$ determinant as $\left| \begin{array}{cc} a & b\\ c & d \end{array}\right|$ or a $3 \times 3$ determinant as \begin{align*} \left| \begin{array}{ccc} a & b & c\\ d & e & f\\ g & h & i \end{array} \right|. \end{align*} This notation is easier to write than the original notation above, so we'll often use it.

However, note that in this case, the vertical lines **do not**
mean absolute value. The determinant can be negative. In
mathematics, we like to use the same symbols to mean different things,
which is okay as long as it's clear from context. Since the absolute
value of an array of numbers is meaningless, the notation is
unambiguous.