Matrix Calculator
Add, subtract, multiply matrices and find the determinant, inverse, and transpose — for 2×2 and 3×3 matrices.
What Is a Matrix Calculator?
A matrix calculator is a tool that performs the core operations of linear algebra on rectangular arrays of numbers called matrices. Matrices appear everywhere in mathematics, physics, computer graphics, machine learning, and engineering — they encode linear transformations, represent systems of equations, and model relationships between variables in multi-dimensional space.
This calculator supports the five most important matrix operations for 2×2 and 3×3 square matrices, plus arbitrary rectangular shapes for the transpose. Each operation has a precise mathematical meaning:
- Addition / Subtraction: Element-wise combination of two same-size matrices.
- Multiplication: Dot-product combination that composes linear transformations.
- Determinant: A scalar value encoding the "volume scaling factor" and invertibility of a square matrix.
- Inverse: The matrix A⁻¹ such that A × A⁻¹ = I (the identity), used to solve matrix equations.
- Transpose: Reflects the matrix across its main diagonal, swapping rows and columns.
Understanding these operations is fundamental for any student or professional working with linear algebra, machine learning, computer graphics, structural engineering, or data science.
Matrix Operation Formulas
Addition: (A + B)ᵢⱼ = Aᵢⱼ + Bᵢⱼ — add corresponding elements.
Subtraction: (A − B)ᵢⱼ = Aᵢⱼ − Bᵢⱼ — subtract corresponding elements.
Multiplication: Cᵢⱼ = Σₖ Aᵢₖ · Bₖⱼ — dot product of row i of A with column j of B.
2×2 Determinant: For A = [[a,b],[c,d]], det(A) = a·d − b·c
3×3 Determinant (cofactor expansion along row 1):
det(A) = a₁₁(a₂₂a₃₃ − a₂₃a₃₂) − a₁₂(a₂₁a₃₃ − a₂₃a₃₁) + a₁₃(a₂₁a₃₂ − a₂₂a₃₁)
2×2 Inverse: A⁻¹ = (1/det) · [[d, −b],[−c, a]] — only when det ≠ 0.
Transpose: (Aᵀ)ᵢⱼ = Aⱼᵢ — swap row and column indices.
| Operation | Requirement | Result Size | Commutative? |
|---|---|---|---|
| Addition A + B | Same dimensions | Same as A, B | Yes |
| Subtraction A − B | Same dimensions | Same as A, B | No |
| Multiplication A × B | cols(A) = rows(B) | rows(A) × cols(B) | No |
| Determinant det(A) | Square matrix | Scalar | — |
| Inverse A⁻¹ | Square, det ≠ 0 | Same as A | — |
| Transpose Aᵀ | Any matrix | Cols × Rows flipped | — |
How to Use the Matrix Calculator
- Choose an operation from the tabs: Add, Subtract, Multiply, Determinant, Inverse, or Transpose.
- Select matrix size using the dropdown (2×2 or 3×3; for Transpose, choose rows and columns independently).
- Enter matrix values into each cell of the grid. Cells default to 0.
- Click Calculate to see the result matrix, the determinant value, or the inverse — with step-by-step working where applicable.
- Switch modes at any time by clicking a different tab. The grids update automatically.