#793 – Matrix Multiplication, Part III – Procedure

Once you know that an m x n matrix can be multiplied by an n x p matrix to get a m x p matrix and you know how to multiply a row by a column, you can multiply one matrix by another.

To do the operation, you multiply each row in the the first matrix by each column in the second matrix, using the dot product of two vectors to do the multiplication.  The resulting value is stored in the corresponding row and column of the target matrix, as follows.

Multiplying matrix A by matrix B to get matrix C, row i of matrix A is multiplied by column j of matrix B, to get a result that is stored in row i and column j of matrix C.

For example:

793-001

 

Advertisements

#791 – Matrix Multiplication, Part I – Rows and Columns

To understand how WPF transforms points, it’s useful to know how to multiply two matrices together.

You can multiply one matrix (A) by another matrix (B) if the number of columns in A equals the number of rows in B.  The resulting matrix has the same number of rows as matrix A and the same number of columns as matrix B.

That is–multiplying an m x n matrix by an n x p matrix yields an m x p matrix.

Note: When describing the dimensions of a matrix, the first number refers to the number of rows and the second number refers to the number of columns.

For  example:

  • Multiplying a 2 x 3 matrix by a 3 x 1 matrix yields a 2 x 1 matrix
  • Multiplying a 2 x 2 matrix by a 2 x 1 matrix yields a 2 x 1 matrix
  • Multiplying a 3 x 3 matrix by a 3 x 1 matrix yields a 3 x 1 matrix

791-001