# Matrix Determinants

## What are matrix determinants and how to find them. Explained with examples and graphs

A simple but important prerequisite for this topic is to understand how linear transformations transform the vector space around it. If you don't then you can read my article on Linear Transformation and come back here for Determinants.

## Core concept

So assuming that you are familiar with the concept of Linear Transformation, consider an arbitrary Matrix A that transforms the vector space as shown here

We observe that the vectors in the new vector space seem to be stretched out. Similarly, another matrix may transform the vector space into a smaller size, or in other words, squish them. In either case, there seems to be a change taking place with these vectors and the vector space itself. But exactly how much does it change?

All changes taking place in the world of mathematics originate from somewhere. There has to be something that "*determines*" this change.

Let us take an example of Matrix B and apply it to a vector with coordinates (0, 2). We shall also add a unit square somewhere on the graph and observe how it reshapes as the vector space around it warps.

$$B = \left[\begin{array}{r} 1 & 1 \\ 0 & 2 \end{array}\right] \times \left[\begin{array}{r} 0 \\ 2 \end{array}\right] = \left[\begin{array}{r} 2 \\ 4 \end{array}\right]$$

We can see that the original vector (0, 2) has stretched to a new vector (2, 4) but so has consequently, the unit area (purple square) stretched into a new area (orange parallelogram). The area of the square is 1 x 1 = 1 unit square and the area of the parallelogram is 1 x 2 = 2 unit square (base x height). This shows that the area of the square has doubled after the transformation and the determinant of Matrix B is 2

Hence, the factor by which the linear transformation scales a unit area on the vector space is known as the determinant of that transformation.

## How to compute determinants

Consider an arbitrary Matrix A

$$\begin{array} & A = \begin{bmatrix} a & b \\ c & d \ \end{bmatrix} \end{array}$$

For the sake of calculations, we are going to assume they represent two vectors in the first quadrant as shown below

We know that any area on that graph reshapes along with the vectors. So what could be the best choice to fit an area such that when it changes, we can easily compute the factor by which it increases or decreases?

Since we know how the vectors behave, it would make sense to have an area attached to them. So when the vectors reshape so does the area with them.

We add the vectors together to close the loop and the diagram evolves into a parallelogram. Their intersection point is the addition of their corresponding x and y values i.e (a+c, b+d)

Now that we have a shape whose area can be determined, we project the coordinates of the vertices on the X and Y axes

We can observe that the whole figure resides in a rectangle formed by four right-angled triangles and two small rectangles and the parallelogram (shaded region). To find its area we need to take away the areas of the unshaded regions.

$$\begin{array}{l} & \text{Let Area of parallelogram} = X \\ & \therefore X = (a+c)(b+d)-2bc-2 \times \frac{1}{2}ab - 2 \times \frac{1}{2}cd \\ & \quad\quad = ab + ad + cb +cd -2bc - ab - cd \\ & \quad\quad = ad - bc \end{array}$$

This area is nothing but the determinant of Matrix A. which is represented as shown below

$$\begin{array}{l} & |A| = \begin{array} & \begin{vmatrix} a & b \\ c & d \ \end{vmatrix} \end{array} = ad - bc \end{array}$$

If we take a closer look, we see that the final outcome consists only of the original elements of Matrix A. Multiplying the top-left and the bottom-right elements minus the top-right and the bottom-left elements. Quite simple, isn't it?

As an example, we can verify that Matrix B from the first section doubles the area by calculating its determinant

$$\begin{array}{} B = \left[\begin{array}{r} 1 & 1 \\ 0 & 2 \end{array}\right] \\ \therefore|B| = \begin{vmatrix}{} 1 & 1 \\ 0 & 2 \end{vmatrix} = (2 \times 1) - (1 \times 0) = 2 \end{array}$$

Since the determinant of B is 2, it doubles any area projected on the vector space.

Calculate the determinant of the following Matrix and think about how it may affect a unit area on a vector space. You can leave your answers in the comments.

$$\begin{bmatrix}{} 1 & 1 \\ 0 & 0.5 \end{bmatrix}$$

## Determinant of a 3D Matrix

Since Matrix A was 2D we were able to plot the vectors in just X and Y axes but what if a matrix is in 3D? Consider the following Matrix B

$$\begin{array}{l} & B = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \\ \end{bmatrix} \end{array}$$

If we plot this 3D matrix on the three X, Y, and Z axes then we end up with a wonky cuboid shape called *parallelepiped*. Which looks something like this

