Big Page on Matrices

What is a Matrix??

A matrix is a way of showing information efficiently. It is a rectangular array of numbers.

What is the difference between a row matrix and a row vector? What about a  column matrix and column vector? - Quora

Matrices have two dimensions: the number of rows (usually denoted as as m) and the number of columns (denoted as n). The order of a matrix describes it’s size.

Matrix (mathematics) - Wikipedia
n on the columns, m on the rows

Operations on Matrices

Addition and Subtraction

Adding and subtracting matrices is really easy. Just take each element and do the required operation on the corresponding item. YES this does mean both matrices have to be of the exact same order.

Matrix addition & subtraction (article) | Khan Academy
Adding two matrices 😇

Multiplication by a scalar

Multiplying (and dividing) by a scalar is also pretty easy. Simply apply the operation to all items in the matrix and BOOM you’ve got your answer:

Multiplying matrices by scalars (article) | Khan Academy
Multiplying a matrix by a scalar 😝

Matrix Multiplication

But what if we want to multiply two MATRICES together??! The circumstance where this is possible is if the number of columns (n) in the first matrix is exactly equal to the number of ROWS (m) in the second matrix.

When this condition has been met, this is what you do:

  1. Select the first row of the first matrix
  2. Select the first column of the second matrix
  3. Multiply each number in the first list by the corresponding number in the second list, and add them up
  4. Place the sum in the first row, first column of the output matrix.
  5. Repeat the process for all combinations of rows and columns

NOTE: the position of the number outputted by the above in the output matrix is whatever row the first matrix is on (m) as the y, and whatever column the second matrix is on (n) being the x.

More efficient matrix multiplication (fastai PartII-Lesson08) | by  bigablecat | AI³ | Theory, Practice, Business | Medium
Matrix Multiplication 🤯
Matrices: Multiplication 04 - Numbas at mathcentre.ac.uk
Matrix Multiplication GIF

There is no such thing as matrix division.

Matrix multiplication is non-commutative, meaning AB ≠ BA.

Maths

What can a matrix be used for?

Linear Transformations

Matrices are best used to describe linear transformations. That means the map a point onto another point. This can be visualised by stretching and/or rotating a plane or space.

A two by two matrix represents a linear transformation which works on a 2D plane, three by three represents a transformation on 3D space etc…

NOTE: AS THESE TRANFORMATIONS ARE LINEAR, THE ORIGIN ALWAYS MAPS ONTO ITSELF

Visualizing Matrix Transformations | R-bloggers
GIF showing basis vectors being modified, transforming the plane

A vector can be mapped into the transformed version of itself by applying the matrix multiplication as shown:

Translated vector = Transformation Matrix * Original Vector

The new vector is called the image.

Solving Simultaneous Equations

Due to the way matrices are multiplied together, matrices are perfect at solving systems of equations! 😁

Take this one for example:

3 unknowns, 3 equations!

You can separate the coefficients from the variables like so:

Notice that if you do the matrix multiplication, the exact same equations are formed

Then, pre-multiply the inverse of the matrix of coefficients, to get a formula giving the values of x, y and z:

Pop that in your calculator to get the values of x, y and z. How easy was that!

Modelling

Matrices are great at modelling things in real life, such as populations.

Most questions will give you some information revolving around the total quantity of something, and how it changes from one time to another.

To solve, find 3 equations which represents this system, and solve them as simultaneous equations using the matrix method.


Identity Matrix

Matrices that are square have a value called the Identity Matrix. The Identity Matrix essentially acts as “1” in matrix multiplication.

What is an identity matrix? - Quora
Identity matrix for 2×2 and 3×3 matrices

You can recognise the identity matrix by the leading diagonal being 1’s and all other items being 0. This matrix does nothing.

Zero Matrix
Intro to zero matrices (article) | Matrices | Khan Academy
0

Figuring out a matrices’ transformation

To figure out what exactly a matrix is doing to the plane, simply imagine the first column and the second column of the matrix as the new position of the (1,0) and (0,1) basis vectors respectively.

How to figure out what a matrix is doing

Matrix rotation

There is a faster way to check if a matrix is rotating: if you see a matrix with signs in the pattern following (they could be the opposite sign):

