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

Frequently Asked Questions

What is a matrix?

A matrix is a rectangular array of numbers arranged in rows and columns. It is denoted by its dimensions as m\u00D7n, where m is the number of rows and n is the number of columns. Matrices are used to represent systems of linear equations, transformations, and data tables.

When can you multiply two matrices?

You can multiply matrix A (m\u00D7n) by matrix B (p\u00D7q) only if n equals p \u2014 the number of columns in A must equal the number of rows in B. The result is an m\u00D7q matrix.

What is a determinant?

The determinant is a scalar value calculated from a square matrix. For a 2\u00D72 matrix [[a,b],[c,d]], det = ad - bc. It tells you if the matrix is invertible (det \u2260 0) and the scaling factor of the linear transformation.

When does a matrix have an inverse?

A square matrix has an inverse if and only if its determinant is not zero. The inverse A\u207B\u00B9 satisfies A \u00D7 A\u207B\u00B9 = I (identity matrix). This calculator finds inverses for 2\u00D72 and 3\u00D73 matrices.

What is the transpose of a matrix?

The transpose flips a matrix over its diagonal \u2014 rows become columns and columns become rows. If A is m\u00D7n, its transpose A\u1D40 is n\u00D7m.