Algebra • Core Flagship Pillar

Matrix Multiplication Calculator

Multiply $2 \times 2$, $3 \times 3$, $4 \times 4$, and rectangular matrices of arbitrary dimensions, verify inner dimension compatibility, and inspect complete row-by-column dot product mathematical derivations.

|
Last Updated: September 2026
|
Verified Linear Algebra Calculation

Matrix Dimension Configuration (A × B)

Matrix multiplication requires columns of A (c₁) to equal rows of B (r₂).

Dimension Compatibility: Valid Multiplication (A₂ₓ₂ × B₂ₓ₂ = C₂ₓ₂) Inner dims match (2 = 2)
Matrix A 2 x 2
×
Matrix B 2 x 2
=
Result C 2 x 2
∑

Step-by-Step Dot Product Derivation (Row × Column)

Direct Answer & Overview
Verified Educational Guide

How to Multiply Matrices

To multiply an (m × k) matrix A by a (k × n) matrix B, calculate the dot product of each row i of A with each column j of B. The resulting matrix C has dimension (m × n), where entry C(i, j) = Σ A(i, r) · B(r, j) for r = 1 to k. Multiplication is only defined when the number of columns in A equals the number of rows in B.

Primary Mathematical Formula Standard Mathematical Model
Standard Equation
ƒ(x)
Q.E.D.
Ci,j=(A×B)i,j=∑r=1kAi,rBr,j=Ai,1B1,j+Ai,2B2,j+⋯+Ai,kBk,jC_{i,j} = (A \times B)_{i,j} = \sum_{r=1}^k A_{i,r} B_{r,j} = A_{i,1}B_{1,j} + A_{i,2}B_{2,j} + \dots + A_{i,k}B_{k,j}
Evaluated with exact mathematical formulation • Rigorously verified
Exact Formula
Input Parameters
Required
1
Matrix A dimensions (r₁ × c₁) and entry values
2
Matrix B dimensions (r₂ × c₂) and entry values (requiring c₁ = r₂)
Expected Outputs
Calculated
Product Matrix C with dimensions (r₁ × c₂)
Complete element-by-element dot product expansion steps
Worked Numerical Example
Instant Verification
Multiply 2x2 matrices A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]]
→ C11 = 1(5)+2(7) = 19; C12 = 1(6)+2(8) = 22; C21 = 3(5)+4(7) = 43; C22 = 3(6)+4(8) = 50
C = [[19, 22], [43, 50]]

Matrix Product Definition & Row-by-Column Dot Product

In linear algebra, the matrix product of two matrices $A$ and $B$ produces a new matrix $C = AB$ representing the composition of two linear transformations. Rather than multiplying individual corresponding entries, matrix multiplication computes algebraic dot products between the rows of the first matrix and the columns of the second.

Formal Summation Formula
C_{i,j} = Σ (A_{i,k} · B_{k,j}) for k = 1 to n

The entry at row i and column j in the product matrix C equals the sum of the products of each element in Row i of Matrix A with the matching element in Column j of Matrix B.

Dimension Compatibility Rules (Inner vs. Outer Dimensions)

Two matrices can be multiplied together if and only if the number of columns in the first matrix equals the number of rows in the second matrix:

Inner Dimension Rule (Condition)
(m × k) × (k × n)

The inner dimensions (k and k) must be identical. If they differ, the matrix product is mathematically undefined.

Outer Dimension Rule (Result Size)
Result Matrix C = (m × n)

The product matrix inherits the row count of Matrix A (m) and the column count of Matrix B (n).

Fundamental Algebraic Properties of Matrix Multiplication

Non-Commutativity (AB ≠ BA)

Crucial Property

Order matters! In general, A · B ≠ B · A. Changing the factor order alters row-column combinations and often yields matrices of entirely different dimensions.

Associative Property

(AB)C = A(BC)

When multiplying three or more matrices, grouping does not affect the final product: (A · B) · C = A · (B · C).

Distributive Property

A(B + C) = AB + AC

Multiplication distributes over matrix addition from both left and right: A(B + C) = AB + AC and (A + B)C = AC + BC.

Identity Matrix & Product Determinant Rules

The square Identity Matrix ($I$) acts as the multiplicative identity in linear algebra:

Multiplicative Identity
A · I = I · A = A

