Table of Contents
Matrix multiplication is a fundamental operation in linear algebra, defining how to combine two matrices to produce a third, resultant matrix. This operation is not commutative, meaning the order in which the matrices are multiplied often matters significantly. It is essential for solving systems of linear equations, transforming vectors, and is critical in fields like computer graphics, physics, and machine learning. Mastering this concept requires a precise understanding of dimensions and component-wise calculation, specifically involving the dot product.
The first and most critical rule for performing matrix multiplication is the compatibility requirement: the number of columns in the first matrix (Matrix A) must exactly match the number of rows in the second matrix (Matrix B). If Matrix A is m × n and Matrix B is p × q, the multiplication A × B is only possible if n = p. If this condition is not met, the multiplication is mathematically undefined.
When the matrix multiplication is compatible, the resulting product matrix C will inherit the exterior dimensions: it will have the same number of rows as the first matrix (m) and the same number of columns as the second matrix (q). Each individual value of the resulting matrix is determined by multiplying each row of the first matrix by each column of the second matrix, and then adding the products, which is the definition of the dot product.
Prerequisites for Matrix Multiplication
Before diving into the calculation, we must confirm that the matrices are conformable for multiplication. If Matrix A has dimensions (m × n) and Matrix B has dimensions (p × q), multiplication A × B is only possible if n = p. The resulting matrix, C, will then have dimensions (m × q). Understanding the structure of the input matrices is the first critical step toward successful calculation.
For our detailed demonstration, we will use a common scenario: multiplying a 2×2 matrix by a 2×3 matrix. Since the number of columns in the first matrix (2) matches the number of rows in the second matrix (2), the operation is valid. The final product matrix will therefore be a 2×3 matrix.
Defining the Matrix Dimensions (A x B)
Suppose we begin with Matrix A, a generic matrix of dimensions 2×2. This means Matrix A contains elements indexed by 2 rows and 2 columns, where Aij denotes the element in the i-th row and j-th column.
table {
border-collapse: collapse;
border-spacing: 0;
padding: 0;
}
td.tdleft {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-left: solid 1px #000;
width: 5px;
padding: 0;
}
td.tdreg {
padding: 2px 1px;
text-align: center;
border-bottom: solid 1px #fff;
}
td.tdright {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
width: 5px;
padding: 0;
}
.super_short2 {
max-width: 180px;
margin: 5px auto;
color: blue;
}
| A = |
|
Next, we introduce Matrix B, which has dimensions 2×3. This matrix has 2 rows and 3 columns. Since the inner dimensions match (2 columns in A, 2 rows in B), the product A × B is defined, and the resulting matrix C will possess 2 rows and 3 columns.
table {
border-collapse: collapse;
border-spacing: 0;
padding: 0;
}
td.tdleft {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-left: solid 1px #000;
width: 5px;
padding: 0;
}
td.tdreg {
padding: 2px 1px;
text-align: center;
border-bottom: solid 1px #fff;
}
td.tdright {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
width: 5px;
padding: 0;
}
.short2 {
max-width: 250px;
margin: 5px auto;
color: red;
}
| B = |
|
Step-by-Step Calculation Formula
To compute the element in the i-th row and j-th column of the resulting matrix C (denoted Cij), we must calculate the dot product of the i-th row of A and the j-th column of B. This involves multiplying corresponding elements from the row and column vectors and summing the results.
For our matrices A (2×2) and B (2×3), we will calculate 2 rows × 3 columns = 6 total elements for the resultant matrix C. For example, C11 is found by combining Row 1 of A with Column 1 of B. C12 combines Row 1 of A with Column 2 of B, and so on.
The following visualization shows the expanded formula for the resulting matrix C = A x B:
table {
border-collapse: collapse;
border-spacing: 0;
padding: 0;
}
td.tdleft {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-left: solid 1px #000;
width: 5px;
padding: 0;
}
td.tdreg {
padding: 2px 1px;
text-align: center;
border-bottom: solid 1px #fff;
}
td.tdright {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
width: 5px;
padding: 0;
}
.long{
margin: 5px auto;
color: #000000;
}
.red {
color: red;
}
.blue {
color: blue;
}
| A x B = |
|
As demonstrated by the formula, the resultant matrix C maintains the outer dimensions of the input matrices: 2 rows (from A) and 3 columns (from B), resulting in a 2×3 matrix. Each entry Cij is the sum of products of the corresponding elements from the i-th row of A and the j-th column of B.
The following sections provide concrete examples using real numbers to solidify this concept. We will work through three detailed examples, applying the row-by-column multiplication rule consistently.
Detailed Worked Example 1: C x D
For our first numerical example, we will calculate the product of Matrix C and Matrix D. Matrix C is a 2×2 matrix defined by the following real numbers:
table {
border-collapse: collapse;
border-spacing: 0;
padding: 0;
}
td.tdleft {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-left: solid 1px #000;
width: 5px;
padding: 0;
}
td.tdreg {
padding: 2px 1px;
text-align: center;
border-bottom: solid 1px #fff;
}
td.tdright {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
width: 5px;
padding: 0;
}
.super_short {
max-width: 150px;
margin: 5px auto;
color: #000000;
}
| C = |
|
Matrix D is a 2×3 matrix. The resulting product C x D will be a 2×3 matrix, as required by the outer dimensions.
table {
border-collapse: collapse;
border-spacing: 0;
padding: 0;
}
td.tdleft {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-left: solid 1px #000;
width: 5px;
padding: 0;
}
td.tdreg {
padding: 2px 1px;
text-align: center;
border-bottom: solid 1px #fff;
}
td.tdright {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
width: 5px;
padding: 0;
}
.short {
max-width: 250px;
margin: 5px auto;
color: #000000;
}
| D = |
|
The multiplication step requires us to systematically take the dot product of each row of C against each column of D. For instance, the element C x D at position (Row 1, Column 1) is calculated as (7 * 2) + (5 * 5).
table {
border-collapse: collapse;
border-spacing: 0;
padding: 0;
}
td.tdleft {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-left: solid 1px #000;
width: 5px;
padding: 0;
}
td.tdreg {
padding: 2px 1px;
text-align: center;
border-bottom: solid 1px #fff;
}
td.tdright {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
width: 5px;
padding: 0;
}
.medium {
max-width: 500px;
margin: 5px auto;
color: #000000;
}
.red {
color: red;
}
.blue {
color: blue;
}
| C x D = |
|
Performing the arithmetic for each position yields the final matrix. We calculate the six elements by summing the products shown in the table above:
- (1, 1) Position: (14 + 25) = 39
- (1, 2) Position: (7 + 5) = 12
- (1, 3) Position: (28 + 10) = 38
- (2, 1) Position: (12 + 15) = 27
- (2, 2) Position: (6 + 3) = 9
- (2, 3) Position: (24 + 6) = 30
This results in the following product matrix C x D:
table {
border-collapse: collapse;
border-spacing: 0;
padding: 0;
}
td.tdleft {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-left: solid 1px #000;
width: 5px;
padding: 0;
}
td.tdreg {
padding: 2px 1px;
text-align: center;
border-bottom: solid 1px #fff;
}
td.tdright {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
width: 5px;
padding: 0;
}
.short {
max-width: 250px;
margin: 5px auto;
color: #000000;
}
| C x D = |
|
Detailed Worked Example 2: E x F
This example incorporates negative numbers to illustrate how the rule of row-by-column multiplication remains consistent regardless of the sign of the elements. Matrix E is a 2×2 matrix:
table {
border-collapse: collapse;
border-spacing: 0;
padding: 0;
}
td.tdleft {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-left: solid 1px #000;
width: 5px;
padding: 0;
}
td.tdreg {
padding: 2px 1px;
text-align: center;
border-bottom: solid 1px #fff;
}
td.tdright {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
width: 5px;
padding: 0;
}
.super_short {
max-width: 150px;
margin: 5px auto;
color: #000000;
}
| E = |
|
Matrix F is the 2×3 matrix we will multiply E by. The resulting matrix E x F will also be 2×3.
table {
border-collapse: collapse;
border-spacing: 0;
padding: 0;
}
td.tdleft {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-left: solid 1px #000;
width: 5px;
padding: 0;
}
td.tdreg {
padding: 2px 1px;
text-align: center;
border-bottom: solid 1px #fff;
}
td.tdright {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
width: 5px;
padding: 0;
}
.short {
max-width: 250px;
margin: 5px auto;
color: #000000;
}
| F = |
|
We follow the standard procedure: take the rows of E and perform the dot product against the columns of F. Note how the negative sign is incorporated into the first row calculations.
table {
border-collapse: collapse;
border-spacing: 0;
padding: 0;
}
td.tdleft {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-left: solid 1px #000;
width: 5px;
padding: 0;
}
td.tdreg {
padding: 2px 1px;
text-align: center;
border-bottom: solid 1px #fff;
}
td.tdright {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
width: 5px;
padding: 0;
}
.medium {
max-width: 500px;
margin: 5px auto;
color: #000000;
}
.red {
color: red;
}
.blue {
color: blue;
}
| E x F = |
|
After multiplying the components and summing the products, we obtain the six entries of the resulting matrix multiplication E x F:
- Row 1, Column 1: (-6 + 8) = 2
- Row 1, Column 2: (-12 + 16) = 4
- Row 1, Column 3: (-18 + 24) = 6
- Row 2, Column 1: (27 + 4) = 31
- Row 2, Column 2: (54 + 8) = 62
- Row 2, Column 3: (81 + 12) = 93
This results in the following final product matrix:
table {
border-collapse: collapse;
border-spacing: 0;
padding: 0;
}
td.tdleft {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-left: solid 1px #000;
width: 5px;
padding: 0;
}
td.tdreg {
padding: 2px 1px;
text-align: center;
border-bottom: solid 1px #fff;
}
td.tdright {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
width: 5px;
padding: 0;
}
.short {
max-width: 250px;
margin: 5px auto;
color: #000000;
}
| E x F = |
|
Detailed Worked Example 3: G x H
Our final example utilizes two matrices where the elements are sequential real numbers. Matrix G is a 2×2 matrix:
table {
border-collapse: collapse;
border-spacing: 0;
padding: 0;
}
td.tdleft {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-left: solid 1px #000;
width: 5px;
padding: 0;
}
td.tdreg {
padding: 2px 1px;
text-align: center;
border-bottom: solid 1px #fff;
}
td.tdright {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
width: 5px;
padding: 0;
}
.super_short {
max-width: 150px;
margin: 5px auto;
color: #000000;
}
| G = |
|
Matrix H is a 2×3 matrix. Since G is 2×2 and H is 2×3, the resulting product G x H is a valid 2×3 matrix.
table {
border-collapse: collapse;
border-spacing: 0;
padding: 0;
}
td.tdleft {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-left: solid 1px #000;
width: 5px;
padding: 0;
}
td.tdreg {
padding: 2px 1px;
text-align: center;
border-bottom: solid 1px #fff;
}
td.tdright {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
width: 5px;
padding: 0;
}
.short {
max-width: 250px;
margin: 5px auto;
color: #000000;
}
| H = |
|
To determine the elements of G x H, we apply the row-by-column method, calculating the sum of products for each of the six resulting positions.
table {
border-collapse: collapse;
border-spacing: 0;
padding: 0;
}
td.tdleft {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-left: solid 1px #000;
width: 5px;
padding: 0;
}
td.tdreg {
padding: 2px 1px;
text-align: center;
border-bottom: solid 1px #fff;
}
td.tdright {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
width: 5px;
padding: 0;
}
.medium {
max-width: 500px;
margin: 5px auto;
color: #000000;
}
.red {
color: red;
}
.blue {
color: blue;
}
| G x H = |
|
The final calculated values are obtained by summing the products shown above:
- (1, 1): (2 + 12) = 14
- (1, 2): (4 + 15) = 19
- (1, 3): (6 + 18) = 24
- (2, 1): (4 + 20) = 24
- (2, 2): (8 + 25) = 33
- (2, 3): (12 + 30) = 42
This results in the following final product matrix:
table {
border-collapse: collapse;
border-spacing: 0;
padding: 0;
}
td.tdleft {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-left: solid 1px #000;
width: 5px;
padding: 0;
}
td.tdreg {
padding: 2px 1px;
text-align: center;
border-bottom: solid 1px #fff;
}
td.tdright {
border-top: solid 1px #000;
border-bottom: solid 1px #000;
border-right: solid 1px #000;
width: 5px;
padding: 0;
}
.short {
max-width: 250px;
margin: 5px auto;
color: #000000;
}
| G x H = |
|
Verifying Results with a Matrix Calculator
While the process of matrix multiplication is systematic and straightforward, it is also prone to arithmetic errors, especially when dealing with large matrices or complex real numbers. It is highly recommended to double-check your work if you perform these calculations manually, particularly when working in contexts like academic assessments or programming data manipulation.
A reliable method for confirming your answers is using an online matrix calculator tool. These tools allow you to input the initial matrices and instantly receive the product matrix, confirming both the dimension compatibility and the final numerical values. While there are many matrix calculators available online, a particularly user-friendly resource that simplifies the process is provided by
Math is Fun.
Visual Aid: Video Tutorial on Matrix Multiplication
For visual learners, watching an expert perform the calculations in real-time can significantly enhance comprehension of the row-by-column methodology. The alignment of the rows and columns—and how the dot product is formed—is often clearer when animated and explained verbally.
The following video tutorial provides a detailed walk-through specifically demonstrating how to multiply a 2×2 matrix by a 2×3 matrix, which aligns perfectly with the examples presented throughout this guide.
Cite this article
stats writer (2025). How to Multiply Matrices: A Step-by-Step Guide. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-to-do-matrix-multiplication/
stats writer. "How to Multiply Matrices: A Step-by-Step Guide." PSYCHOLOGICAL SCALES, 31 Dec. 2025, https://scales.arabpsychology.com/stats/how-to-do-matrix-multiplication/.
stats writer. "How to Multiply Matrices: A Step-by-Step Guide." PSYCHOLOGICAL SCALES, 2025. https://scales.arabpsychology.com/stats/how-to-do-matrix-multiplication/.
stats writer (2025) 'How to Multiply Matrices: A Step-by-Step Guide', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-to-do-matrix-multiplication/.
[1] stats writer, "How to Multiply Matrices: A Step-by-Step Guide," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, December, 2025.
stats writer. How to Multiply Matrices: A Step-by-Step Guide. PSYCHOLOGICAL SCALES. 2025;vol(issue):pages.
