Skip to content
Toolcroft

Math Calculators

Matrix Calculator - Add, Multiply, Inverse, Determinant & More

Perform matrix operations online: addition, subtraction, multiplication, scalar multiply, transpose, determinant, inverse, rank, and trace. Supports up to 10×10 matrices with step-by-step solutions.

Matrix A
Rows
Cols

A (3×3)

Matrix B
Rows
Cols

B (3×3)

Result

000
000
000

Matrix operations reference

Matrices are rectangular arrays of numbers that represent linear transformations. The calculator supports all standard matrix operations: addition and subtraction (element-wise, requires same dimensions), matrix multiplication (inner dimensions must match), transpose (flip rows and columns), scalar multiplication, and the square-matrix-only operations (determinant, inverse, rank, and trace).

Determinant and cofactor expansion

The determinant of a square matrix is a scalar value that encodes how the linear transformation scales areas (2D) or volumes (3D). For matrices up to 4×4, this calculator uses cofactor expansion (Laplace expansion) along the first row and shows each step. For larger matrices, it uses LU decomposition with partial pivoting.

Matrix inverse via Gauss-Jordan elimination

A square matrix A is invertible if and only if det(A) ≠ 0. The inverse A⁻¹ satisfies A × A⁻¹ = I. This calculator finds A⁻¹ using Gauss-Jordan elimination: it augments A with the identity matrix and applies row operations until the left side becomes the identity, at which point the right side is the inverse. Every row operation is shown as a step.

Matrix multiplication: worked example

For a 2×2 example, A × B where each output cell is the dot product of a row of A with a column of B:

A = [1 2]   B = [5 6]
    [3 4]       [7 8]

A × B:
  [0,0] = 1×5 + 2×7 = 5  + 14 = 19
  [0,1] = 1×6 + 2×8 = 6  + 16 = 22
  [1,0] = 3×5 + 4×7 = 15 + 28 = 43
  [1,1] = 3×6 + 4×8 = 18 + 32 = 50

Result = [19 22]
         [43 50]

Dimension rules

OperationRequirementResult shape
Addition / subtractionSame dimensions (m×n + m×n)m×n
Multiplication (A×B)A is m×k; B is k×n (inner dims match)m×n
TransposeAny matrix m×nn×m
DeterminantSquare matrix n×nscalar
InverseSquare, non-singular (det ≠ 0)n×n

Real-world applications

  • 3D graphics: every rotation, scaling, and projection in a 3D engine is a matrix multiplication applied to vertex coordinates.
  • Machine learning: neural network layers are represented as weight matrices; forward propagation is a sequence of matrix multiplications.
  • Solving linear systems: the equation Ax = b, where A is a coefficient matrix and b is a constant vector, is solved using Gaussian elimination or matrix inversion.
  • Eigenvalues and eigenvectors: the equation Av = λv defines eigenvectors v and eigenvalues λ - foundational to PCA (dimensionality reduction), Google's PageRank algorithm, and structural vibration analysis.