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

×

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 × nn × mAny matrix
det(A)n × nscalarSquare only
A⁻¹n × nn × nSquare, det ≠ 0
A^kn × nn × 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

What operations does this matrix calculator support?

Addition (A+B), subtraction (A−B), multiplication (A×B), transpose, determinant, inverse, scalar multiplication, and matrix power. Matrices can be up to 8×8.

When can I add or subtract matrices?

Both matrices must have the same dimensions (same number of rows and columns). The operation is performed element by element: each element in the result is the sum (or difference) of corresponding elements.

When can I multiply matrices?

To multiply A × B, the number of columns in A must equal the number of rows in B. If A is m×n and B is n×p, the result is m×p. Matrix multiplication is not commutative: A×B ≠ B×A in general.

What is the determinant?

The determinant is a scalar value computed from a square matrix. It tells you whether the matrix is invertible (det ≠ 0) and relates to the volume scaling factor of the linear transformation the matrix represents.

When does a matrix inverse exist?

A matrix inverse exists only for square matrices with a non-zero determinant. The inverse A⁻¹ satisfies A × A⁻¹ = I (identity matrix). Singular matrices (det = 0) have no inverse.

What is the transpose of a matrix?

The transpose flips a matrix over its main diagonal: rows become columns and columns become rows. An m×n matrix becomes n×m. For example, element (i,j) moves to position (j,i).