Matrix Calculator
Add, subtract, multiply, transpose, or find the determinant and inverse of 2×2 and 3×3 matrices — all computed instantly in your browser.
Results from this calculator are estimates provided for general informational purposes only, based on formulas, rates, and standards commonly accepted as of 2026. Figures may differ slightly from other calculators or professional sources due to rounding methods, differing assumptions, or regional regulations, and rules may change over time. Always consult a qualified professional — such as a financial advisor, healthcare provider, or other relevant specialist — before making decisions based on these results.
Matrix A
Matrix B
Result
Result heatmap — darker blue is a larger positive value, darker orange is a larger negative value
What is a Matrix Calculator?
A matrix is a rectangular grid of numbers used to represent linear transformations, systems of equations, and data transformations in mathematics, physics, computer graphics, and machine learning. This calculator performs the core matrix operations — addition, subtraction, multiplication, scalar multiplication, transpose, determinant, and inverse — on 2×2 and 3×3 matrices, showing the full step-by-step numeric result.
Matrix operations follow specific rules that differ from ordinary arithmetic — most notably, matrix multiplication is not commutative (A × B usually does not equal B × A), and only square matrices with a nonzero determinant have an inverse. This calculator computes both A × B and B × A separately so you can see how they differ.
Matrix Addition and Subtraction
Addition and subtraction work element by element — the matrices must be the same size, and each entry in the result is the sum (or difference) of the corresponding entries:
Matrix Multiplication
Matrix multiplication is not element-by-element — each entry of the result is the dot product of a row from the first matrix and a column from the second:
Because of this row-times-column structure, matrix multiplication is generally not commutative: A × B ≠ B × A in most cases, even when both products are defined (as they always are for two square matrices of the same size).
Determinant
The determinant is a single number computed from a square matrix that reveals key properties — including whether the matrix is invertible. For a 2×2 matrix:
For a 3×3 matrix, the determinant is computed by cofactor expansion along the first row, which reduces to three 2×2 determinants. A determinant of zero means the matrix is "singular" — it has no inverse, and represents a transformation that collapses space into a lower dimension.
Inverse
A matrix's inverse, written A⁻¹, is the matrix that "undoes" A: multiplying A by its inverse (in either order) produces the identity matrix. The inverse only exists when the determinant is nonzero:
where adj(A) is the adjugate (the transpose of the matrix of cofactors). Matrix inverses are central to solving systems of linear equations: if Ax = b, then x = A⁻¹b.
Worked Example — 2×2 Multiplication
Let A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]]. Then A × B = [[1×5+2×7, 1×6+2×8], [3×5+4×7, 3×6+4×8]] = [[19, 22], [43, 50]]. Notice B × A = [[23, 34], [31, 46]] — a completely different result, confirming multiplication order matters.
Frequently Asked Questions
Why doesn't A × B equal B × A?
Matrix multiplication combines rows of the first matrix with columns of the second in a specific order — swapping the order pairs different rows with different columns, generally producing a different result. This is one of the biggest conceptual differences between matrix algebra and ordinary number arithmetic.
What does it mean if the determinant is zero?
A zero determinant means the matrix is "singular" — it has no inverse, and the linear transformation it represents squashes space into a lower dimension (for example, a 2D transformation that flattens everything onto a single line).
What is the transpose used for?
The transpose flips a matrix over its diagonal, turning rows into columns. It's used constantly in linear algebra — for example, to compute dot products between matrices, check whether a matrix is symmetric (A = Aᵀ), or in the normal equations for least-squares regression.
Can this calculator handle non-square or larger matrices?
This calculator supports square 2×2 and 3×3 matrices, which cover the most common classroom and introductory use cases. Larger or non-square matrices require more general-purpose linear algebra software (such as a computer algebra system or a numerical library like NumPy).