Why is linear algebra important?

As a kid I always liked algebra, I found it a lot of fun. Probably the best part about algebra was that I could see it’s utility very clearly in everyday life and that was a driver enough to learn and practice it.

However, in my later years when I came across linear algebra, it was hard for me to understand why I was learning it. I wasn’t able to see the utility so never really paid much attention to it. The operations were easy enough to memorise so I wasn’t really bothered about it.

Once I began looking into machine learning, I saw matrices and linear algebra everywhere which was a bit frightening. I didn’t want to memorise it like the old days so I started researching a bit about linear algebra and why it’s useful.

What is a matrix?

Any data laid out in rows and columns is basically a matrix. Here is a 3×3 matrix.

Remember the movie Matrix? Remember the green text scrolling on the screen? Does it make sense now?

If you look around on the internet, you would possibly see many detailed articles on this topic that use language that might not really make sense to you, like it didn’t for me. I was looking at machine learning code samples here and there while I was also looking into LA. Looking at the practical code and LA simultaneously seemed silly but somewhere along the line, I realised a few things. I may be wrong about all of them but thinking of them this way helped me move forward.

Some points that helped me

  • Data in a table or Excel file is essentially a matrix
  • A photo is basically a matrix of pixels
  • We deal with matrix format in our everyday life. For instance, the receipt showing the name, quantity and price of each item for your grocery shopping is essentially a matrix.
  • For me, it is hard to understand things until I can formulate a rough visual model of them in my head. Maybe the first example I came around when looking at machine learning was estimating house prices from the size of the property. I visualised this in my head as a chart with prices on the Y axis and area on X-axis. I then attempted to add the number of rooms as a price determining factor in the mix, so that became the Z axis. Next, I attempted to add the number of bathrooms in there as well but then I couldn’t visualise it in my head. We, humans, are stuck in a 3D coordinate plane so we can’t visualise anything that has more than 3 dimensions.
  • Our minds limit us when it comes visualising higher dimensions, this is where we turn to Maths for help. Not everything can be intuitive, letting go of this notion helps.
  • Thinking in terms of how the brain works and how the neuron sends data to many other neurons for further processing, it becomes a bit clear that you are kinda dealing with matrices.
  • If you come from a programming background, you deal with multi-dimensional arrays every now and then. I am sure you realise how messy it is to iterate and operate of these types of arrays. Imagine having to multiple 2 of these types of multi-dimensional arrays together. You would likely by writing a few for-loops to make this happen. Pretty messy business!

Linear algebra is specifically helpful (and fast!) in performing transformations and operations on matrices.

Summary

When you are work with data like you do in machine learning, you are basically working with matrices. Linear algebra makes dealing with matrices easier.

Leave a comment