Skip to main content

Command Palette

Search for a command to run...

How I Learned to "See" Math: My Journey into Matrices and Python

Updated
3 min read
How I Learned to "See" Math: My Journey into Matrices and Python

I’ve always heard people talk about Linear Algebra as this scary, and I must admit because, I feel the same way. When I first studied the matrices as the university subject, that was really boring for me.

I was always asked my self why I did learn this, but I didn’t ask that question from LLM, because at the time LLM are not much popular. Today I did it because those days I try to improve my Maths knowledge.

So I started to learn about matrix, but not as the boring theory, instead with some examples in python. I sat down with an AI tutor ( Gemini) , and instead of memorizing boring formulas, I learned how to actually play with the numbers.

Here’s a recap of what I learned, from the basics of grids to editing images with pure math.

1. The Matrix: It’s Just a Spreadsheet

The biggest "Aha!" moment came right at the start. A matrix isn’t magic; it’s just a grid. It’s a way to organize data into Rows (horizontal) and Columns (vertical).

If you have a list of numbers, that’s a vector. If you stack them up, that’s a matrix.

We describe them by their size (Dimensions). A 2 × 3 matrix has 2 rows and 3 columns. Simple, right?

2. The Rules of Engagement

I learned that you can’t just smash two matrices together. There are rules:

  • Addition / Subtract : We can only add or sub matrices if they are the exact same size. It’s like stacking egg cartons—the cups have to line up.

  • Multiplication (The Boss Level): This was tricky! To multiply Matrix A and Matrix B, the columns of the first one must match the rows of the second. And you don’t just multiply numbers; you do a "Row by Column" swipe (the Dot Product).

3. The Magic of Identity

I discovered the Identity Matrix (I). It’s a square grid filled with 0s, but with a diagonal line of 1s down the middle. It acts like the number 1.

If we multiply any matrix by the Identity Matrix, nothing changes. It’s the "neutral" gear of Linear Algebra.

4. Coding It in Python

Theory is nice, but code is better. I fired up Python and used a library called NumPy, here is the notebook that I have tried, feel free to play with it.

https://gist.github.com/zaselalk/19d292a73f93b9f432b0277dd16b2934

5. The Grand Finale: Images ARE Matrices!

This was the coolest part. I learned that every digital photo is just a giant matrix of numbers representing brightness.

I wrote a few lines of Python to generate a 100 x 100 matrix, and when I visualized it, it wasn't just numbers—it was a picture! That was soo cool 😎

My Takeaway

Math isn't just about solving for x. It's the engine behind the images we see, the games we play, and the data we analyze. Today, I stopped looking at matrices as homework and started seeing them as tools.