Matrix Multiplication Calculator – Guide & Formulas
Multiply two matrices instantly with detailed step-by-step results. Validates dimensions and shows row-by-column dot product calculations.
The Matrix Multiplication Calculator computes the product of two matrices using the standard row-by-column dot product method. Enter your matrices, and the calculator validates dimension compatibility, performs the multiplication, and shows each step of the calculation.
Key Takeaway
Use the free Matrix Multiplication Calculator to multiply two matrices instantly with detailed step-by-step results. validates dimensions and shows row-by-column dot product calculations. Get instant results with step-by-step explanations.
How to Use the Matrix Multiplication Calculator
- Enter the dimensions for Matrix A (m × p).
- Enter the dimensions for Matrix B (p × n). The number of columns in A must equal the rows in B.
- Enter all elements for both matrices.
- Click "Calculate" to compute the matrix product.
- Review the result matrix and step-by-step dot product calculations.
The Formula
Variable Definitions
- A: First matrix of size m × p
- B: Second matrix of size p × n
- AB: Result matrix of size m × n
- i: Row index of the result matrix
- j: Column index of the result matrix
- k: Summation index running from 1 to p
Example: 2×2 Matrix Multiplication
Multiply A = [[1, 2], [3, 4]] by B = [[5, 6], [7, 8]].
- Step 1: Verify dimensions: A is 2×2, B is 2×2. Result will be 2×2.
- Step 2: Compute (1,1): 1×5 + 2×7 = 5 + 14 = 19.
- Step 3: Compute (1,2): 1×6 + 2×8 = 6 + 16 = 22.
- Step 4: Compute (2,1): 3×5 + 4×7 = 15 + 28 = 43.
- Step 5: Compute (2,2): 3×6 + 4×8 = 18 + 32 = 50.
- Step 6: Result = [[19, 22], [43, 50]].
Frequently Asked Questions
What is matrix multiplication?
Matrix multiplication is an operation that produces a new matrix from two input matrices. Each element of the result is the dot product of a row from the first matrix and a column from the second matrix. It is fundamentally different from element-wise multiplication.
What are the rules for matrix multiplication dimensions?
For the product AB to be defined, the number of columns in A must equal the number of rows in B. If A is m × p and B is p × n, the result AB is an m × n matrix. If the dimensions do not match, multiplication is undefined.
Is matrix multiplication commutative?
No, matrix multiplication is generally NOT commutative: AB ≠ BA in most cases. The order of multiplication matters. In some special cases (like when both matrices are diagonal), commutativity may hold.
Is matrix multiplication associative?
Yes, matrix multiplication is associative: (AB)C = A(BC) for any compatible matrices A, B, and C. This means you can group multiplications in any order without changing the result.
Is matrix multiplication distributive?
Yes, matrix multiplication distributes over addition: A(B + C) = AB + AC and (A + B)C = AC + BC. However, the order of multiplication must be preserved due to non-commutativity.
What is the identity matrix in multiplication?
The identity matrix I acts as the multiplicative identity: AI = IA = A for any compatible matrix A. The identity matrix has 1s on the diagonal and 0s elsewhere.
What is the dot product in matrix multiplication?
The dot product is the sum of element-wise products of two vectors. In matrix multiplication, element (i,j) of the result is the dot product of row i from the first matrix and column j from the second matrix.
How do I multiply a 2×2 matrix by a 2×2 matrix?
For A = [[a,b],[c,d]] and B = [[e,f],[g,h]], the product is AB = [[ae+bg, af+bh], [ce+dg, cf+dh]]. Each element is the dot product of the corresponding row and column.
What happens if the dimensions are incompatible?
If the number of columns in A does not equal the number of rows in B, matrix multiplication is undefined. The calculator will display an error message indicating dimension mismatch.
Can I multiply a matrix by a vector?
Yes, a vector can be treated as a matrix with one column (or one row). Multiplying an m × n matrix by an n × 1 column vector produces an m × 1 column vector.
What is the computational complexity of matrix multiplication?
The standard algorithm has O(m × n × p) complexity for multiplying an m × p matrix by a p × n matrix. Optimized algorithms like Strassen's reduce this to approximately O(n^2.807) for square matrices.
What is the Hadamard product vs matrix multiplication?
The Hadamard (element-wise) product multiplies corresponding elements and requires identical dimensions. Standard matrix multiplication uses row-column dot products and requires compatible (but not necessarily identical) dimensions.
How does matrix multiplication relate to linear transformations?
Matrix multiplication corresponds to composition of linear transformations. If A transforms space and then B transforms it, the combined transformation is BA (applied right to left).
Can I multiply more than two matrices?
Yes, you can multiply any number of matrices sequentially, as long as adjacent matrices have compatible dimensions. Due to associativity, the grouping does not matter, but the order does.
What is the transpose of a product?
The transpose of a product equals the product of the transposes in reverse order: (AB)ᵀ = BᵀAᵀ. This is a key property used in many matrix algebra proofs.
What is the inverse of a product?
The inverse of a product equals the product of the inverses in reverse order: (AB)⁻¹ = B⁻¹A⁻¹, provided both A and B are invertible.
How is matrix multiplication used in computer graphics?
Matrix multiplication combines transformations like rotation, scaling, and translation. A single matrix can encode multiple transformations, and multiplying them applies all transformations efficiently.
What is the difference between matrix and scalar multiplication?
Scalar multiplication multiplies every element by a single number. Matrix multiplication combines rows and columns using dot products, producing a result that depends on the structure of both matrices.
Can I use matrix multiplication in programming?
Yes, matrix multiplication is available in most linear algebra libraries. In NumPy: A @ B or np.dot(A, B). In JavaScript, you need nested loops or a library like math.js.
What is matrix power?
Matrix power Aⁿ means multiplying A by itself n times: A³ = A × A × A. For n = 0, A⁰ = I (identity matrix). For n = −1, A⁻¹ is the inverse matrix.