A matrix is just a grid of numbers, arranged in rows and columns. That's really it. Every spreadsheet you've opened, every table of quiz scores, every list of coordinates: you've been looking at matrices the whole time. You just never called them that.
The grid itself isn't the interesting part. The interesting part is what happens once you're allowed to combine two grids: add them, scale one up, or multiply them together into something new. Those three operations are what turn a plain table of numbers into one of the most useful tools in math.
We'll build all three from scratch. By the end, none of them will feel like a rule you memorized.
What actually is a matrix?
Picture a teacher's gradebook. Two students, Amara and Jin, three quizzes each. You'd naturally lay their scores out in a grid: one row per student, one column per quiz.
That grid has 2 rows and 3 columns, so we call it a matrix. Rows first, columns second, always in that order. To point at a single number inside it, we write , where is the row and is the column. Amara's score on Quiz 2 sits at row 1, column 2, so it's .
Hover a cell to see how row and column position pins down exactly one number.
Hover any cell to reveal its row, column, and value.
Notice that the position tells you everything. Move one cell over and you're describing a completely different student and a completely different quiz. That's the whole point of arranging numbers this way instead of just listing them: position carries meaning.
Adding matrices: does it work like you'd guess?
Say the gradebook above was quiz scores from round one, and a second matrix holds bonus points earned in round two. How do you combine them into a final score?
You probably already guessed it: add the numbers that sit in the same position. Top-left plus top-left, top-right plus top-right, and so on.
There's a catch, and it's a strict one. The two matrices have to be the exact same shape. You can't add a matrix to a matrix, because there's no sensible way to match up their positions. Same rows, same columns, or the operation just isn't defined.
Drag a₁₁ and watch: only the matching entry of the sum changes.
Slide around and watch the sum. Only the top-left entry of the result moves. Every other cell stays exactly where it was, because addition never looks outside its own position. Matrix addition is just a lot of ordinary addition, done in parallel, one position at a time.
Scalar multiplication: turning up the volume
Now suppose you want to scale an entire matrix up or down, not combine it with another one. Maybe you're converting every score to a percentage, or doubling every measurement. That's scalar multiplication: one plain number, called a scalar, multiplied into every single entry.
There's no matching-position rule here, because there's only one matrix involved. The scalar just touches every entry, uniformly, like a volume knob turned up on every channel at once.
That "uniformly" part has a nice geometric consequence. If the numbers in a matrix describe the corners of a shape, scaling the matrix stretches the whole shape from the origin, evenly in every direction.
Every vertex moves by the same factor k, all at once.
Push past 1 and the triangle grows. Push it below 0 and it flips through the origin. And notice the area: it doesn't grow at the same rate as . It grows at the rate of , because you're stretching two dimensions at once, not one.
Why does matrix multiplication multiply rows by columns?
This is the operation that trips people up, because the rule sounds arbitrary the first time you hear it: take a row from the first matrix, take a column from the second, multiply matching entries, add them up. Where does that come from?
Here's a scenario where it falls out naturally. Say matrix lists two recipes and how much flour and egg each one needs. Matrix lists the price of flour and egg at two different stores.
What's the total cost of making pancakes at Store X? You take the amount of each ingredient pancakes needs, from row 1 of , and multiply it by that ingredient's price at Store X, from column 1 of . Then you add those costs together. That's a row times a column. It's not an arbitrary rule, it's just "amount times price, summed over every ingredient."
Click a cost cell, or hit play, to watch a row of A pair up with a column of B.
Click a different cell of the cost matrix and the highlighted row and column change with it. Every entry of is its own small cost calculation: one row of recipe amounts, matched up against one column of prices.
There's a dimension rule buried in here too. To multiply a row by a column, they need the same number of entries, or the "amount times price" pairing breaks down. That's why 's number of columns has to match 's number of rows. Get that wrong and the multiplication simply isn't defined, no matter how the outer dimensions look.
The short version
A matrix is a grid of numbers, indexed by row and column. Addition combines two same-shaped matrices position by position. Scalar multiplication scales every entry by the same number, stretching whatever the matrix represents. Matrix multiplication pairs a row from the first matrix with a column from the second, multiplying and summing matching entries, the same arithmetic you'd use to total up a grocery bill.
None of these rules are handed down from nowhere. They're just the natural way to combine grids of numbers that are meant to represent something real.
All visualizations are interactive React components running entirely in your browser. Every animation uses requestAnimationFrame for timing. No libraries beyond React.