A row meets a column
Suppose an arrow goes one unit right and two units up from the origin, the point we count from. Its tip has coordinates . Now apply one rule to every point of the plane at once. How can a small table of numbers tell us where the arrow ends up?
The matrices and linear transformations page records the new positions of and in two columns. This table is a matrix. A vector is a combination of those two basic directions, so the columns also determine its new position. Each multiplication and addition here must correspond to part of that combination. With two matrices, the question remains: where does each basic direction finally go?
01What does a matrix move?
The arrow becomes , the first column. The arrow becomes , the second. is the identity matrix: its columns leave the two arrows where they were.
Here a vector tells us how far to move horizontally and vertically. We draw it as an arrow from the origin. Starting at the origin, reaches the point with coordinates . Here is the horizontal amount and the vertical amount. Positive amounts go right or up; negative amounts go left or down. We can build it in two parts: and . Adding gives .We now use a rule that preserves these combinations: keep the two multipliers and replace the basic arrows with their new positions. Such a rule is called a linear transformation. The columns tell us those positions. A negative multiplier reverses an arrow; a fraction takes that fraction of its length.
With and , the recipe gives : one copy of the first column and two of the second.
First scale the columns: and . Then add: .
02Why columns, not rows?
Let us name the four entries and write the input vertically:The bold symbol names the whole vector; plain and name its two components. Writing the entries vertically makes it a column vector. Turning the column into a row is called taking its transpose, written .Why use the columns of ? We chose to put the two new basic arrows in its columns and to write the input as a column. Keeping the same multipliers therefore gives:
Multiply each column by its coefficient. Adding the matching components of those two results gives the output. We can write out both operations.
Each multiplier acts on both entries of its column.
Add matching components: the first components give , and the second give . Thus
Look at the first output, . It pairs with , the first row of . The second output, , pairs the same with , the second row.Multiplying matching entries and adding the products is called a dot product. For example, . If the two pairs of entries are and , we write . This gives another way to calculate the column combination we just derived. The dot product also has a geometric interpretation; we only need its calculation here.
The sizes must match: if has two columns, must have two entries. A matrix times a three-entry vector is not defined; there is no third column to take.
03Lift x above A
We will calculate using the same matrix and input as before. The two output entries are and , counted from the top.Press Play, or use the arrows and the step slider to inspect one step. The blue-green numbers belong to the input vector, labelled ; the other numbers come from . The original vector rises and opens into a row above . Each component meets an entry of the highlighted row, with a multiplication sign between them. Both numbers move together and become their product. The two products then move together, become their sum, and travel into the output.Before the next row, the input vector returns so we can use it again. Each row stays in its original position until its entries merge. The consumed matrix entries return when both outputs are complete. Pause freezes the movement; the arrows and slider show the end of each separate step. Moving and transposing numbers here is a way to inspect the calculation; the original product is still a matrix times a column vector.
The first row gives . The second gives . Reading the two sums from top to bottom gives .
04The row on the left: xA
What if the vector is on the left? For our matrix, a column on the left would not fit: its one column cannot match the two rows of . In this section, we use the same two numbers in a row instead. We now let name that row vector.Take its entries one at a time. The first entry multiplies the first row of , and the second multiplies the second row. Then add the two rows:The first output pairs with the first column ; the second pairs them with the second column . So we can again calculate dot products. The output is a row because we added two rows of the same length.Call the output row . The subscripts count its entries from left to right.
In this animation, the input row turns into a column and moves beside each column of . Matching entries meet from left and right. Each column of stays in place until its entries merge. The products merge vertically, and their sum moves down into the output row. The input returns for the next column; the original matrix and row vector return at the end. This temporary turn only shows the pairs: the input in the original multiplication is still a row. The original multiplication remains a row vector times a matrix. The sums are and , so the output row is .So far, a matrix on the left gives one sum for each of its rows; a matrix on the right gives one sum for each of its columns. We can now combine these two readings for two matrices.
05Matrix times matrix
Let have rows and columns, and have rows and columns. We write their product as .First take row 1 of as a row vector. As we just saw, multiplying it by gives one output for each column of . These numbers form row 1 of . Repeat for each of the rows of : has rows and columns.To find just one entry, choose its row number and column number . We write this entry as . Row of supplies the row of the answer; column of supplies its position within that row. Multiply the matching entries and add:
The large symbol means add all the terms. The index counts matching positions, from to . Written out, the same formula is:If , there is only the first product.For example, uses row 2 of and column 1 of . Row 2 determines the output row; column 1 picks its first entry.We can also read by columns. Treat column of as one column vector. Multiplying by it gives one output for each row of , exactly column of . Repeating for every column builds the same matrix.Why must the inner sizes match? Each column of has entries, one multiplier for each of the columns of . If those counts differ, at least one entry has no partner. In a row dot product, it is the same missing pair.
The two inner counts must agree. The outer counts give the output shape. For example, a matrix times a matrix gives a matrix.Order also matters when both products are defined. In our example, , but . One unequal entry is enough to show . This is why matrix multiplication is not commutative in general.
