Matrix Calculator
Enter values in the matrix grids and select an operation. Supports 2×2 to 5×5 matrices.
Matrix A
Matrix B
How to Use the Matrix Calculator
- Select an operation using the chips: Add, Subtract, Multiply, Scalar, Transpose, Determinant, or Inverse.
- Set matrix dimensions using the rows/cols dropdowns (2 to 5 for each dimension).
- Enter values directly into the grid cells. Use decimals or negatives freely.
- 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.