The Online Matrix Calculator helps you perform linear algebra operations on matrices.
Supports addition, subtraction, multiplication, determinant (cofactor expansion), inverse (Gauss-Jordan), and transpose for matrices sized 2x2 up to 4x4.
Calculator information
📋 How to use this calculator
- Choose a matrix size (2x2, 3x3, or 4x4) - the number of rows and columns sets the number of input fields.
- Fill in matrix A row by row from left to right; use a period for decimals (e.g., 3.14).
- For binary operations (addition, subtraction, multiplication), also fill in matrix B with a compatible size.
- Pick the operation: A+B, A-B, A×B, det(A), A⁻¹ (inverse), Aᵀ (transpose), or A^n (power).
- Press Calculate to view the result plus step-by-step work (e.g., cofactor expansion for the determinant, Gauss-Jordan for the inverse).
- Watch for error messages: a singular matrix (det = 0) has no inverse; multiplication requires columns of A = rows of B.
- Tip: use the inverse to solve Ax = b via x = A⁻¹b (provided det(A) ≠ 0).
🧮 Basic Matrix Operations
det(A) = Σ(-1)^(i+j) × aᵢⱼ × Mᵢⱼ ; A⁻¹ = (1/det A) × adj(A)
- Mᵢⱼ = minor (determinant of the submatrix without row i and column j)
- adj(A) = transpose of the cofactor matrix
- Addition: (A+B)ᵢⱼ = aᵢⱼ + bᵢⱼ
- Multiplication: (A·B)ᵢⱼ = Σₖ aᵢₖ · bₖⱼ
- Transpose: (Aᵀ)ᵢⱼ = aⱼᵢ
Gauss-Jordan: the augmented matrix [A | I] is reduced to [I | A⁻¹] using elementary row operations.
💡 Worked example: Determinant and inverse of a 2×2 matrix
Steps:- det(A) = (4 × 6) - (7 × 2) = 24 - 14 = 10.
- adj(A) = [[6, -7], [-2, 4]] (swap the main diagonal, negate the anti-diagonal).
- A⁻¹ = (1/10) × [[6, -7], [-2, 4]] = [[0.6, -0.7], [-0.2, 0.4]].
- Verify: A × A⁻¹ = [[4×0.6+7×(-0.2), 4×(-0.7)+7×0.4], [2×0.6+6×(-0.2), 2×(-0.7)+6×0.4]] = [[1, 0], [0, 1]].
Result: det(A) = 10; A⁻¹ = [[0.6, -0.7], [-0.2, 0.4]]; identity verified.
❓ Frequently asked questions
When does a matrix have no inverse?
A matrix A is non-invertible (singular) when det(A) = 0. This happens when: (1) one row or column is a linear combination of others, (2) a row or column is all zeros, or (3) rows are duplicated. Geometrically, a singular matrix collapses space to a lower dimension - the mapping cannot be inverted because information is lost. For Ax = b with a singular A, use the Moore-Penrose pseudoinverse.
What is the difference between determinant and trace?
The determinant is a scalar that gives the volume scaling factor of a linear transformation (det = 2 means volumes double). The trace is the sum of the main diagonal entries and equals the sum of the eigenvalues. Both are invariant under change of basis. For a 2×2: det = ad - bc, trace = a + d. det = 0 means a singular matrix; a negative trace (for a symmetric matrix) implies at least one negative eigenvalue.
How are matrices used in the real world?
Applications are widespread: (1) computer graphics - 3D transformations (rotation, translation, scaling); (2) machine learning - tensor operations in neural networks; (3) engineering systems of linear equations (statics, electrical circuits); (4) cryptography - the Hill cipher; (5) econometrics - OLS regression (β = (XᵀX)⁻¹Xᵀy); (6) Google's PageRank - the principal eigenvector of an adjacency matrix. NumPy and MATLAB are built around matrix operations.
What is the fastest method for the determinant of a large matrix?
Cofactor expansion is O(n!) and impractical above 4×4. For large matrices, use LU decomposition: factor A = LU, then det(A) is the product of the diagonal of U. Complexity is O(n³). For symmetric positive-definite matrices, use Cholesky decomposition A = LLᵀ. Numerical libraries like LAPACK and NumPy's linalg automatically pick the optimal algorithm based on matrix structure.
What is an eigenvalue and eigenvector?
An eigenvector v is a non-zero vector that, when multiplied by A, only changes in length (not direction): Av = λv, where λ is the eigenvalue. They are found from the characteristic equation det(A - λI) = 0. Applications: principal component analysis (PCA), stability analysis of dynamical systems, vibration mode analysis, MRI imaging. A 3×3 matrix has at most 3 eigenvalues (real or as complex conjugate pairs).
📚 Sources & references
Last updated: May 11, 2026