Perform matrix addition, subtraction, multiplication, determinants, inverses, and transposes up to 4×4 with step-by-step linear algebra.
Choose an operation above to compute matrix result.
A 3D graphics programmer multiplies a translation matrix by a rotation matrix to transform vertex coordinates in a video game engine. A data scientist solves a least-squares linear regression model using matrix transposition and inversion: β = (XᵀX)⁻¹XᵀY. A structural engineer uses stiffness matrices to model stress distribution across skyscraper beams under seismic load.
A matrix (plural: matrices) is a rectangular array of numbers arranged in rows and columns. Matrices provide a compact mathematical language for representing linear transformations, systems of linear equations, and multi-dimensional datasets. The size or dimension of a matrix is specified as m × n, where m is the number of rows and n is the number of columns.
Key operations in linear algebra include matrix addition (adding corresponding elements), matrix multiplication (computing dot products of rows and columns), matrix determinant (measuring scaling volume and invertibility), matrix inverse (the multiplicative reciprocal matrix A⁻¹ such that A × A⁻¹ = I), and matrix transpose (swapping rows and columns). This calculator automates these operations for matrices up to 4×4 with step-by-step display. The following sections explain the underlying algorithms, mathematical rules, and engineering applications.
When an operation button is clicked, the engine reads the active matrix cell inputs into 2D JavaScript arrays and executes linear algebra algorithms.
1. Matrix Addition & Subtraction:
Requires identical dimensions (m × n).
(A ± B)ᵢⱼ = Aᵢⱼ ± Bᵢⱼ
2. Matrix Multiplication (A × B):
Requires columns of A to equal rows of B (A: m×n, B: n×p → C: m×p).
Cᵢⱼ = ∑ (Aᵢₖ × Bₖⱼ) for k = 1 to n.
3. Determinant (Det A):
For a 2×2 matrix: ad - bc.
For a 3×3 matrix (Laplace expansion across Row 1):
Det(A) = a₁₁(a₂₂a₃₃ - a₂₃a₃₂) - a₁₂(a₂₁a₃₃ - a₂₃a₃₁) + a₁₃(a₂₁a₃₂ - a₂₂a₃₁)
4. Matrix Inverse (A⁻¹):
A⁻¹ = (1 / Det(A)) × Adj(A), where Adj(A) is the transpose of the cofactor matrix. If Det(A) = 0, the matrix is singular and has no inverse.
3D Computer Graphics and Gaming. Game engines perform 4×4 matrix multiplications for model-view-projection transformations, translating 3D virtual world coordinates onto 2D screen viewports.
Machine Learning and Neural Networks. Deep learning frameworks represent network weight layers as matrices. Forward propagation executes as matrix multiplication Y = W × X + B across thousands of artificial neurons.
Quantum Physics and State Vectors. Quantum mechanics models quantum states as column vectors and quantum logic gates as unitary matrices acting on qubit state spaces.
Markov Chains and Stochastic Modeling. Financial analysts model transition probabilities between economic states using transition matrices raised to integer powers (Pⁿ).
Verify dimensions before multiplying. To multiply Matrix A (m×n) by Matrix B (r×c), ensure n = r.
Remember that matrix multiplication is non-commutative (A × B ≠ B × A in general). The order of multiplication matters.
For solving systems of linear equations directly without finding matrix inverses, use our System of Equations Solver. For scientific functions, use our Scientific Calculator.
The matrix engine executes in client-side JavaScript using double-precision floating-point arithmetic. Matrix operations up to 4×4 evaluate in under 1 millisecond.
| Feature | This Tool | Hand Matrix Math | Spreadsheet MMULT |
|---|---|---|---|
| Dimensions | Up to 4×4 | 2×2 or 3×3 practical | Up to 1000×1000 |
| Multiplication (A×B) | Instant (<1ms) | 5-15 minutes | Instant |
| Determinant Det(A) | Laplace expansion | Manual cofactor expansion | MDETERM() function |
| Inverse A⁻¹ | Adjugate & Det check | Manual cofactor matrix | MINVERSE() function |
| Privacy | Client-side browser | Paper | Local file |
| Cost | Free | Free | License required |
The formula for matrix inverse includes dividing by the determinant: A⁻¹ = Adj(A) / Det(A). If Det(A) = 0, division by zero is mathematically undefined, so no inverse exists.
An identity matrix is a square matrix with ones along the main diagonal and zeros elsewhere. Multiplying any matrix by the identity matrix leaves it unchanged: A × I = A.
No. Matrix addition and subtraction require both matrices to have identical row and column dimensions (e.g., both 2×3 or both 3×3).
System of Equations Solver — Solves 2×2 and 3×3 linear systems using Gaussian elimination.
Quadratic Solver — Solves second-order polynomial equations.
Scientific Calculator — Evaluates complex scientific expressions and trigonometric functions.