Matrix Multiplication
Matrix multiplication or multiplication of matrices is one of the operations that can be performed on matrices in linear algebra. Multiplication of matrix A with matrix B is possible when both the given matrices, A and B are compatible. Matrix multiplication is a binary operation, that gives a matrix from two given matrices.
Matrix multiplication was first introduced in 1812 by French mathematician Jacques Philippe Marie Binet, in order to represent linear maps using matrices. Let us understand the rule for multiplying matrices in the following sections.
What is Matrix Multiplication?
Matrix multiplication is a binary operation whose output is also a matrix when two matrices are multiplied. In linear algebra, the multiplication of matrices is possible only when the matrices are compatible. In general, matrix multiplication, unlike arithmetic multiplication, is not commutative, which means the multiplication of matrix A and B, given as AB, cannot be equal to BA, i.e., AB ≠ BA. Therefore, the order of multiplication for the multiplication of matrices is important.
Two matrices A and B are said to be compatible if the number of columns in A is equal to the number of rows in B. That means if A is a matrix of order m×n and B is a matrix of order n×p, then we can say that matrices A and B are compatible.
Suppose we have two matrices A and B, the multiplication of matrix A with Matrix B can be given as (AB). That means, the resultant matrix for the multiplication of for any m × n matrix 'A' with an n × p matrix 'B', the result can be given as matrix 'C' of the order m × p. Let us understand this concept in detail in the next section.
How to Multiply Matrices?
We can understand the general process of matrix multiplication by the technique, "First rows are multiplied by columns (element by element) and then the rows are filled up. Multiplying matrices can be performed using the following steps:
- Step 1: Make sure that the number of columns in the 1st matrix equals the number of rows in the 2nd matrix (compatibility of matrices).
- Step 2: Multiply the elements of ith row of the first matrix by the elements of jth column in the second matrix and add the products. This would the element that is in the ith row and jth column of the resultant matrix.
- Step 3: Place the added products in the respective positions.
Let us understand these steps for multiplication of matrices better using an example.
Example: Multiply the matrices given below, to find their product of \( \begin{pmatrix}
1 & 2 \\
3 & 4 \\ 5 & 1 \\
\end{pmatrix} \text{and}\begin{pmatrix}
2 \\ \\
4 \\
\end{pmatrix}
\).
Solution: The given matrices are of order 3×2 and 2×1. So the given matrices are compatible, we can perform the matrix multiplication and the product matrix will be of order 3×1.
\(\begin{pmatrix}
1 & 2 \\
3 & 4 \\ 5 & 1 \\
\end{pmatrix}.\begin{pmatrix}
2 \\ \\
4 \\
\end{pmatrix}\\\\
= \begin{pmatrix}
(1\times2)+(2\times4) \\
(3\times2)+(4\times4) \\ (5\times2)+(1\times4) \\
\end{pmatrix} \\\\ = \begin{pmatrix}
2+8 \\
6+16 \\ 10+4 \\
\end{pmatrix}
\\\\
= \begin{pmatrix}
10 \\
22 \\14\\
\end{pmatrix}\)
Hence, the product matrix is \(\begin{pmatrix}
10 \\
22\\14 \\
\end{pmatrix}
\)
In the resultant matrix, we can see that the first element of the first row is obtained by multiplying the elements of the first row of the first matrix by the corresponding elements of the first column of the second matrix and then adding. i.e., in general, to find the element in the ith row and jth column in the product matrix,
- Take the elements of ith row of the first matrix.
- Take the elements of jth column of the second matrix.
- Multiply the corresponding elements.
- Add all the products.
Rules for Matrix Multiplication
As we studied, two matrices can be multiplied only when they are compatible, which means for the multiplication of matrices to exist the number of columns in the first matrix should be equal to the number of rows in the second matrix, in the above case 'n'. If A is a matrix of order m×n and B is a matrix of order n×p, then the order of the product of matrices is m×p.
Examples:
a) Multiplying a 4 × 3 matrix by a 3 × 4 matrix is valid and it gives a matrix of order 4 × 4
b) 7 × 1 matrix and 1 × 2 matrices are compatible; the product gives a 7 × 2 matrix.
c) Multiplication of a 4 × 3 matrix and 2 × 3 matrix is NOT possible.
2x2 Matrix Multiplication Formula
The process is the same for the matrix of any order. We multiply the elements of each row of the first matrix by the elements of each column in the second matrix (element by element) as shown in the image. Finally, we add the products. The result of the product of two 2x2 matrices is again a 2x2 matrix.
3x3 Matrix Multiplication Formula
3x3 Matrix Multiplication can be done using the matrix multiplication formula, as any two 3x3 matrices are compatible. The process is exactly the same for the matrix of any order. The result of the product of two 3x3 matrices is again a 3x3 matrix.
Here, the matrices have the same dimensions, so the resultant matrix also has the same dimension 3×3.
Example:
\(\left(\begin{array}{rrr}
1 & 2 & -1 \\
3 & 2 & 0 \\
-4 & 0 & 2
\end{array}\right)\) \(\left(\begin{array}{rrr}
3 & 4 & 2 \\
0 & 1 & 0 \\
-2 & 0 & 1
\end{array}\right)\)
= \(\left(\begin{array}{rrr}
1(3)+2(0)+(-1)(-2) & 1(4)+2(1)+(-1)0 & 1(2)+2(0)+(-1)(1) \\
3(3)+2(0)+(0)(-2) & 3(4)+2(1)+(0)0 & 3(2)+2(0)+(0)(1) \\
-4(3)+0(0)+(2)(-2) & -4(4)+0(1)+(2)0 & -4(2)+0(0)+(2)(1) \\
\end{array}\right)\)
= \(\left(\begin{array}{rrr}
5 & 6 & 1 \\
9 & 14 & 6 \\
-16& -16 & -6 \\
\end{array}\right)\)
Properties of Matrix Multiplication
There are certain properties of matrix multiplication operation in linear algebra in mathematics. These properties are as given below,
- Non-Commutative: Matrix multiplication is non-commutative, i.e., for multiplication of two matrices A and B, AB ≠ BA.
- Distributivity: The distributive property can be applied while multiplying matrices, i.e., A(B + C) = AB + BC, given that A, B, and C are compatible.
- Product with Scalar: If the product of matrices A and B, AB is defined then, c(AB) = (cA)B = A(Bc), such that c is a scalar.
- Transpose: The transpose of the product of matrices A and B can be given as, (AB)T = BTAT, where T denotes the transpose.
- Complex Conjugate: If A and B are complex entries, then (AB)* = B*A*
- Associativity: Matrix multiplication is associative. Given three matrices A, B and C, such that the products (AB)C and A(BC) are defined, then (AB)C = A(BC).
- Determinant: The determinant of product of matrices is nothing but the product of the determinants of individual matrices. i.e., det (AB) = det A × det B.
Thinking out of the box:
- By using the matrices shown below, check whether matrix multiplication is commutative or not.
\( \begin{pmatrix}
1 & 0 \\ \\
2 & 4 \\
\end{pmatrix} \text{and}\begin{pmatrix}
6 & 8 \\ \\
4 & 3 \\
\end{pmatrix}
\) - Is matrix multiplication associative?
Important Notes on Matrix Multiplication :
- To multiply matrices, the given matrices should be compatible.
- The order of a product matrix can be obtained by the following rule:
If A is a matrix of order m×n and B is a matrix of order n×p, then the order of the product matrix is m×p. - Matrix multiplication indicates rows by columns multiplication.
☛Related Topics:
Examples on Matrix Multiplication
-
Example 1: Using the matrix multiplication formula, find the product of the matrices AB, where
A = \( \begin{pmatrix}
1 & 0 \\ \\
2 & 4 \\
\end{pmatrix} \) and B = \(\begin{pmatrix}
6 & 8 \\ \\
4 & 3 \\
\end{pmatrix}
\).Solution:
The given matrices are of order 2×2. ∵They are compatible, we can find the multiplication of the matrices and their product matrix will also be 2×2.
Product of matrices \( \left(\begin{array}{ll}1 & 0 \\\\ 2 & 4\end{array}\right) \text { and }\left(\begin{array}{ll}6 & 8 \\\\ 4 & 3\end{array}\right) \text { is: }\)
\(\begin{pmatrix}
1 & 0 \\ \\
2 & 4 \\
\end{pmatrix}.\begin{pmatrix}
6 & 8 \\ \\
4 & 3 \\
\end{pmatrix}\\\\
= \begin{pmatrix}
(1\times6)+(0\times4) & (1\times8)+(0\times3) \\ \\
(2\times6)+(4\times4) & (2\times8)+(4\times3) \\
\end{pmatrix} \\\\ = \begin{pmatrix}
6+0 && 8+0 \\ \\
12+16&& 16+12 \\
\end{pmatrix}
\\\\
= \begin{pmatrix}
6 & 8 \\ \\
28& 28 \\
\end{pmatrix}\)Answer: Product matrix is \(\begin{pmatrix}
6 & 8 \\ \\
28 & 28 \\
\end{pmatrix}
\) -
Example 2: For the matrices given in Example 1, find BA. Is AB = BA? Using the result, answer whether the following statement is true: "matrix multiplication is commutative".
Solution:
BA = \(\left(\begin{array}{ll}
6 & 8 \\ \\
4 & 3
\end{array}\right)\) \(\left(\begin{array}{ll}
1 & 0 \\\\
2 & 4
\end{array}\right) \)= \(\left(\begin{array}{ll}
(6\times1+8\times2) & (6\times0 +8\times4) \\ \\
(4\times1+3\times2) & (4\times0+3\times4)
\end{array}\right)\)= \(\left(\begin{array}{ll}
22 & 32 \\\\
10 & 12
\end{array}\right) \)From Example 1, AB ≠ BA.
Answer: We found BA to be \(\left(\begin{array}{ll}
22 & 32 \\\\
10 & 12
\end{array}\right) \) and AB ≠ BA and hence matrix multiplication is not commutative. -
Example 3: Matrix A is of 4×1 order. Matrix B is of 1×3 order. Are both the products AB and BA defined?
Solution:
Matrix A is of order 4×1
Matrix B is of order 1×3The matrix multiplication AB is defined when the number of columns of A is the same as the number of rows of B. Using the multiplication of matrices rule, the product matrix hence obtained is of order 4×3. The product BA is not defined as the number of columns of B is not equal to the number of rows of A. So, we can say that matrix multiplication is not commutative, AB is not necessarily equal to BA and sometimes one of the products may not be defined also.
Answer: Product AB is defined but not BA.
FAQs on Matrix Multiplication
What is Matrix Multiplication in Linear Algebra?
Matrix multiplication is one of the binary operations that can be applied to matrices in linear algebra. To multiply two matrices A and B, the number of columns in matrix A should be equal to the number of rows in matrix B. ⇒AB exists.
How to Multiply Matrices 3x3?
3x3 matrices in mathematics can be multiplied by multiplying the rows of the first matrix are multiplied with the columns of the second matrix to obtain the corresponding elements of the product matrix.
What is the Matrix Multiplication Formula?
The matrix multiplication formula is used to perform the multiplication of matrices in general. For example, for 3x3 matrices, the formula is as follows:
Can you Multiply Matrices of Order 2x3 and 2x2?
No, we cannot multiply a 2x3 and 2x2 matrix because for multiplying matrices, two matrices should be compatible. Since the number of columns in the first matrix(3) is not equal to the number of rows in the second matrix(2), we cannot perform matrix multiplication for this case.
What is the Purpose of Matrix Multiplication?
Matrix multiplication is important for facilitating computations in linear algebra and are used for representing linear maps. It is an important tool in many areas of mathematics, as well as in applied mathematics, statistics, physics, economics, and engineering.
What is the Product of Matrices of Orders 2×1 and 2×2?
No, they can't be multiplied as those matrices are not compatible. The number of columns of the first matrix is not equal to the number of rows of the second matrix.
When is Matrix Multiplication Possible?
Matrix multiplication is possible only if the matrices are compatible i.e., multiplying matrices is valid only if the number of columns of the first matrix is equal to the number of rows of the second matrix.
Is Matrix Multiplication Always Commutative?
Matrix multiplication, unlike arithmetic multiplication, is not commutative. This means that the order of multiplication for matrices matters.
Is Matrix Multiplication Always Defined?
Matrix multiplication is possible only when the matrices are compatible. For the multiplication of matrices to exist the number of columns in the first matrix should be equal to the number of rows in the second matrix
visual curriculum