Matrix Calculator

Enter values in the matrix grids and select an operation. Supports 2×2 to 5×5 matrices.

Matrix A

[
]

Matrix B

[
]
Enter matrix values and click Calculate.

How to Use the Matrix Calculator

  1. Select an operation using the chips: Add, Subtract, Multiply, Scalar, Transpose, Determinant, or Inverse.
  2. Set matrix dimensions using the rows/cols dropdowns (2 to 5 for each dimension).
  3. Enter values directly into the grid cells. Use decimals or negatives freely.
  4. Click Calculate to see the result matrix and a step-by-step breakdown.

Matrix Operations Explained

Addition and Subtraction

Matrix addition (A + B) and subtraction (A − B) require both matrices to have identical dimensions. The result is computed element-by-element: each cell (i,j) of the result equals A[i][j] ± B[i][j]. These operations are commutative for addition (A+B = B+A) but not for subtraction.

Matrix Multiplication

Matrix multiplication A×B requires the number of columns in A to equal the number of rows in B. If A is m×n and B is n×p, the result is m×p. Each element result[i][j] is the dot product of row i of A with column j of B. Unlike scalar multiplication, matrix multiplication is generally not commutative (A×B ≠ B×A).

Scalar Multiplication

Multiplying a matrix by a scalar k produces a new matrix where every element is multiplied by k. This scales the entire matrix uniformly without changing its structure or the relative proportions of its elements.

Transpose

The transpose of matrix A (written Aᵀ) swaps rows and columns. Element (i,j) of A becomes element (j,i) of Aᵀ. A symmetric matrix equals its own transpose. Transposition is used in computing dot products, adjusting data table orientations, and in many machine learning algorithms.

Determinant

The determinant is a scalar value associated with any square matrix. For a 2×2 matrix [[a,b],[c,d]], det = ad − bc. For larger matrices, this calculator uses cofactor expansion (Laplace expansion). A non-zero determinant means the matrix is invertible; a zero determinant means it is singular. The determinant also represents the scaling factor of the linear transformation described by the matrix.

Matrix Inverse

The inverse of square matrix A (written A⁻¹) is the matrix such that A × A⁻¹ = I (the identity matrix). An inverse only exists if the determinant is non-zero. This calculator uses the adjugate matrix method for 2×2 to 4×4, and Gaussian elimination for 5×5. Inverses are essential for solving systems of linear equations, computer graphics transformations, and cryptography. For statistical applications of matrices, see the Statistics Calculator.

Frequently Asked Questions

Matrix multiplication A×B is only possible when the number of columns in A equals the number of rows in B. The result has the same number of rows as A and the same number of columns as B. For example, a 3×2 matrix multiplied by a 2×4 matrix yields a 3×4 result.
A square matrix has an inverse only if its determinant is non-zero (non-singular). If the determinant is 0, the matrix is singular and has no inverse. This calculator reports when a matrix is singular.
The determinant is a scalar computed from a square matrix. It tells you if the matrix is invertible (non-zero = invertible), represents the scaling factor of a linear transformation, and is used in Cramer's rule for solving linear systems.
Transposing flips a matrix over its main diagonal — rows become columns. A matrix of size m×n becomes n×m after transposition, denoted Aᵀ.
Scalar multiplication multiplies every element of a matrix by a single number (the scalar). For example, multiplying matrix A by scalar k produces a new matrix where every entry a_ij becomes k × a_ij.