3 min read

Beginner’s Introduction to Matrices — Part II

Matrix operations are being used everywhere from designing games to launching rockets
Beginner’s Introduction to Matrices — Part II

Matrix operations are being used everywhere from designing games to launching rockets

In the first part, we discussed basic operations like addition, subtraction and multiplication. In this part let us see how can you compute the determinant of a matrix, and what does the term matrix inverse mean.

Continuing with the previous example let us take our square matrix (a square matrix is one in which the number of rows equals the number of columns)


The determinant of this matrix will be a single number. It will not be a matrix. The determinant can be seen as a function which converts a matrix to a number. The determinant of matrix A is written as |A|.

determinant of a 2x2 matrix

Determinants only exist for square matrices. It is a property of just the square matrices. For a 3x3 matrix determinant computation would look like this

Notice the +−+− pattern (+a… −b… +c… −d…). This is important to remember. This pattern continues for 4x4 matrices and higher. This method of computing the determinant is called the Laplace’s expansion. This by no means is the only method there are other methods too.

Not only are determinants used as computational tools (to solve linear equations, to compute areas and volumes) but they also have a significant application in Mechanics. They can be used to compute the stability of a truss or other mechanical structures.

The biggest use of a determinant though is ironically in its zero-ness. If the determinant of a matrix is 0, then it is a situation that needs attention. Whether it is good or bad depends on the application.

Inverse of a matrix

In mathematics, the inverse of a number is written as

So multiplying a number with its inverse always yield 1. (Unless the number is 0, in which case the inverse itself is not defined).

For matrices, the logic works the same. If the inverse of a matrix exists then multiplying a matrix with its inverse results in identity matrix. Two things to note here

  • Inverse exists if 1) the matrix is square and 2) its determinant is non-zero
  • Identity matrix has all elements except the main diagonal as 0. The main diagonal elements are all 1. The identity matrix is always denoted by the letter I.

This is a very peculiar matrix because if you try to multiply it with another mx3 matrix the result will be that same matrix.

Why do we need an inverse

In the world of matrices, there is no division operation. So if you have to solve for X in an equation of the form, where A, X and B are all matrices

The only way to do that is to take the inverse of A.

There is no B/A in matrices

The biggest application of inverses come in computer games — ray tracing. In the gaming world, in order to achieve 3-D effects one needs to translate a mouse click into an actual action in the 3-D space of the game. This operation and countless others require matrix inverses. Inverses are also used for reflections.

In the next part, we will compute an actual inverse and explore python libraries for matrix multiplication.