Matrix Calculator
Perform matrix operations: addition, multiplication, inverse, determinant, transpose, eigenvalues. Free online linear algebra matrix calculator
Matrix operations are the backbone of every neural network, every 3D transform, every linear regression — and the source of every "dimensions do not align" error in numpy. This calculator handles addition, multiplication, transpose, determinant, inverse, eigenvalues, rank, and reduced row echelon form for matrices up to 10×10. Operations run client-side using stable numerical methods (LU decomposition for inverse, QR algorithm for eigenvalues, not the textbook formulas that explode on ill-conditioned matrices).
Operations and what they each tell you
- Addition / subtraction — element-wise, requires same shape. Trivial; mostly a sanity check.
- Multiplication — A (m×n) × B (n×p) = AB (m×p). The inner dimensions must match. NOT commutative: AB ≠ BA in general, and one may be undefined while the other is.
- Transpose — flip across diagonal. (A^T)_ij = A_ji. Trivial but constantly needed (vectors as rows vs columns).
- Determinant — single number that tells you the volume-scaling factor of the linear map. Zero determinant = singular matrix = collapses dimensions = non-invertible.
- Inverse — A^-1 such that AA^-1 = I. Exists iff det(A) ≠ 0. For solving Ax = b, prefer LU or QR decomposition over computing A^-1 explicitly (more numerically stable).
- Eigenvalues / eigenvectors — Av = λv. Eigenvectors are directions that the matrix stretches without rotating; eigenvalues are the stretch factors. Foundation of PCA, stability analysis, Google PageRank.
- Rank — number of linearly independent rows (= columns). Tells you the effective dimensionality of the image of the linear map. Full rank = invertible (for square).
- RREF (reduced row echelon form) — canonical form after Gauss-Jordan elimination. Reveals rank, basis, and solutions to systems of linear equations.
Working example: solving a linear system
Input
Solve: 2x + 3y - z = 5 x - y + 2z = 4 3x + 2y + z = 11
Output
Matrix form: A·v = b where
A = | 2 3 -1 | v = | x | b = | 5 |
| 1 -1 2 | | y | | 4 |
| 3 2 1 | | z | | 11 |
det(A) = 2(-1·1 - 2·2) - 3(1·1 - 2·3) + (-1)(1·2 - (-1)·3)
= 2(-5) - 3(-5) + (-1)(5)
= -10 + 15 - 5 = 0
det(A) = 0 means the system is either underdetermined (infinite solutions) or inconsistent (no solutions).
RREF of augmented matrix [A | b]:
| 1 0 1 | 3 |
| 0 1 -1 | 1 |
| 0 0 0 | 0 |
Last row is 0 = 0 (consistent). Infinite solutions parameterized by free variable z:
x = 3 - z
y = 1 + z
z = z (free)When det = 0, do NOT try to compute A^-1 — it does not exist. Use RREF on the augmented matrix to determine "no solution" vs "infinite solutions" and parameterize accordingly. This is why production solvers detect singularity before attempting inversion.
Where matrix math shows up in practice
- 3D graphics — every 4×4 transformation matrix (translate × rotate × scale). Game engines store thousands of these per frame.
- Neural networks — every weight tensor is a matrix (or higher-order tensor). Forward pass is matmul chains; backward pass computes gradients via transposed matmuls.
- Linear regression — OLS estimator is β = (X^T X)^-1 X^T y. Anyone who has fit a model has computed an inverse, knowingly or not (modern libraries use QR for stability).
- PCA — find eigenvectors of the data's covariance matrix. Top eigenvectors are the principal components.
- Google PageRank — power iteration on a transition matrix to find the dominant eigenvector. The original PageRank paper is two pages of matrix math.
- Markov chains — transition matrix P^n converges to the stationary distribution as n grows (for ergodic chains). Used in queuing, MCMC sampling, language models.
When to reach for this tool
- You are debugging a numpy / TensorFlow operation and want to verify the result by hand on small matrices.
- You are studying linear algebra and want a calculator that shows the intermediate steps (RREF, cofactor expansion) instead of just the answer.
- You inherited a research codebase with matrix transformations and need to verify what each step does on test inputs.
- You are computing transformations for 3D graphics or robotics by hand and want to verify the composition order before plugging into code.
What this tool will not do
- It will not handle large or sparse matrices efficiently. For matrices beyond ~10×10, use numpy / scipy / Eigen. Sparse matrices (most entries zero) need specialized representations and algorithms.
- It will not do symbolic computation. All operations are numeric. If you want exact rational arithmetic or symbolic determinants, use SymPy, Maple, or Mathematica.
- It will not detect ill-conditioning gracefully. If a matrix has condition number 10^15, computed inverses are numerical garbage; the tool will produce a result, but it should not be trusted.
All computation runs in your browser. Matrices entered are never transmitted.
Frequently asked questions
Why does my matrix multiplication "AB" work but "BA" gives a dimension error?
Because matrix multiplication is not commutative. A(m×n) × B(n×p) = AB(m×p). For BA to even be defined you need p = m. If A is 3×4 and B is 4×2, then AB is 3×2 (defined) but BA tries 4×3 × 3×2 — wait, that's actually 4×2. The issue arises when m ≠ p; check the inner dimensions of both products.
What does a determinant of zero mean geometrically?
The linear map collapses at least one dimension. A 3×3 matrix with det = 0 maps 3D space into at most a 2D plane (or a line, or a point). The image has zero volume in 3D. The matrix is singular — not invertible.
How do I know if my matrix is "ill-conditioned"?
Condition number κ(A) = ‖A‖ · ‖A^-1‖. High κ means small errors in input get amplified in output. Rule of thumb: log10(κ) is the number of decimal digits lost to roundoff. κ = 10^8 means single-precision floats (7 digits) give meaningless results; use double or rescale the problem.
What is the difference between eigenvalues and singular values?
Eigenvalues come from Av = λv (square matrices only, may be complex). Singular values come from A = UΣV^T (any rectangular matrix, always non-negative real). For symmetric positive-definite matrices they coincide. SVD is more numerically stable than eigendecomposition for most applications.
Why does my inverse calculation produce weird numbers?
Two common reasons: (1) the matrix is nearly singular — small numerical errors in input get massively amplified; (2) the matrix is integer-valued but the inverse has fractional entries that round to peculiar floats. For exact rational arithmetic, use a symbolic math system.
Can I compute matrix exponentials?
Not in this tool — matrix exponential exp(A) = I + A + A²/2! + ... requires either scaling-and-squaring or eigendecomposition. SciPy's scipy.linalg.expm is the standard reference; use it for differential equations and control theory applications.
Related tools
Solve linear, quadratic, cubic equations and systems of equations online. Step-by-step solutions with graphing. Free math equation solver calculator
Calculate mean, median, mode, standard deviation, variance and more. Statistical analysis with histograms and charts. Free online statistics calculator
Calculate with complex numbers: addition, multiplication, division, polar form, conjugate. Visualize on Argand diagram. Free complex number calculator
Plot mathematical functions and equations. Create line, scatter, parametric graphs. Free online graphing calculator and function visualizer
Calculate area, perimeter, volume of 2D and 3D shapes. Circle, triangle, rectangle, sphere, cube formulas. Free online geometry calculator with diagrams
Last updated · E-Utils editorial team