Free online matrix calculator for linear algebra: add, subtract, multiply, transpose, find determinant, inverse, powers, and solve Ax=b — with step-by-step results.
A complete linear algebra workbench in the browser. Perform matrix arithmetic (A+B, A−B, A×B with dimension checking), scalar multiplication, transpose, determinant (with full step-by-step expansion for 2×2 and 3×3), inverse via the adjugate method, integer powers using exponentiation by squaring, and solve linear systems Ax = b for invertible square coefficient matrices. Inputs are editable grids from 1×1 up to 5×5, results animate in proper bracket notation, and every output is one click to copy.
A matrix is a rectangular grid of numbers organized into rows and columns. Addition and subtraction operate element-wise and require both matrices to share the same dimensions. Multiplication is more subtle: the entry at row i, column j of A × B equals the dot product of A i-th row with B j-th column, which forces A.cols to equal B.rows. The transpose Aᵀ flips rows and columns. The determinant is a single scalar that captures whether a square matrix is invertible (non-zero) and how it scales volume. This calculator computes determinants by recursive cofactor expansion along the first row.
For an invertible square matrix A, the inverse A⁻¹ satisfies A · A⁻¹ = I. We compute it via the adjugate formula: A⁻¹ = (1/det A) · adj(A). If det(A) is zero the matrix is singular and no inverse exists — the calculator surfaces this with a clear error. Integer powers Aⁿ are computed using exponentiation by squaring, the same O(log n) trick used for modular exponentiation. To solve a square linear system Ax = b, the calculator multiplies x = A⁻¹ · b — fast and exact for the small matrices supported here.
Cofactor-expansion determinants grow factorially: a 5×5 needs 120 base operations, a 6×6 needs 720, a 10×10 would need over three million. While Gaussian elimination scales much better (O(n³)), keeping the input size at 5×5 ensures the tool stays responsive and the step-by-step output stays human-readable. For larger matrices reach for NumPy, MATLAB, Octave, or a CAS like SymPy or Wolfram Alpha — those use optimized BLAS/LAPACK routines that handle thousands of dimensions efficiently.
In general, A × B ≠ B × A. Matrix multiplication is non-commutative for almost all matrices — equality only holds in special cases (e.g. when one is the identity, both are diagonal, or one is a scalar multiple of the other). Order always matters in linear algebra.
A square matrix is non-invertible (singular) exactly when its determinant is zero. Geometrically, this means the matrix collapses space onto a lower-dimensional subspace — its rows or columns are linearly dependent. The calculator returns an error and reports the determinant in this case.
Linear algebra powers computer graphics transforms (rotation, scaling, projection), 3D game engines, machine learning (every neural network layer is a matrix multiply), solving systems of equations in engineering and economics, statistics (covariance matrices, PCA), cryptography (Hill cipher), and quantum mechanics.
Standard matrix multiplication is O(n³), determinant via cofactor expansion is O(n!) (which is why this tool caps at 5×5), and Gauss-Jordan inverse is O(n³). For the 1×1 to 5×5 range here everything runs in microseconds; larger matrices need numerical libraries like NumPy or BLAS.
To compute element (i,j) of the product, you take the dot product of A row i with B column j — they must have the same length. So an m×n matrix can only multiply an n×p matrix, producing an m×p result. The calculator validates this and shows a clear error if dimensions do not match.
Related: matrix calculator, matrix multiplication calculator, determinant calculator, matrix inverse calculator, matrix transpose calculator, linear algebra calculator, matrix addition calculator, matrix subtraction calculator, scalar multiplication matrix, matrix power calculator, solve linear system calculator, Ax=b solver, 3x3 matrix calculator, 4x4 determinant, online matrix solver