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
Steps to Calculate
Example Calculations
Example 1 — 2×2 Matrix Multiplication
A = [[2, 3], [1, 4]] × B = [[5, 2], [0, 6]]
Example 2 — 3×3 Determinant
A = [[1,2,3],[4,5,6],[7,8,9]]
Example 3 — 2×2 Inverse
A = [[4, 7], [2, 6]] — find A⁻¹
❓ Frequently Asked Questions
🔗 Related Calculators
What is a matrix?
A matrix is a rectangular array of numbers arranged in rows and columns. A 2×2 matrix has 2 rows and 2 columns (4 elements); a 3×3 matrix has 9 elements. Matrices are used in linear algebra to represent linear transformations, solve systems of equations, model transformations in 3D graphics, and much more. Each element is identified by its row and column index.
How do you add or subtract matrices?
To add or subtract matrices, they must have the same dimensions (same number of rows and columns). You simply add or subtract corresponding elements: (A + B)ᵢⱼ = Aᵢⱼ + Bᵢⱼ. For example, adding two 2×2 matrices: [[1,2],[3,4]] + [[5,6],[7,8]] = [[6,8],[10,12]]. Matrix addition is commutative (A + B = B + A) and associative.
How does matrix multiplication work?
Matrix multiplication (A × B) is defined only when the number of columns in A equals the number of rows in B. The element at row i, column j of the result is the dot product of row i of A and column j of B: Cᵢⱼ = Σₖ Aᵢₖ × Bₖⱼ. For a 2×2 example: [[1,2],[3,4]] × [[5,6],[7,8]] = [[1·5+2·7, 1·6+2·8],[3·5+4·7, 3·6+4·8]] = [[19,22],[43,50]]. Multiplication is NOT commutative.
What is a determinant?
The determinant is a scalar value computed from a square matrix that encodes important properties. For a 2×2 matrix [[a,b],[c,d]], det = ad − bc. For a 3×3 matrix, it uses cofactor expansion. Key properties: det(A) = 0 means the matrix is singular (non-invertible); det(AB) = det(A) × det(B); det(Aᵀ) = det(A). Geometrically, |det(A)| is the area/volume scaling factor of the linear transformation A.
How do you find the inverse of a matrix?
A matrix A is invertible if det(A) ≠ 0. For a 2×2 matrix [[a,b],[c,d]], the inverse is (1/det) × [[d,−b],[−c,a]]. For 3×3, the inverse is the adjugate matrix (transposed cofactor matrix) divided by the determinant. The inverse satisfies A × A⁻¹ = A⁻¹ × A = I (identity matrix). If det(A) = 0, the matrix is singular and has no inverse.
What is matrix transpose?
The transpose Aᵀ of a matrix A is obtained by swapping rows and columns: element at position (i,j) in A moves to position (j,i) in Aᵀ. A 2×3 matrix becomes a 3×2 matrix after transposing. Properties: (Aᵀ)ᵀ = A; (A + B)ᵀ = Aᵀ + Bᵀ; (AB)ᵀ = BᵀAᵀ. Symmetric matrices satisfy A = Aᵀ. Transpose is used heavily in statistics, physics, and machine learning.
What is the identity matrix?
The identity matrix I is the square matrix with 1s on the main diagonal and 0s everywhere else. For 2×2: I = [[1,0],[0,1]]; for 3×3: I = [[1,0,0],[0,1,0],[0,0,1]]. Any matrix multiplied by the identity gives itself: A × I = I × A = A. The identity matrix is the multiplicative identity for matrix multiplication, analogous to the number 1 for scalar multiplication.
What is the difference between a singular and non-singular matrix?
A square matrix is non-singular (invertible) if its determinant is non-zero. It has a unique inverse and the system Ax = b has a unique solution for any b. A singular matrix has det = 0, no inverse, and the corresponding linear system either has no solution or infinitely many solutions. Singular matrices represent degenerate linear transformations that collapse the space (e.g., mapping a 2D plane onto a line).
How do matrices relate to solving linear equations?
A system of linear equations can be written as Ax = b, where A is the coefficient matrix, x is the vector of unknowns, and b is the constants vector. If A is invertible, the unique solution is x = A⁻¹ × b. For 2 equations in 2 unknowns: [a₁x + b₁y = c₁, a₂x + b₂y = c₂] → matrix A = [[a₁,b₁],[a₂,b₂]]. This is why determinants and inverses are central to linear algebra.
What is the cofactor expansion method for the determinant?
Cofactor expansion (Laplace expansion) computes the determinant by breaking a 3×3 matrix into three 2×2 determinants. Expanding along the first row: det = a₁₁(a₂₂a₃₃ − a₂₃a₃₂) − a₁₂(a₂₁a₃₃ − a₂₃a₃₁) + a₁₃(a₂₁a₃₂ − a₂₂a₃₁). The signs alternate: +, −, +, −, ... The cofactor Cᵢⱼ = (−1)^(i+j) × det(minor Mᵢⱼ). This method generalizes to any square matrix by expanding along any row or column.
What are eigenvalues and eigenvectors?
For a square matrix A, an eigenvector v is a non-zero vector satisfying Av = λv, where λ is the corresponding eigenvalue (a scalar). Eigenvectors point in directions that are only scaled (not rotated) by the transformation A. Eigenvalues are found by solving det(A − λI) = 0 (the characteristic equation). Eigenvalues/eigenvectors are fundamental in physics, machine learning (PCA), differential equations, and Google's PageRank algorithm.
What does it mean for two matrices to be equal?
Two matrices A and B are equal if and only if they have the same dimensions and every corresponding element is equal: Aᵢⱼ = Bᵢⱼ for all i and j. So [[1,2],[3,4]] = [[1,2],[3,4]] but [[1,2],[3,4]] ≠ [[1,2],[3,5]]. Matrix equality is an element-wise comparison, not an overall 'value' comparison like with scalars.