Matrix Operations
Stack two weekly sales spreadsheets of the same size and you can total them square by square; stack two of clashing sizes and the exact same command, written `week1 + week2` in code, refuses before it adds a single figure.
- ▸Two number grids add only when their frames match exactly; the same six values arranged differently get refused.
- ▸One operation checks no shape at all; another is so picky that swapping the two grids can void the result.
- ▸You can call every result's size and legality by eye, before a single number is multiplied.
Here are two weekly sales spreadsheets, each with three products down the rows and two days across the columns. Add them and you get one combined grid: the Monday figure for the first product is just this week's plus last week's, and the same pairing happens in every other slot. Each cell finds its twin in the exact same position and the two are summed. Nothing crosses over; the top-left only ever meets the top-left.
That is the whole operation, and it comes with one demand. Every slot needs a partner. If the second grid has three days instead of two, some cells in the first grid have nothing to pair with, and the addition is refused before it runs. week1 + week2 works only when both grids carry the exact same frame, identical rows and identical columns. Six numbers laid out as three-by-two and six laid out as two-by-three both hold six values, yet they cannot be added: their slots do not line up.
This is your first shape contract, a rule the two grids must satisfy for the operation to run at all, checked against the frames alone and settled before any arithmetic. Subtraction works the identical way, cell meets matching cell, same demand for identical frames. Get fluent reading that demand off the shapes, because the operations ahead each carry a contract of their own, and no two are quite the same.