Matrix Calculator — Add, Multiply, Determinant

Enter two matrices (up to 4×4), choose an operation, and see step-by-step results. Supports addition, subtraction, multiplication, transpose, determinant, and inverse. Runs entirely in your browser.

Matrix A

Rows: Cols:

Matrix B

Rows: Cols:
Ad Space

How Matrix Operations Work

Matrices are rectangular arrays of numbers used across mathematics, physics, computer science, and engineering. This calculator handles the most common operations: addition, subtraction, multiplication, transposition, determinant computation, and matrix inversion.

Key Formulas

Addition/Subtraction: C[i][j] = A[i][j] ± B[i][j] (matrices must be same size)

Multiplication: C[i][j] = Σ A[i][k] × B[k][j] (A cols must equal B rows)

2×2 Determinant: det = ad - bc

2×2 Inverse: A&supmin;¹ = (1/det) × [[d,-b],[-c,a]]

Transpose: AT[i][j] = A[j][i]

Addition and Subtraction

Matrix addition and subtraction are element-wise operations. Both matrices must have the same dimensions. Each element in the result is the sum (or difference) of the corresponding elements in the two input matrices. These operations are commutative (A + B = B + A) for addition but not for subtraction.

Multiplication

Matrix multiplication is not element-wise. To multiply A (m×n) by B (n×p), the number of columns in A must equal the number of rows in B. Each element C[i][j] is computed as the dot product of row i from A and column j from B. Matrix multiplication is associative but generally not commutative (A×B usually differs from B×A).

Determinant

The determinant is defined for square matrices only. For 2×2: det([[a,b],[c,d]]) = ad - bc. For 3×3 and larger, cofactor expansion along the first row is used. A determinant of zero means the matrix is singular (no inverse exists). The determinant also represents the scaling factor of the associated linear transformation.

Inverse

The inverse of a matrix A is a matrix A&supmin;¹ such that A × A&supmin;¹ = I (the identity matrix). Only square matrices with non-zero determinants have inverses. This calculator computes inverses for 2×2 and 3×3 matrices using the adjugate method.

Applications