A matrix is just a table of numbers arranged in a rectangle. Even though it's just a table, you can define operations on it like addition, subtraction, and multiplication β and remarkably, multiplication gives a different result if you swap the order. Try filling in the cells yourself to see it.
A matrix is a table that organizes numbers into horizontal lines (rows) and vertical lines (columns). If it has m rows and n columns, it's called an "mΓn matrix," and the number sitting in row i, column j is called the (i,j) entry of that matrix.
Adding and subtracting matrices is intuitive β you just calculate position by position, using the numbers in the same spot. But multiplication is defined differently β and unlike ordinary number multiplication, this multiplication gives a different result if you swap the order (AB β BA). Try each one hands-on below to see for yourself.
Use the buttons to change how many rows (horizontal lines) and columns (vertical lines) the table below has, and type numbers directly into the cells. Click any cell to see which row and column it's in.
Two matrices A and B need to be the same size to add or subtract them (calculated position by position). Use the slider for k to decide how many times to scale A.
A is an mΓn matrix, B is a pΓq matrix. To calculate AB, the number of columns in A (n) must equal the number of rows in B (p). Try changing the sizes freely and see when multiplication is defined.
This time, compare AB and BA side by side using two square matrices (matrices with the same number of rows and columns), A and B. Number multiplication gives the same result either way (3Γ5=5Γ3), but matrix multiplication usually doesn't.
A matrix that marks 1 if there's a direct route between cities A, B, and C, and 0 if there isn't, is called an adjacency matrix. Use the buttons below to turn routes on and off, and see what MΒ² β the adjacency matrix M multiplied by itself β actually means.