Skip to content

Matrix Calculator

Perform matrix operations: addition, subtraction, multiplication, transpose, determinant, inverse, power, and scalar multiply. Up to 8×8.

Matrix A

×

Matrix B

×

Something wrong or missing? Tell us — we read every report and fix issues fast.

Matrix Operations

Addition and Subtraction

Element-wise operations requiring matching dimensions:

(A ± B)ij = aij ± bij

Multiplication

For A (m×n) and B (n×p), the product C = AB is m×p where:

cij = Σ aik × bkj (sum over k from 1 to n)

Key properties: not commutative (AB ≠ BA), associative (A(BC) = (AB)C), distributive (A(B+C) = AB + AC).

Determinant

For a 2×2 matrix: det = ad − bc

For larger matrices, computed using LU decomposition with partial pivoting. Properties:

  • det(AB) = det(A) × det(B)
  • det(Aᵀ) = det(A)
  • det(kA) = kn × det(A) for n×n matrix
  • Swapping rows negates the determinant

Inverse

The inverse A⁻¹ exists when det(A) ≠ 0. For a 2×2 matrix:

A⁻¹ = (1/det) × [[d, −b], [−c, a]]

For larger matrices, computed using Gauss-Jordan elimination.

Matrix Dimensions Quick Reference

OperationA SizeB SizeResult SizeRequirement
A + Bm × nm × nm × nSame dimensions
A − Bm × nm × nm × nSame dimensions
A × Bm × nn × pm × pA cols = B rows
Aᵀm × n—n × mAny matrix
det(A)n × n—scalarSquare only
A⁻¹n × n—n × nSquare, det ≠ 0
A^kn × n—n × nSquare only

Special Matrices

  • Identity matrix (I): 1s on diagonal, 0s elsewhere. AI = IA = A
  • Zero matrix: All elements are 0. Acts as additive identity
  • Diagonal matrix: Non-zero elements only on the main diagonal
  • Symmetric matrix: A = Aᵀ (equal to its transpose)
  • Orthogonal matrix: A⁻¹ = Aᵀ (inverse equals transpose)
  • Singular matrix: det = 0, no inverse exists

Applications

  • Systems of equations: Ax = b solved via x = A⁻¹b
  • Computer graphics: Rotation, scaling, and translation matrices
  • Machine learning: Neural network weights, covariance matrices
  • Physics: Quantum mechanics, stress tensors, moment of inertia
  • Economics: Input-output models, Markov chains

Related Calculators

Frequently Asked Questions

When can you multiply two matrices?

Two matrices can be multiplied only when the number of columns in the first equals the number of rows in the second. If A is m x n and B is n x p, the product A x B is an m x p matrix. The order matters: A x B usually differs from B x A, and B x A may not even be defined.

How do you find the determinant of a 2x2 matrix?

For a 2x2 matrix with rows (a, b) and (c, d), the determinant is ad minus bc. For rows (2, 4) and (6, 8), it is 2 x 8 - 4 x 6 = 16 - 24 = -8. A determinant of zero means the matrix is singular and has no inverse, and any other value means an inverse exists.

When does a matrix have an inverse?

A matrix has an inverse only when it is square and its determinant is not zero. The inverse of A, written A to the power of -1, satisfies A x A inverse = I, the identity matrix. A matrix with determinant 0 is singular: it has no inverse, and the matching system of equations has either no solution or infinitely many.

What is the transpose of a matrix?

The transpose flips a matrix over its main diagonal, so rows become columns and columns become rows. An m x n matrix becomes n x m, and the element in row i, column j moves to row j, column i. For example, the rows (1, 2, 3) and (4, 5, 6) transpose to the rows (1, 4), (2, 5) and (3, 6).