It is rotating the plane (this might not be the only thing it’s doing). In the case of the matrix above, it applies a rotation counter clockwise to (x, y) by θ degrees.


The Determinant

The determinant is a property of a transformation vector which represents the ratio of the area (or volume) between the original plane (or space) and the transformed plane (or space). So its how much bigger the area/space gets.

For instance the matrix is an enlargement sf 2 around (0, 0), meaning both basis vectors double. This of course increases the area by 4x as the distances are doubling in two directions.

2 by 2 Determinant

You can calculate the determinant of a 2 by 2 matrix with this formula:

The determinant can also be denoted as |A|, like the modulus function
3 by 3 Determinant

To find the determinant of a 3 by 3 matrix:

  1. Multiply one of the three numbers along the first row of the matrix by the 2 by 2 matrix left when taking out the rows and columns corresponding to that number.
  2. Apply the magic signs!
Magic signs!

3. Add them up.

Determinant of 3x3 Matrix - ChiliMath
Formula to get the determinant of a 3 by 3 matrix

Determinants (article) | Khan Academy
Watch as the determinant changes as the area of the translated plane changes

The determinant of a matrix will go negative when the plane has been “flipped” (watch the gif to visualise what this means)

If a matrices’ determinant is 0, it means all of space has been squashed into a lower dimension

If det(A) = 0 the matrix is SINGULAR (no inverse)

If det(A) c 0 the matrix is NON-SINGULAR

You can’t have an inverse of a singular matrix because there is no way to extract area back out from a line with a linear transformation.

The Inverse of a Matrix

The inverse matrix applies the opposite transformation on the plane, undoing the first transformation:

AKA

A matrix times it’s inverse equals the identity matrix

This reads: apply the transformation of matrix A, then apply the transformation of inverse matrix A equals the matrix that represents no change. In this case, A and A^-1 can be swapped as they just do the opposite of on another.

Inverse of 2 by 2 matrix

Use this formula to get the inverse of a 2 by 2 matrix:

Remember to swap the numbers in the matrix in this magical way! 🧙‍♂️
Inverse of 3 by 3 matrix 🥶

First off, the transpose of a matrix is found by flipping the matrix on it’s diagonal:

Getting the transpose of a matrix

Here’s how to get the inverse of matrix A (any non singular 3 by 3 matrix) by hand

  • Find det(A)
  • Construct a matrix of minors of A, to make a 3 by 3 matrix of 2 by 2 matrices
Matrix of minors, pretty large!
  • Get the determinant of every minor matrix to get a new 3 by 3 matrix!
  • Apply the magic signs!
Magic signs!
It’s getting kinda crazy!
  • Transpose the matrix of cofactors!
  • Multiply by 1/det(A)
The final step!
  • DONE

Consistent or Inconsistent?

  • A matrix is consistent when the corresponding system of equations has at least one solution
  • A matrix is inconsistent when the system of equations has zero solutions

This is the most common case, where there is a single set of x, y and z which satisfies all equations. The determinant here is not 0.

How to figure it out:

A flow chart on how to figure out the configuration of a system of three equations

Invariant points and lines

An invariant point is a point unaffected by a transformation.

An invariant line is when each point on a line is transformed to another point on the same line.

ReflectionsRotationsEnlargement
Invariant
Lines
Mirror line and all lines perpendicular.None, unless the angle = 180°, In which case all
lines through (0, 0).
All lines through (0, 0).
Invariant
Points
All points on mirror line.(0, 0)(0, 0)

To find invariant points:

Set the point (x, y) that has the transformation applied equal to the point (x, y). (So the point is the same after the transformation).

Find the invariant points!

Then, expand to get some equations:

This will either give you the equation of a line – in which case there is an entire line of invariant points – or a single value for x and y, if there is only one invariant point.

To find invariant lines:

First, suppose y = mx + c is an invariant line.

Set the matrix up like this:

y is set in terms of x, therefore the relationship between x and y is a line.

After this expansion, keep in mind that x’ and y’ must be on the line y = mx + c.

Get these two equations
Rearrange to this

Now plug these equations into the y = mx + c formula!

Song of the article