Matrix Calculator
Add, subtract or multiply two matrices — enter each as rows separated by semicolons and columns by commas, and get the result matrix instantly.
How it works
Add/Subtract: (A ± B)ᵢⱼ = Aᵢⱼ ± Bᵢⱼ · Multiply: (A · B)ᵢⱼ = Σₖ Aᵢₖ · Bₖⱼ
Addition and subtraction are element-by-element, so both matrices must be exactly the same shape. Multiplication is different: each entry of the product is the dot product of a row of A with a column of B, which is only possible when the number of columns in A equals the number of rows in B. The result then takes A’s row count and B’s column count. Matrix multiplication is not commutative — A × B rarely equals B × A.
Worked example
Multiply A = [1, 2; 3, 4] by B = [5, 6; 7, 8]. Top-left entry is the first row of A dotted with the first column of B: 1×5 + 2×7 = 19. Continuing, 1×6 + 2×8 = 22, 3×5 + 4×7 = 43, 3×6 + 4×8 = 50, giving [19, 22; 43, 50].
Sources: Matrix multiplication — Wikipedia
Frequently asked questions
Why can’t I multiply any two matrices?
The inner dimensions must match: an m×n matrix can only multiply an n×p matrix, because each product entry is a row of the first dotted with a column of the second, and those must have the same length. The result is m×p.
How do I enter a matrix here?
Separate rows with a semicolon and columns with a comma. For example "1, 2; 3, 4" is the 2×2 matrix with first row 1, 2 and second row 3, 4. Spaces are also accepted between numbers.
Is A × B the same as B × A?
Almost never. Matrix multiplication is not commutative — swapping the order usually changes the result, and may not even be defined if the shapes no longer line up. Order matters throughout linear algebra.
Related calculators
This calculator is for educational purposes. Double-check important results before acting on them.