🔢

Matrix Calculator

Perform matrix operations online — addition, subtraction, multiplication, determinant, inverse, transpose and rank. Supports 2×2 up to 5×5 matrices with step-by-step solutions.

Up to 5×5Step-by-Step
Matrix Size
Operation

Matrix Operations Reference

Addition & Subtraction

Two matrices of the same size can be added or subtracted element-wise: (A ± B)[i][j] = A[i][j] ± B[i][j]. Both matrices must have identical dimensions.

Matrix Multiplication

For matrices A (m×n) and B (n×p), the product C = A×B is an m×p matrix where C[i][j] = Σₖ A[i][k] × B[k][j]. The number of columns in A must equal the number of rows in B. Matrix multiplication is generally not commutative: A×B ≠ B×A.

Determinant

The determinant det(A) or |A| is a scalar that only exists for square matrices.

  • 2×2: det = ad − bc
  • 3×3: Cofactor expansion along row 1: det = a(ei−fh) − b(di−fg) + c(dh−eg)
  • N×N: Recursive cofactor expansion along the first row.

Inverse

The inverse A⁻¹ exists only when det(A) ≠ 0. For 2×2: A⁻¹ = (1/det) × [[d,−b],[−c,a]]. For larger matrices this calculator uses Gauss-Jordan elimination, augmenting [A|I] and reducing to [I|A⁻¹].

Transpose

The transpose Aᵀ swaps rows and columns: Aᵀ[i][j] = A[j][i]. An n×m matrix becomes an m×n matrix. A symmetric matrix satisfies A = Aᵀ.

Rank

The rank is the number of linearly independent rows (or columns), found by Gaussian elimination. For an n×n matrix, rank = n means the matrix is invertible (full rank).

Properties of Matrices

  • Associative: (A+B)+C = A+(B+C) and (AB)C = A(BC)
  • Distributive: A(B+C) = AB+AC
  • Not commutative (multiplication): AB ≠ BA in general
  • Identity matrix I: AI = IA = A for any square matrix A
  • det(AB) = det(A)·det(B)
  • (AB)⁻¹ = B⁻¹A⁻¹
  • (Aᵀ)ᵀ = A

Frequently Asked Questions

The determinant is a scalar value computed from a square matrix that encodes important properties. For a 2×2 matrix [[a,b],[c,d]], det = ad − bc. A non-zero determinant means the matrix is invertible; a zero determinant means it is singular. Determinants appear in Cramer's rule, computing inverses, and eigenvalue problems.
A square matrix has no inverse (it is singular) when its determinant equals zero. This happens when rows or columns are linearly dependent — one row can be expressed as a linear combination of others. The matrix then has rank less than n and cannot be inverted.
Standard matrix multiplication (A×B) computes C[i][j] as the dot product of row i of A and column j of B — dimensions must be compatible. Element-wise multiplication (Hadamard product, A∘B) multiplies corresponding elements: C[i][j] = A[i][j]×B[i][j] — matrices must be the same size. This calculator performs standard matrix multiplication.
The rank of a matrix is the number of linearly independent rows (or columns), found by row-reducing to row echelon form and counting pivot rows. Full rank (rank = n for n×n) means the matrix is invertible. Rank less than n indicates linear dependence and means the matrix is singular with no inverse.