On the side we have a sample matrix multiplication. Here AA is a 2×22 \times 2 matrix, and B is a 2×32 \times 3 matrix (rows ×\times columns). Matrices only multiply when the rows of the first match up with the columns of the second. The number of rows is given by the number of rows in the left matrix, and the number of columns is given by the number of columns in the right matrix. Succinctly, we have that

(m×n)(n×p)m×p(m \times n)(n \times p) \Rightarrow m \times p

Here, we have a 2×2\cone{2} \times \ctwo{2} matrix times a 2×3\ctwo{2} \times \cthree{3} matrix, which gives us a 2×3\cone{2} \times \cthree{3} matrix. Note that BABA isn't even a valid multiplication, because BB has 3 values per row but AA has 2 values per column. Matrix multiplication is not commutative! (It is associative: ABC=(AB)C=A(BC)ABC = (AB)C = A(BC).)

If this is new to you, take a second to look at what's being multiplied by what. To get the cell at row ii and column jj of the output, we take row ii from AA and column jj from BB, multiply them together pairwise, and then sum them up.

If we think of matrices as transformations, like the Fibonacci stepping, then the shape of the matrix tells us how many values it takes in and how many it spits out. BB is a 2×32 \times 3 matrix, so it can be multiplied by a 3×13 \times 1 list of numbers to get a 2×12 \times 1 of outputs: it takes three inputs and gives you two back. The recurrence F(n+1)=F(n)+F(n1)F(n + 1) = F(n) + F(n - 1) is represented by (11)\begin{pmatrix} 1 & 1 \end{pmatrix}, a 1×21 \times 2 matrix. The full version that gives you F(n+1)F(n + 1) and F(n)F(n) is just this row stacked on top of another row describing how we get F(n)F(n).

On the side we have a sample matrix multiplication. Here AA is a 2×22 \times 2 matrix, and B is a 2×32 \times 3 matrix (rows ×\times columns). Matrices only multiply when the rows of the first match up with the columns of the second. The number of rows is given by the number of rows in the left matrix, and the number of columns is given by the number of columns in the right matrix. Succinctly, we have that

(m×n)(n×p)m×p(m \times n)(n \times p) \Rightarrow m \times p

Here, we have a 2×2\cone{2} \times \ctwo{2} matrix times a 2×3\ctwo{2} \times \cthree{3} matrix, which gives us a 2×3\cone{2} \times \cthree{3} matrix. Note that BABA isn't even a valid multiplication, because BB has 3 values per row but AA has 2 values per column. Matrix multiplication is not commutative! (It is associative: ABC=(AB)C=A(BC)ABC = (AB)C = A(BC).)

If this is new to you, take a second to look at what's being multiplied by what. To get the cell at row ii and column jj of the output, we take row ii from AA and column jj from BB, multiply them together pairwise, and then sum them up.

If we think of matrices as transformations, like the Fibonacci stepping, then the shape of the matrix tells us how many values it takes in and how many it spits out. BB is a 2×32 \times 3 matrix, so it can be multiplied by a 3×13 \times 1 list of numbers to get a 2×12 \times 1 of outputs: it takes three inputs and gives you two back. The recurrence F(n+1)=F(n)+F(n1)F(n + 1) = F(n) + F(n - 1) is represented by (11)\begin{pmatrix} 1 & 1 \end{pmatrix}, a 1×21 \times 2 matrix. The full version that gives you F(n+1)F(n + 1) and F(n)F(n) is just this row stacked on top of another row describing how we get F(n)F(n).