And the determinant of Matrix B will be the volume of this parallelepiped. Now we can sit and work out the volume of this shape as we did for the parallelogram but someone has already done that for us and for the sake of time we are directly gonna apply it as shown here

$$\begin{array}{l} |B| = \begin{vmatrix} a & b & c \\ d & e & f \\ g & h & i \\ \end{vmatrix} \\ \\ \quad = a \begin{vmatrix} e & f \\ h & i \end{vmatrix} - b \begin{vmatrix} d & f \\ g & i \end{vmatrix} + c \begin{vmatrix} d & e \\ g & h \end{vmatrix} \\ \\ \quad = a(ei-fh) -b(di-gf) +c(dh-eg) \end{array}$$

It may seem complex but there is a pattern here if you haven't noticed already. We pick an element from the top row and eliminate the others in the same row or column of the selected element, and then multiply it with the determinant of the remaining elements. And just be mindful of the alternating - and + signs between the elements.

## Negative Determinants

Using what we just learned, let us try a few examples.

$$\begin{array}{l} A = \left[\begin{array}{r} 2 & 1 \\ 1 & 2 \end{array}\right] \therefore |A| = \left|\begin{array}{r} 2 & 1 \\ 1 & 2 \end{array}\right| = (2 \times 2) - (1 \times 1) = 3 \\ \\ B = \left[\begin{array}{r} 1 & 2 \\ 2 & 1 \end{array}\right] \therefore |B| = \left|\begin{array}{r} 1 & 2 \\ 2 & 1 \end{array}\right| = (1 \times 1) - (2 \times 2) = -3 \end{array}$$

Both of these determinants increase the area in the space by a factor of 3. But then what does the negative sign indicate? To understand this we shall transform a set of vectors using each of the above matrices separately and observe the difference.

When Matrix A transforms the two vectors with coordinates (0, 2) and (2, 0) we can see that after the transformation, the purple vector remains closer to the Y axis and the orange vector remains closer to the X axis

On the other hand, when Matrix B transforms the same set of vectors we observe that the orange vector has shifted closer to the Y axis and the purple vector has shifted closer to the X axis. They seem to have flipped with each other, the purple vector is now below the orange vector and vice versa. Whereas, earlier the purple vector remain atop the orange vector even after the transformation.

Notice that in both cases, the resulting vectors still end up on the same two points of (2, 4) and (4, 2). This tells us that the area scaled by both matrices must be the same in terms of magnitude, which is 3.

Hence, the negative signs indicate the flipping of not just vectors but the entire vector space! It is just like flipping a page over.

So as not to clutter the space too much, I purposely left out the matrix multiplication before the graphs. The set of vectors that Matrix A and Matrix B transformed are given below as a single matrix. You may want to try multiplying this matrix with A and B, and see if you get the same results as shown in the graph

$$V = \begin{bmatrix}{} 0 & 2 \\ 2 & 0 \end{bmatrix}$$

## Zero Determinant

A matrix can have a determinant = 0. And by definition, this means that any area on the vector space must scale to 0. But how does it look graphically and what does it signify? Let's have a look.

Consider Matrix C with determinant = 0

$$\begin{array}{l} C = \begin{bmatrix}{} 2 & 1 \\ 2 & 1 \end{bmatrix} \\ \\ |C| = \begin{vmatrix}{} 2 & 4 \\ 2 & 4 \end{vmatrix} = 8 - 8 = 0 \end{array}$$

Observe how it transforms the same set of vectors as before

$$\begin{array}{l} \begin{bmatrix}{} 2 & 1 \\ 2 & 1 \end{bmatrix} \begin{bmatrix}{} 0 & 2 \\ 2 & 0 \end{bmatrix} = \begin{bmatrix}{} 2 & 4 \\ 2 & 4 \end{bmatrix} \end{array}$$

We can see that the vectors align on top of each other which leaves no scope for an area. This means that any area before the transformation would collapse onto a single line after the transformation.

This is significant as it tells us that whenever the determinant of a matrix is zero, the transformation of that matrix reduces the vector space to a lower dimension.

If a 3D Matrix has a determinant = 0, then what does it mean? Do they reduce the vector space to two dimensions? one dimension? or something else? Leave your answers in the comments

The last two sections - Negative Determinant and Zero Determinant - are significant in the world of matrices as they provide critical information on how they transform the vector space around them. They play an important role for Eigenvectors and Eigenvalues.

Thanks for reading! You can read the next article in the series which explains what is Matrix Inversion.

If this has helped you in any form you can show your appreciation by reacting to this post. If you have any feedback please feel free to leave them in the comments below.

Thanks again!