CoursesAIMathCodePhysicsAbout and FAQ

TwiddleLab / Math / Vectors and Matrices

Two Moves in a Row

Lesson 9 of 12 · 7 min · Free, no account needed

What you will learn

  • Two moves in a row are one move: the product B A means first A, then B.
  • The columns of B A are B applied to the columns of A.
  • Order usually matters: for most pairs B A and A B are different.

Start the lesson

How the lesson goes

  1. Turn a photo, then stretch it. Or stretch it, then turn it. Same photo?

  2. Send the flag through two machines.

    Play. Then Swap the machines and Play again.

  3. Build one machine that does both moves at once.

    The dashed flag went through turn, then stretch. Drag the orange and violet heads onto its dashed arrows.

  4. That one machine is the product of the two.

    The product B A is one matrix for first A, then B. We read it right to left.

    Its columns are B applied to each column of A.

    Usually B A and A B are different: matrix multiplication cares about order.

  5. Find the first column of B A.

    Send A's first column through B.

    Column 1 of B A = B · (1, 2) = 1 · (2, 1) + 2 · (0, 1) = (2, 3).

  6. Does the order matter for these pairs?

    Each card shows both orders. Tap a card, then a bin.

    Turns commute with turns and axis stretches with axis stretches. Mixed pairs like turn and stretch do not.

  7. Game: combo pose. Hit each dashed pose with two moves.

    Tap a first move, then a second move. Order counts.

  8. Programs multiply matrices with three loops inside each other.

    For two 2 by 2 matrices, how many multiplications does the last line do?

    Three nested loops of 2 run 2 × 2 × 2 = 8 times, one multiplication each.

  9. Fill in the product A B.

    A = [[1, 1], [0, 1]], B = [[2, 0], [0, 3]]. First B, then A.

    Columns of A B are A applied to B's columns: (2, 0) and (3, 3).

  10. B A means first A, then B. Swap them and you usually get something else.

    Your last combo, played both ways.

Previous lesson: Read a Matrix by Its Columns · Next lesson: Area Scaling: the Determinant · Part of the course: Vectors and Matrices

Lessons are interactive and need JavaScript. Turn it on to play them.

Loading TwiddleLab