Matrix Calculator
Add, subtract, or multiply two matrices, or calculate a determinant, inverse, or transpose for a 2×2 or 3×3 matrix.
Matrix formulas
For equal-size matrices A and B, addition and subtraction combine corresponding entries: (A ± B)ᵢⱼ = aᵢⱼ ± bᵢⱼ. Matrix multiplication uses the dot product of row i from A and column j from B: (AB)ᵢⱼ = Σ aᵢₖbₖⱼ.
For a 2×2 matrix, det(A)=a₁₁a₂₂−a₁₂a₂₁. An inverse exists only when the determinant is nonzero. The calculator finds 2×2 and 3×3 inverses with Gauss–Jordan elimination and partial pivoting.
Checked examples
| Operation | Inputs | Result |
|---|---|---|
| A+B | A=[[1,2],[3,4]], B=[[5,6],[7,8]] | [[6,8],[10,12]] |
| A−B | A=[[1,2],[3,4]], B=[[5,6],[7,8]] | [[−4,−4],[−4,−4]] |
| AB | A=[[1,2],[3,4]], B=[[5,6],[7,8]] | [[19,22],[43,50]] |
| det(A) | A=[[1,2],[3,4]] | −2 |
| A⁻¹ | A=[[1,2],[3,4]] | [[−2,1],[1.5,−0.5]] |
| Aᵀ | A=[[1,2],[3,4]] | [[1,3],[2,4]] |
| 3×3 determinant | A=[[1,2,3],[0,1,4],[5,6,0]] | 1 |
How to use the calculator
- Select 2×2 or 3×3 matrices.
- Select multiplication, addition, subtraction, determinant, inverse, or transpose.
- Enter every visible matrix entry, using zero where appropriate.
- Select Calculate matrix and review the scalar or matrix result.
Limits and numerical method
- Entries must be finite numbers with magnitudes no greater than 1e50.
- Periods are accepted as decimal points; commas are rejected.
- All operations use JavaScript double-precision arithmetic and display approximately 12 significant digits.
- An inverse is rejected when the largest available pivot is no greater than 1e−12 times the matrix scale.
- This tool handles square 2×2 and 3×3 matrices. It does not multiply rectangular matrices of different dimensions.
Frequently asked questions
Does matrix multiplication commute?
Usually not. In general, AB and BA produce different results, even when both products exist.
When does a matrix have an inverse?
A square matrix is invertible when its determinant is nonzero. A zero determinant means the matrix is singular.
What does transpose do?
Transposition swaps rows and columns, so entry aᵢⱼ becomes entry aⱼᵢ.
Can I enter fractions?
Enter fractions as decimals, such as 0.5 for 1/2. Results are numerical approximations.
Related calculators
Use the System of Equations Calculator to solve 2×2 and 3×3 linear systems, or the Scientific Notation Calculator for very large and small values.