Tuesday, January 27, 2015

Linear Algebra - matrix dimensions

A nxm matrix is a rectangular array of numbers in n rows and m columns.
For example:
A 2x3 matrix has two rows and three columns.
A 1x3 matrix is a 3-coordinate vector in horizontal format, just one row with three numbers in it.
A 3x1 matrix is a 3-coordinate vector in vertical format, commonly known as a “column vector.” It is a matrix with a single column and three numbers in it.

For us to be able to add or subtract two matrices, they have to have the exact same dimensions. For example, you can add or subtract a 4x3 matrix with another 4x3 matrix but not with a 4x4, 3x3, 3x4, 4x2, 5x3 or any other type of matrix.

Matrix multiplication has its own, particular requirements on the dimensions of the matrices being multiplied. You can multiply any nxm matrix with any mxk matrix, and the result will be a nxk matrix.
For example:
A 3x2 matrix times a 2x4 matrix will result in a 3x4 matrix.
A 3x2 matrix cannot be multiplied with another 3x2 matrix.
A 3x2 matrix times a 2x3 matrix will result in a 3x3 matrix.
A 3x3 matrix times a 3x3 matrix is again a 3x3 matrix.
A 3x3 matrix times a 3x1 matrix will result in another 3x1 matrix.
A 2x7 matrix times a 7x4 matrix will result in a 2x4 matrix.

Matrix multiplication involves a lot more arithmetic operations than matrix addition, because just to get the number for the entry in the i-th row and j-th column of the product, we have to calculate the dot-product of the i-th row of the first matrix times the j-th column of the second matrix.

All this can be pretty confusing for students when they first read it in a book but after being shown how it’s done in a couple of examples, it becomes clear and then with more practice it becomes easy but it always is a lot of work, and you have to pay close attention to all the little calculations involved because the large number of them makes it easy to make silly mistakes.

No comments: