Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

Matrix Multiplication by Rows

How to use
  1. The tab strip above the figure chooses what is on screen. Vector ×\times matrix builds vTA\mathbf{v}^{T}A from the rows of AA; the matrix-by-matrix tab repeats the argument with a matrix in place of the row vector. What the second tab does
  2. Run plays the argument from wherever you are and turns into Pause. The twelve steps are one product each at the start, then one regrouping move at a time. More about the controls
  3. Step advances a single step and Back returns one. The regrouping steps are the ones worth holding still — see lifting out a row.
  4. The Steps pips and the step counter mark the position in the run. A pip is a marker, not a control. What the twelve steps are
  5. Reset returns to step 00, the empty bracket, with the same numbers on screen.
  6. Generate random numbers rolls a fresh AA and v\mathbf{v}. No weight is zero and no row of AA is the zero vector, so every arrow keeps a direction to draw. What the generator enforces
  7. The right panel is the plane picture. Dashed from the origin is a row of AA on its own; the solid arrow is that row scaled by its weight and laid tail to head on the previous one. How to read the plane
  8. The note under the figure is step-specific and says what the picture is claiming at that moment. Where the argument lands
  9. The matrix here is 3×23 \times 2, the transpose of the one on the columns page, so both pages land on the same point in the plane. Putting the vector on the right and putting it on the left are two different products that happen to agree here. Why the shape is three by two

From the definition to the rows

