Matrix Calculator

Add, subtract, multiply, transpose, and find the determinant and inverse of any 2×2, 3×3, or 4×4 matrix.

Your matrices

Edit the cells, choose an operation, and the answer appears below.

square n × n
choose A vs B
Matrix A
Matrix B
OperationA × B
Live calculation

Result

A × B =

Result matrix shown below — copy or share with a click.

det(A)

determinant

det(B)

determinant

A invertible?

det ≠ 0?

Determinant comparison |det| magnitude
OperationFormula / Rule
Addition(A + B)ij = Aij + Bij
Multiplication(AB)ij = Σ Aik · Bkj
Transpose(Aᵀ)ij = Aji
Determinant (2×2)det = ad − bc
InverseA⁻¹ = (1/det) · adj(A)
IdentityA · A⁻¹ = I

The Method

How matrix operations work

Addition and subtraction are entrywise — they require both matrices to have the same dimensions. Multiplication takes a row of A and a column of B and computes their dot product, repeated for every (row, column) pair in the result. The determinant is computed by Laplace expansion along a row, recursively reducing to 2×2 sub-matrices. The inverse uses the adjugate (transposed cofactor) divided by the determinant — defined only when the determinant is non-zero.

Working for selected operation

det(A) = a · ei − a · fh − b · di + b · fg + c · dh − c · eg
n matrix size (3)
op operation (det(A))
det(A) ()
det(B) ()

About This Tool

What Is a Matrix Calculator?

A matrix calculator performs the core operations of linear algebra — addition, subtraction, multiplication, transpose, determinant, and inverse — on square matrices up to 4 × 4. Enter the entries of A and B, pick an operation, and the calculator returns the resulting matrix or scalar, the determinants of A and B, and a visual comparison.

Matrices encode linear transformations: scalings, rotations, reflections, shears, and projections. They are the language of computer graphics (every 3D engine multiplies matrices), physics (quantum mechanics, relativity, classical rotations), statistics (covariance matrices, regression), machine learning (every layer of a neural network is a matrix multiplication followed by a non-linearity), and engineering (finite-element analysis, circuit theory).

This calculator uses standard textbook algorithms: entrywise for addition and subtraction; the classic row-by-column dot product for multiplication; Laplace expansion for the determinant (exact for the small sizes supported); and the adjugate / determinant formula for the inverse. All computations use IEEE 754 double-precision floating-point.

Use this free matrix calculator for linear algebra homework, exam revision, checking work on transformations, or visualising how the determinant scales by sign and magnitude. Every calculation runs locally — no sign-up, no tracking.

2×2, 3×3, 4×4

Pick a square matrix size — inputs rebuild automatically.

Add / Subtract / Multiply

Classic A + B, A − B, and A × B with full step-by-step working.

Transpose

Reflect across the main diagonal — rows become columns.

Determinant

Scalar that captures area / volume scaling — and signals invertibility.

Inverse

A⁻¹ such that A · A⁻¹ = I — using the adjugate-over-determinant formula.

100% Free & Private

No account, no tracking — every calculation runs locally in your browser.

How to Use This
Matrix Calculator

From choosing a size to inspecting the inverse — six clear steps.

1

Pick a Matrix Size

Choose 2×2, 3×3, or 4×4. Inputs rebuild automatically with an identity-matrix preset so you can start from a clean slate.

2

Fill in Matrices A and B

Type any real numbers into the cells of A and B. Decimals and negative numbers are accepted.

3

Choose an Operation

Select A + B, A − B, A × B, Transpose A, det(A), or A⁻¹. Operations that only use A ignore B.

4

Read the Result Matrix

The result matrix appears in the summary card. For determinant the answer is a single scalar. Singular matrices (det = 0) cannot be inverted — the calculator flags this.

5

Inspect the Determinants

The stat tiles show det(A) and det(B), plus a chart comparing their magnitudes. Determinant tells you whether each matrix is invertible.

6

Read the Working

The formula card explains the operation and lists the working steps — useful for homework, exam answers, and double-checking by hand.

Frequently Asked Questions

Everything you need to know about matrix operations and how to interpret your result.

A matrix is a rectangular array of numbers arranged in rows and columns. An m × n matrix has m rows and n columns. Matrices are used to encode linear transformations, solve systems of linear equations, represent data, and capture state in countless scientific and engineering models.

To multiply A (m × n) by B (n × p), the inner dimensions must match. Each entry C[i][j] of the result is the dot product of row i of A with column j of B: C[i][j] = Σk A[i][k] · B[k][j]. The result has m rows and p columns. Matrix multiplication is not commutative: in general, AB ≠ BA.

The determinant is a scalar computed from a square matrix that encodes important information. Geometrically, |det(A)| is the volume-scaling factor of the linear transformation represented by A — and the sign tells you whether orientation is preserved or flipped. A determinant of zero means the matrix collapses some dimension and is singular (not invertible).

A square matrix is invertible (also called non-singular) if and only if its determinant is non-zero. Equivalently, its rows (and columns) are linearly independent, and it represents a one-to-one linear transformation. The inverse A⁻¹ satisfies A · A⁻¹ = A⁻¹ · A = I (the identity matrix).

The transpose of A, written Aᵀ, is obtained by swapping rows and columns: the entry at position (i, j) of A becomes the entry at position (j, i) of Aᵀ. For a square matrix, transposing reflects entries across the main diagonal. Important identities: (AB)ᵀ = BᵀAᵀ and (Aᵀ)ᵀ = A.

Yes — matrix addition is commutative: A + B = B + A. It is also associative: (A + B) + C = A + (B + C). Addition is purely entrywise, so it inherits these properties from ordinary number addition. Matrix multiplication, however, is generally not commutative.

The identity matrix I is the square matrix with 1s on the main diagonal and 0s elsewhere. It acts as the multiplicative identity: for any matrix A of compatible size, A · I = I · A = A. The reset button on this calculator fills both A and B with the identity matrix of the chosen size.

By Laplace expansion along the first row: det = a(ei − fh) − b(di − fg) + c(dh − eg), where the 3×3 matrix is [[a,b,c],[d,e,f],[g,h,i]]. Each entry is multiplied by the determinant of the 2×2 sub-matrix obtained by deleting its row and column, with alternating signs. The same approach generalises to any size.

A singular matrix is a square matrix with determinant 0. It cannot be inverted — equivalently, it has linearly dependent rows (and columns) and represents a transformation that collapses one or more dimensions. Singular matrices crop up when a system of equations has either no solutions or infinitely many.

Because the operation is built from row × column dot products. Swapping A and B changes which rows are paired with which columns, so the entries generally come out different. Geometrically, applying transformation A then B is not the same as applying B then A — think of rotating a book 90° and then flipping it, versus flipping first and rotating after.

Matrices are everywhere: 3D graphics (model, view, and projection matrices), machine learning (every neural-network layer is a matrix multiplication), cryptography (linear codes), robotics (kinematics), quantum mechanics (operators), economics (input-output models), statistics (covariance matrices), and civil / electrical engineering (finite-element and circuit analysis).

The calculator uses IEEE 754 double-precision with about 15-17 significant digits. For the small (2×2 to 4×4) matrices supported here, results are accurate to many decimal places. Very ill-conditioned matrices (those with a determinant very close to zero) may show small floating-point errors in the inverse — the standard caveat of numerical linear algebra.