Multiplying any matrix by a compatible identity matrix preserves the original matrix entries.

Determinant of a Product
det(A · B) = det(A) · det(B)

The determinant of the product of two square matrices equals the product of their individual determinants.

Real-World Applications of Matrix Multiplication

3D Computer Graphics & Gaming

GPUs multiply 4×4 projection and transformation matrices to rotate, scale, translate, and illuminate 3D vertex meshes in real time.

AI & Neural Network Layers

Dense and convolutional neural network layers perform high-throughput matrix multiplications ($Y = WX + b$) to evaluate model features.

Markov Chains & Search Ranking

Google PageRank and transition probability systems repeatedly multiply state vectors by transition matrices to find stationary distributions.

Step-by-Step Worked Numerical Solutions

Example 1: Multiplying 2x2 Matrices Standard 2x2

Problem: Multiply Matrix A = [[1, 2], [3, 4]] by Matrix B = [[5, 6], [7, 8]].

1. C11 = Row 1 of A · Col 1 of B = (1)(5) + (2)(7) = 5 + 14 = 19
2. C12 = Row 1 of A · Col 2 of B = (1)(6) + (2)(8) = 6 + 16 = 22
3. C21 = Row 2 of A · Col 1 of B = (3)(5) + (4)(7) = 15 + 28 = 43
4. C22 = Row 2 of A · Col 2 of B = (3)(6) + (4)(8) = 18 + 32 = 50
Result Matrix C = [[19, 22], [43, 50]]

Common Pitfalls & Mistakes to Avoid

Confusing Matrix Product with Hadamard Product

Do not multiply entries at the same position (A₁₁ · B₁₁). Standard multiplication requires row-by-column dot product summation.

Ignoring Dimension Mismatch Errors

Attempting to multiply an (m × p) by an (r × n) matrix when p ≠ r is strictly undefined. Always check inner dimensions first.

Assuming AB = BA

Never swap matrix order in equations without checking commutativity. In general, AB ≠ BA.

Fact-Checked & Verified • Computational Accuracy Standards
Updated August 2026 • Editorial Policy
Authored By
Sanjay Samanta

Lead Developer & Founder of Basic Math Tools. Specializes in browser-native computational algorithms and applied mathematics.

Reviewed & Verified By
Academic Review Board

Mathematics & curriculum specialists. Audited against standard algebraic and arithmetic principles.

Found an error or have an improvement suggestion? Report a calculation issue

Frequently Asked Questions

How do you multiply two matrices together?
To multiply Matrix A by Matrix B, take the dot product of each row of Matrix A with each column of Matrix B. The entry in row i and column j of the product matrix C is: C(i, j) = A(i, 1)·B(1, j) + A(i, 2)·B(2, j) + ... + A(i, k)·B(k, j).
What are the dimension rules for matrix multiplication?
Matrix multiplication is defined if and only if the number of columns in Matrix A equals the number of rows in Matrix B. If Matrix A has dimensions (m × k) and Matrix B has dimensions (k × n), the resulting product Matrix C has dimensions (m × n).
Why is matrix multiplication non-commutative (AB ≠ BA)?
Unlike regular scalar arithmetic, the order of matrix multiplication matters. In general, AB ≠ BA. Changing the order often results in different dimensions or completely undefined products, and even for square matrices of the same size, row-column combinations produce different values.
What is the Identity Matrix and what happens when you multiply by it?
The Identity Matrix (I) is a square matrix with 1s along the main diagonal and 0s everywhere else. Multiplying any compatible matrix A by the identity matrix leaves A unchanged: A·I = I·A = A, making it the matrix equivalent of the number 1.
How does matrix multiplication differ from element-wise multiplication (Hadamard product)?
Standard matrix multiplication calculates row-by-column algebraic dot products to compose linear transformations. Element-wise multiplication (Hadamard product, denoted A ⊙ B) simply multiplies corresponding entries A(i, j) · B(i, j) together and requires both matrices to have identical dimensions.
How is matrix multiplication used in 3D graphics and AI neural networks?
In 3D game engines and computer animation, 4×4 affine transformation matrices are multiplied to rotate, scale, translate, and project 3D models onto a 2D screen. In artificial intelligence and deep learning, neural network layers perform billions of matrix-vector dot products to process weights and feature representations.