The mirror of the column case. Put vT\textcolor{#b45309}{v^{T}} on the left and fill the vT\textcolor{#b45309}{v^{T}}A\textcolor{#1450c8}{A} bracket one term at a time by the same definition — then read its terms across instead of down. Each horizontal band shares one entry of v\textcolor{#b45309}{v}, and the numbers it multiplies are a row of A\textcolor{#1450c8}{A}.
A\textcolor{#1450c8}{A}, and anything built from itv\textcolor{#b45309}{v}, and the scalars taken from it
vT
213
1×3
A
21-1230
3×2
=
vTA
(vTA)1(vTA)2
1×2
In the plane
510-2246
Nothing computed yet. The plane is empty because not one number of the answer exists.
The bracket on the right is empty. By the definition, entry jj of vT\textcolor{#b45309}{v^{T}}A\textcolor{#1450c8}{A} is v\textcolor{#b45309}{v} paired term by term with column jj of A\textcolor{#1450c8}{A}. Six products in all, one per step — press Run. Nothing is computed yet, and the plane is empty to match. Learn more about the empty bracket
StepsStep0 / 11






What the tool shows

This page puts the vector on the left. That single move changes which part of the matrix is handed over: vTA\mathbf{v}^{T}A is assembled from the rows of AA, with the entries of v\mathbf{v} as the weights.

The figure computes the product exactly as the definition says — entry jj is v\mathbf{v} paired term by term with column jj of AA — and then regroups the same six products a second way. The left panel carries the algebra, the right panel draws the rows as arrows in the plane.

Colour carries one meaning and never two. Blue is AA and anything built from it: its rows, the scaled rows, the pieces of the answer. Amber is v\mathbf{v} and the single numbers taken from it. Navy is site chrome only and never appears inside the figure.

The result is a row vector with one entry per column of AA, which is worth noticing early. A product with the vector on the left does not produce the same kind of object as a product with the vector on the right, even when the numbers happen to coincide.

If the row by column rule itself is still unfamiliar, the matrix multiplication calculator works through it entry by entry first.

The sentence the page argues is: a row vector times a matrix is a weighted sum of the rows of that matrix.

Stepping through vT times A

Twelve steps, in four stretches.

Step 0 is the empty bracket. The plane is empty with it, because no entry of the answer exists yet.

Steps 1 to 6 apply the definition, one product per step. Entry 11 of the answer collects the products that involve column 11 of AA, entry 22 collects those from column 22. Each step multiplies one entry of v\mathbf{v} by one entry of AA and sends the number to its slot.

Steps 7 to 9 regroup. Read the terms across rather than down. The terms sitting in a horizontal band all carry the same entry of v\mathbf{v}, because the definition pairs that entry with every column of AA in turn. What the shared weight multiplies is a row of AA, so the weight steps out in front and the row comes down whole. One row per step.

Steps 10 and 11 state it generally, vTA=v1r1+v2r2+v3r3\mathbf{v}^{T}A = v_1r_1 + v_2r_2 + v_3r_3, and then in numbers.

Work steps 77 to 99 with Step and Back. They contain the entire argument; the first six steps are only bookkeeping.

The empty bracket

Step 00 is worth a moment rather than a click past.

The bracket for vTA\mathbf{v}^{T}A already has its shape — two slots, one per column of AA — before a single number is known. That is the first difference from the columns page, where the slots count rows, and it is the reason the two products are not the same kind of object even when their numbers agree.
510-22468
Step 0, frozen

Axes and nothing else. The bracket for vA already has two slots — one per column of A — but neither holds a number, so there is nothing at all to draw.

The plane is empty for a stricter reason. An arrow needs both coordinates before it can exist, and at step 00 neither does. This is the honest picture of the computation: not a small answer, but no answer.

Reset returns here at any time with the same numbers on screen; Generate random numbers returns here with a fresh pair.

Press Step once and the first product lands — and the plane still cannot show you a vector, which is the subject of one product at a time.

One product at a time

Steps 11 to 66 are the definition and nothing else. Each step multiplies one entry of v\mathbf{v} by one entry of AA and drops the result into its slot.

Six products, because a three-entry row vector against a 3×23 \times 2 matrix gives two entries of three terms each. Entry 11 collects the terms from column 11 of AA, entry 22 those from column 22.
510-22468510-22468
Entry 1 complete, then entry 2, frozen

Above: the first entry is finished, so x is known and the answer lies somewhere on that dashed line. Below: the second entry lands, the two lines cross, and only now is there an arrow. Every step in between was a number, never a vector.

What the plane does during these six steps is the honest part. A dashed vertical line means the first coordinate is known; every point on that line is still a candidate. A dashed horizontal line means the second is known. One line on its own rules nothing in — it only rules things out. Only when both are drawn do they cross at a single point, and only then is there a vector at all.

So this route passes through no intermediate quantity that is itself a vector. It computes numbers, and the answer appears all at once when the last one lands. That is what lifting out a row repairs.

Reading the plane treats the dashed-line stage and the arrow stage side by side.

Reading the plane

The panel on the right draws the same computation twice over, once badly and once well, and the contrast is the point.

During steps 11 to 66 there are dashed lines and no arrow. A line fixes one coordinate of the answer and says nothing about the other; the answer is somewhere on it. When the second line appears the two cross at a point, and only then is there a vector. The route through the definition passes through nothing that is itself a vector.

From step 77 the rows appear. Each row of AA is drawn dashed from the origin — the row as a direction in its own right — and then solid, stretched by its weight and moved so its tail sits at the head of the previous arrow. The dashed direction never moves. A negative weight walks backwards along the same line rather than opening a new one.

The three solid arrows run end to end from the origin to the answer, and every corner is a partial sum of rows, a real vector at every stage.

The rows of a 3×23 \times 2 matrix have two entries each, which is exactly why they can be drawn here at all.

Lifting out a row

Steps 77 to 99 are the argument. Nothing new is multiplied — every product already exists, and only the grouping changes.

Read the terms across rather than down. The terms in one horizontal band all carry the same entry of v\mathbf{v}, because the definition pairs that entry with every column of AA in turn. Lift it out in front and what remains is (ai1,ai2)(a_{i1}, a_{i2}) — row ii of AA, whole.
510-22468r1v1r1
First regrouping step, frozen

Dashed from the origin is row 1 of A on its own. Solid is that same row stretched by v1. The direction is fixed by A; the weight only decides how far along it you travel.

The plane makes the claim visible. Dashed from the origin is the row on its own, a direction belonging to AA. Solid is that same row stretched by its weight and moved so its tail sits on the head of the previous arrow.

The dashed direction never changes. A negative weight walks backwards along the same line rather than opening a new one — the vector supplies amounts, never directions.

This is also the step where the page earns its consequences. A row replaced by a weighted sum of rows is exactly an elementary row operation, which is why row space and row equivalence follows from this picture and not from the definition.

Work these three steps with Step and Back; the controls exist for this.

The statement and the arithmetic

The last two steps say the same thing twice, once in general and once in numbers.

Step 1010 is the sentence

vTA=v1r1+v2r2+v3r3\mathbf{v}^{T}A = v_1r_1 + v_2r_2 + v_3r_3


with rir_i the ii-th row of AA. Step 1111 carries out the arithmetic.
510-22468v1r1v2r2v3r3vᵀA
Steps 10 and 11, frozen

Three scaled rows laid tail to head, ending on vA = (12, 4) — the same point the columns page reaches, because that page uses the transpose of this matrix with the same weights.

Both steps share one figure, because the plane is already complete at step 1010: three scaled rows laid tail to head, ending on the answer. The last step changes the algebra above the picture, not the picture.

The endpoint is (12,4)(12, 4) — the same point the columns page reaches. That is not a coincidence and not a proof that the two products are the same: this page uses the transpose of that page's matrix with the same weights, so the arithmetic is bound to agree. What differs is what the answer *is*: a row vector with one entry per column here, a column vector with one entry per row there. Why the shape is three by two makes that argument properly.

Read the final figure against the dashed-line stage and the gain is clear: same endpoint, same six products, but here every corner along the path is a real vector.

Running the tool

Run plays forward from wherever you are and becomes Pause while it is playing. It advances a little under twice a second — fast enough to show the shape of the argument, too fast to check a step.

Step and Back move exactly one step. These are the ones that matter on steps 77 to 99: a regrouping is a claim, and a claim is easier to check held still.

Reset returns to step 00the empty bracket — without touching the numbers. It restarts the route, not the example.

Generating new numbers

Generate random numbers replaces AA and v\mathbf{v} and returns to step 00. The pair is re-rolled until it is drawable rather than filtered afterwards.

The constraints: no weight is zero, because a zero weight has no arrow to draw; no row of AA is the zero vector, for the same reason; no partial sum sits on the origin; and the result is capped so the plot keeps a readable scale.

These are demands of the picture, not of the algebra. A zero entry in v\mathbf{v} is ordinary and informative — the matching row of AA simply does not take part, and the answer is a combination of the remaining rows. That is the same mechanism that makes a row of zeros in an elimination step harmless.

The axes, tick spacing and plotted range are all computed from the numbers currently on screen, and the figure is measured from its container in real pixels, so a large answer widens the range instead of shrinking the drawing.

Building AB by rows

Swap the row vector for a matrix and the argument survives unchanged.

Write AA as a stack of rows. Then ABAB is the stack of each row of AA applied to BB: row ii of ABAB is row ii of AA times BB, which by the first tab is a weighted sum of the rows of BB, with the entries of that row of AA as the weights.

AB=[a1TBa2TB]AB = \begin{bmatrix} \mathbf{a}_1^{T}B \\ \mathbf{a}_2^{T}B \end{bmatrix}


So the product is built one row at a time, and the matrix that gives up its rows is the one on the right. That is the half of the invariant this page owns: a factor on the left supplies weights and takes rows from its partner.

Colour follows the role, not the letter. In this reading blue marks the rows of BB — the pieces being combined — and amber marks a row of AA, the weights. The product belongs to neither factor and is drawn in navy behind a doubled bracket.

Every product the definition would compute is still computed; only the order of assembly differs.

Why the weight comes out in front

The regrouping is worth writing out once by hand.

By the definition, entry 11 of vTA\mathbf{v}^{T}A is v1a11+v2a21+v3a31v_1a_{11} + v_2a_{21} + v_3a_{31} and entry 22 is v1a12+v2a22+v3a32v_1a_{12} + v_2a_{22} + v_3a_{32}. Set them side by side and read across. The two terms carrying v1v_1 multiply a11a_{11} and a12a_{12} — which is row 11 of AA.

vTA=v1[a11a12]+v2[a21a22]+v3[a31a32]\mathbf{v}^{T}A = v_1\begin{bmatrix} a_{11} & a_{12} \end{bmatrix} + v_2\begin{bmatrix} a_{21} & a_{22} \end{bmatrix} + v_3\begin{bmatrix} a_{31} & a_{32} \end{bmatrix}


The shared factor appears because the definition pairs each entry of v\mathbf{v} with every column of AA in turn, so that entry meets an entire row before it meets anything else.

Nothing has been added to the definition: the same six products stand on both sides of the equals sign. What changed is that the answer is now expressed in objects that survive on their own — rows — rather than in single numbers that only mean something once both are present.

Row space and row equivalence

Because every vTA\mathbf{v}^{T}A is a weighted sum of the rows of AA, the set of all of them is the span of those rows: the row space of AA.

That gives elimination its meaning. Adding a multiple of one row to another, scaling a row by a non-zero number, swapping two rows — each of these replaces a row with a weighted sum of rows, so the new matrix has rows that already lay inside the old row space, and the old rows can be recovered from the new ones. Row operations do not change the row space. Two matrices related by such operations are called row equivalent, and the row space is the thing they share.

This also explains what a row of zeros means at the end of elimination: the rows were not independent, and one of them was already a combination of the others. The count of rows that survive is the rank, and it is the same number the columns produce — but the reason it is the same is not obvious from this side, and is worth meeting separately.

Solving Ax=bA\mathbf{x} = \mathbf{b} by elimination is therefore a sequence of moves that keeps the row space fixed while making the system easier to read.

Why A is three by two

The shape here is not the shape on the columns page, and it cannot be.

Rows of AA have as many entries as AA has columns. Two columns means every row is a pair of numbers, which is a point in the plane and can be drawn as an arrow. A matrix with three columns would have rows living in three dimensions and the plane figure would be gone — which is exactly what happens if the 2×32 \times 3 matrix from the columns page is used here unchanged.

Three rows give three weights to spend, and the vector on the left must have one entry per row of AA, since it supplies one weight per row. That is the dimension rule stated from the row side: weights count rows; the answer counts columns.

The particular matrix on this page is the transpose of the one on the columns page, and the weights are the same, so both pages arrive at the same point (12,4)(12, 4). That coincidence is useful rather than accidental: it shows that the two readings are two decompositions of arithmetic that agrees, not two different answers.

Where this leads

The row reading is the entry point to elimination and everything built on it.

An elementary matrix is the identity with one row operation already performed on it. Multiplying on the left, EAEA, applies that operation to AA — which is only possible because a left factor combines the rows of its partner, exactly as this page argues. Gaussian elimination is then a product of such matrices applied to AA in order, and the factorisations that come out of it, A=LUA = LU among them, are bookkeeping for that product.

The same reading explains why a row of zeros can appear during elimination and why a swap of rows is itself a multiplication rather than a side note.

The mirror of this argument puts the vector on the right, where the matrix hands over its columns instead. That direction leads to span, column space and the question of which right-hand sides are reachable — a different set of questions from the ones elimination answers — and the two readings meet once both factors are matrices.