Current Location  >  Math Formulas > Linear Algebra > Matrix Multiplication

# Matrix Multiplication

We can only multiply two matrices if their dimensions are compatible, which means the number of columns in the first matrix is the same as the number of rows in the second matrix.

If A = [a i j] is an m × n matrix and B = [b i j] is an n × p matrix, the product AB is an m × p matrix.

AB = [c i j], where c i j = a i1 b 1 j + a i 2 b 2 j+ … + a in bn j.

(The entry in the i th row and j th column is denoted by the double subscript notation a i j , b i j , and c i j . For instance, the entry a 23 is the entry in the second row and third column.)

The definition of matrix multiplication indicates a row-by-column multiplication, where the entries in the ith row of A are multiplied by the corresponding entries in the jth column of B and then adding the results.

Matrix multiplication is NOT commutative. If neither A nor B is an identity matrix, ABBA.

How to multiply a Row by a Column?
We'll start by showing how to multiply a 1 × n matrix by an n × 1 matrix. The first is just a single row, and the second is a single column. By the rule above, the product is a 1 × 1 matrix; in other words, a single number.

First, let's name the entries in the row r1, r2, ..., rn, and the entries in the column c1, c2, ..., cn. Then the product of the row and the column is the 1 × 1 matrix
[r1c1 + r2c2 + ... + rncn].

Example 1: Multiply Solution: Here, the number of columns in the first matrix is the same as the number of rows in the second matrix. Hence the dimension of the resultant matrix would be 2 × 2.

To start with, we'll concentrate on working out the first element of the resultant matrix, element a11. (That's the element in the first row and the first column of the resultant matrix.) The first thing to do is to multiply the 0 in the first matrix by the 3 in the second matrix. Then, moving across the top row in the first matrix and down the first column in the second matrix, we multiply the -1 by the 1.Then, moving across the top row in the first matrix and down the first column in the second matrix, we multiply 2 by 6.Finally we add the results of those three multiplications to get the element a11 in the result matrix.

That gives 0 × 3 + (– 1×1) + 2 × 6 = 0 – 1 + 12 = 11. So the element a11 in the result matrix is 11.

In the same fashion, we get:
a12 = 0 × (– 1) + (– 1 × 2) + 2 ×1 = – 2 + 2 = 0
a21 = 4 × 3 + 11 × 1 + 2 × 6 = 12 + 11 + 12 = 35
a22 = 4 × (–1) + 11 × 2 + 2 × 1 = –4 + 22 + 2 = 20
Hence the resultant matrix is Example 2: Multiply these matrices: Solution: Here, the dimension of both the matrices is same, so the resultant matrix will also have the same dimension. Example 3: What is the resultant of ?
Solution: Here, the number of columns in the first matrix is the same as the number of rows in the second matrix. Hence the dimension of the resultant matrix would be 2 × 1. Web-Formulas.com © 2020 | Contact us | Terms of Use | Privacy Policy |  