Matrix Calculator

Free matrix calculator. Multiply matrices, find determinants, inverses, transpose, RREF, rank, and eigenvalues for 2×2, 3×3, and 4×4 matrices.

A × B3×3 Matrix
30
24
18
84
69
54
138
114
90

Matrix Properties

Derived properties of the result

Trace
Sum of diagonal elements
189

What Is a Matrix?

Understanding matrices and why they're fundamental to linear algebra

A matrix is a rectangular grid of numbers arranged in rows and columns. Matrices are the core data structure of linear algebra — they represent transformations, encode systems of equations, and describe relationships between variables in machine learning, physics, and engineering.

This matrix calculator handles nine operations on 2×2, 3×3, and 4×4 square matrices. Binary operations (multiply, add, subtract) use both Matrix A and Matrix B; all other operations work on Matrix A alone. Results update as you type — no button needed.

Where matrix calculations are used
Computer graphics: Rotation, scaling & projection transforms
Machine learning: PCA, covariance matrices, neural network weights
Systems of equations: Ax = b solved via RREF or A⁻¹b
Physics & engineering: Eigenvalues for vibration modes & stability

Key Matrix Formulas

Determinant, inverse, eigenvalue, and multiplication formulas with variable definitions

2×2 Determinant
det(A) = ad − bc
a, d = main diagonal
b, c = off diagonal
2×2 Inverse
A⁻¹ = (1 / det(A)) × [[d, −b], [−c, a]]
det(A) = must be ≠ 0
I = identity matrix
Eigenvalues (2×2)
λ = (tr(A) ± √(tr(A)² − 4·det(A))) / 2
tr(A) = trace = a + d
λ = eigenvalue scalar
Matrix Multiplication
C[i][j] = Σₖ A[i][k] × B[k][j]
i, j = row / col of result
k = inner dimension index
Worked Example — 2×2 Determinant & Inverse

Given A = [[3, 1], [2, 4]]:

det(A) = (3)(4) − (1)(2) = 12 − 2 = 10
A⁻¹ = (1/10) × [[4, −1], [−2, 3]] = [[0.4, −0.1], [−0.2, 0.3]]

Verify: A × A⁻¹ = [[3(0.4)+1(−0.2), 3(−0.1)+1(0.3)], [2(0.4)+4(−0.2), 2(−0.1)+4(0.3)]] = [[1, 0], [0, 1]] = I ✓

Matrix Operations Explained

What each operation does and when to use it

A × BMultiply

Each cell (i,j) = dot product of row i from A and column j from B. A×B ≠ B×A in general.

A + BAdd

Element-wise addition. Matrices must be the same size. (A+B)[i][j] = A[i][j] + B[i][j].

A − BSubtract

Element-wise subtraction. Matrices must be the same size. (A−B)[i][j] = A[i][j] − B[i][j].

det(A)Determinant

Scalar encoding how A scales space. Zero = singular (no inverse). Computed via cofactor expansion.

A⁻¹Inverse

Matrix where A × A⁻¹ = I. Only exists when det(A) ≠ 0. Uses Gauss-Jordan elimination.

AᵀTranspose

Swap rows and columns: Aᵀ[i][j] = A[j][i]. Useful in dot products and symmetric matrices.

RREFRow Echelon

Standardized form with leading 1s in each pivot row. Used to solve Ax = b systems.

rank(A)Rank

Number of linearly independent rows. Equals the number of non-zero rows in RREF.

λEigenvalues

Scalars λ where Av = λv for non-zero v. Supported for 2×2 (quadratic) and 3×3 (Cardano).

Solving Real Problems with Matrices

Practical tips for equations, eigenvalues, and matrix powers

Solving Ax = b

To solve a square system, first check det(A) ≠ 0. If it is invertible, use A⁻¹ — the solution is x = A⁻¹b. Alternatively, apply RREF to A to confirm full rank (rank = N means a unique solution exists).

Check invertibility first

Run det(A) before computing A⁻¹. If det = 0, the inverse doesn't exist and you'll get an error.

Complex eigenvalues

If eigenvalues have an imaginary part (shown as ± xi), the matrix represents oscillatory or rotational behaviour in a dynamic system.

Matrix power

To compute A² or A³, multiply A × A successively. Eigenvalues of Aⁿ are the eigenvalues of A raised to the nth power.

Clear and Identity presets

Use the Clear button to zero out a matrix and Identity to reset it to I. Useful as a starting point for constructing custom matrices.

Common Matrix Mistakes

Pitfalls to avoid when calculating with matrices

Assuming A × B = B × A
Mistake: Treating matrix multiplication as commutative, like regular numbers
Correct: Matrix multiplication is NOT commutative — A×B and B×A are generally different. Always check the order.
Inverting a singular matrix
Mistake: Trying to compute A⁻¹ without checking the determinant first
Correct: Always check det(A) ≠ 0 before inverting. If det = 0 the matrix is singular and has no inverse.
Confusing transpose with inverse
Mistake: Using Aᵀ as a shortcut for A⁻¹ — "flipping the matrix should undo it"
Correct: Aᵀ swaps rows and columns; A⁻¹ is the unique matrix where A×A⁻¹ = I. They are equal only for orthogonal matrices.
Reading RREF wrong
Mistake: Assuming every RREF is an identity matrix
Correct: RREF may have zero rows (indicating rank deficiency). Count the non-zero rows to find the rank.
Ignoring complex eigenvalues
Mistake: Discarding eigenvalues with an imaginary part as errors
Correct: Complex eigenvalues are real results — they indicate rotation or oscillation. They always come in conjugate pairs (a+bi, a−bi).

Matrix Size Reference

Properties by matrix dimension

Property2×23×34×4
Elements4916
Max rank234
EigenvaluesQuadraticCubicNot supported
Det methodad−bcCofactorCofactor
Inverse methodAdjugateGauss-Jordan

Why stop at 4×4? Larger matrices require numerical algorithms (LU decomposition, QR iteration) that are better served by libraries like NumPy or MATLAB. This calculator uses floating-point arithmetic with cofactor expansion, Gauss-Jordan elimination, and Cardano's cubic formula for the supported sizes.

Frequently Asked Questions

Common questions and detailed answers

Embed Matrix Calculator

Add this calculator to your website or blog for free.