Debug

# Matrix Multiplication

How to multiply two matrices

Matrix multiplication falls into two general categories:

1. Scalar: in which a single number is multiplied with every entry of a matrix.
2. Multiplication of one matrix by second matrix.

For the rest of the page, matrix multiplication will refer to this second category.

### Part I. Scalar Matrix Multiplication

In the scalar variety, every entry is multiplied by a number, called a scalar. In the following example, the scalar value is $$\blue 3$$.

$\blue 3 \begin{bmatrix} 5 & 2 & 11 \\ 9 & 4 & 14 \\ \end{bmatrix} = \begin{bmatrix} \blue 3 \cdot 5 & \blue 3 \cdot 2 & \blue 3 \cdot 11 \\ \blue 3 \cdot 9 & \blue 3 \cdot 4 & \blue 3 \cdot 14 \\ \end{bmatrix} \\ = \begin{bmatrix} 15 & 6 & 33 \\ 27 & 12 & 42 \\ \end{bmatrix}$

Multiply the matrix below by $$2$$

Can you figure out the answer to the scalar multiplication problem below? (hint: just multiply every entry by $$2$$)

#### When can you multiply one matrix by another matrix?

You can multiply two matrices if, and only if, the number of columns in the first matrix equals the number of rows in the second matrix. (Link on columns vs rows )

In the picture above , the matrices can be multiplied since the number of columns in the 1st one, matrix A, equals the number of rows in the 2nd, matrix B.

### Two Matrices that can not be multiplied

Matrix A and B below cannot be multiplied together because the number of columns in A $$\ne$$ the number of rows in B. In this case, the multiplication of these two matrices is not defined.

Another example of 2 matrices you can not multiply

Matrix C and D below cannot be multiplied.

#### Can the 2 matrices below be multiplied?

No

Since the number of columns in Matrix A does not equal the number of rows in Matrix B.

The multiplication of A and B is undefined.

#### So, what are the dimensions of the product matrix?

The product matrix's dimensions are (rows of first matrix) × (columns of the second matrix).

#### OK, so how do we multiply two matrices?

In order to multiply matrices,

• Step 1: Make sure that the the number of columns in the 1st one equals the number of rows in the 2nd one. (The pre-requisite to be able to multiply)
• Step 2: Multiply the elements of each row of the first matrix by the elements of each column in the second matrix.
• Step 3: Add the products.

It's easier to understand these steps, if you go through interactive demonstrations below.