More games at WuGames.ioSponsoredDiscover free browser games — play instantly, no download, no sign-up.Play

Matrix Calculator

Compute matrix determinant, inverse, eigenvalues, rank, trace, solve Ax=b and the condition number online. Step-by-step linear algebra for students, engineers.

What is a Matrix Calculator?

A matrix calculator performs the standard operations of linear algebra on rectangular arrays of numbers: determinant, inverse, transpose, eigenvalues and eigenvectors, addition, subtraction, multiplication by a scalar, and the row-by-column product of two matrices. Each of these operations turns out to mean something concrete — areas being scaled, points being rotated, equations being solved — once you look past the symbol-pushing.

Matrices are the language we use whenever we need to talk about many quantities at once: the position of every vertex in a 3D model, the connection weights between layers of a neural network, the probability of moving between states in a Markov chain, the stresses inside a steel beam. Computers manipulate matrices so often that GPU manufacturers have spent two decades building hardware whose only job is to multiply small matrices very fast.

Matrix Operations

Determinant

The determinant is a single scalar attached to every square matrix. Geometrically, |det(A)| tells you the factor by which A scales areas (in 2D), volumes (in 3D) or higher-dimensional measures; the sign tells you whether A flips orientation. A determinant of zero means the matrix collapses space into a lower dimension — three vectors that all lie in a plane have a 3×3 determinant of zero — and that is exactly when the matrix has no inverse.

For a 2×2 matrix [[a,b],[c,d]], the determinant is: ad − bc

Matrix Inverse

The inverse A⁻¹ of a square matrix A is the matrix that undoes A: A·A⁻¹ = A⁻¹·A = I, the identity matrix. Only square matrices with non-zero determinant have an inverse. In practice, the inverse is the cleanest way to write the solution to a linear system Ax = b: x = A⁻¹b. In numerical work, however, software almost never explicitly computes A⁻¹ — it solves the system directly with LU decomposition, which is faster and more stable.

For a matrix A, if A × A⁻¹ = I (identity matrix), then A⁻¹ is the inverse of A.

Transpose

The transpose Aᵀ flips a matrix over its main diagonal: the (i, j) entry moves to (j, i). Rows become columns. For an m × n matrix, Aᵀ is n × m. The transpose shows up everywhere: in the dot product (xᵀy), in symmetric matrices (A = Aᵀ), in least-squares fitting (the normal equations AᵀA x = Aᵀb), and in the relationship between row space and column space.

If A = [[1,2],[3,4]], then Aᵀ = [[1,3],[2,4]]

Eigenvalues and Eigenvectors

An eigenvector of a matrix A is a non-zero vector v whose direction is left unchanged by A — only its length is scaled. The scaling factor is the eigenvalue λ, defined by Av = λv. Eigenvectors point along the natural axes of whatever transformation A represents; eigenvalues tell you how stretched or compressed each axis becomes.

Eigenvalues are central to principal component analysis (the eigenvectors of the covariance matrix become the new axes that capture maximum variance), Google's original PageRank (the eigenvector of a particular stochastic matrix gives every web page's importance), vibration analysis (natural frequencies are the square roots of eigenvalues of a mass-stiffness matrix), and quantum mechanics (energy levels are eigenvalues of the Hamiltonian operator).

Matrix Addition and Subtraction

Matrices of the same dimensions are added or subtracted element-by-element: (A + B)ᵢⱼ = Aᵢⱼ + Bᵢⱼ. Two matrices of different shapes cannot be added — there is no sensible way to align their entries.

Matrix Multiplication

The product A·B is computed by taking the dot product of each row of A with each column of B. For the multiplication to be defined, the number of columns of A must equal the number of rows of B. Matrix multiplication is not commutative — A·B is generally different from B·A — but it is associative, so (AB)C = A(BC).

If A is m×n and B is n×p, then A × B is m×p.

Scalar Multiplication

Multiplying a matrix by a scalar k means multiplying every entry by k: (kA)ᵢⱼ = k · Aᵢⱼ. The determinant of (kA) for an n × n matrix is kⁿ times the determinant of A.

Solving Systems & Conditioning

The 'Solve Ax = b' operation finds the vector x that satisfies a square linear system. Enter the coefficient matrix as A and the right-hand side as a single-column b, then Calculate. Internally the tool uses LU decomposition (math.lusolve) rather than forming A⁻¹b — the same approach professional numerical libraries use, because it is faster and far more numerically stable than an explicit inverse.

For every square operation the calculator also reports a condition number κ(A) ≈ ‖A‖₁·‖A⁻¹‖₁. The condition number measures how much the solution x can amplify small errors in A or b. A value near 1 is ideal; under 1000 is well-conditioned; between 1000 and 1,000,000 is borderline — round-off may already cost several digits; above 1,000,000 the matrix is ill-conditioned and near-singular, meaning the computed answer can be dominated by floating-point noise even though a 'solution' is returned. Always read the verdict before trusting an inverse or a system solution in engineering work.

Applications of Matrices

Matrices are not abstract — they power most of the technology around you:

  • Computer Graphics: every 3D rotation, scaling, and translation is encoded as a 4×4 matrix; GPUs are essentially fast 4×4 multipliers
  • Physics: quantum operators, special relativity (Lorentz transformations), continuum mechanics (stress and strain tensors)
  • Engineering: finite-element analysis (stiffness matrices), control systems (state-space models), circuit analysis (admittance matrices)
  • Economics: input-output (Leontief) models, game-theory payoff matrices
  • Statistics: covariance matrices, multivariate regression, design matrices in experimental design
  • Machine Learning: neural networks are stacks of matrix multiplications with non-linearities in between; training adjusts the weight matrices
  • Cryptography: matrix-based ciphers (Hill cipher), error-correcting codes (Reed-Solomon)
Matrix Calculator — Compute matrix determinant, inverse, eigenvalues, rank, trace, solve Ax=b and the condition number online. Step-by-step
Matrix Calculator

Tips for Using the Matrix Calculator

  • Ensure your matrix dimensions are correct for the operation you want to perform
  • For inverse calculation, the matrix must be square and have a non-zero determinant
  • Eigenvalues can only be calculated for square matrices
  • For matrix multiplication, verify that the number of columns in the first matrix equals the number of rows in the second
  • Use the transpose operation to convert row vectors to column vectors and vice versa

Frequently Asked Questions

Pick 'Solve Ax = b' from the operation menu. Enter your square coefficient matrix as Matrix A — one row per equation, one column per unknown. A 'Vector b' block appears: make it a single column with the same number of rows as A (use Add/Remove row to match), and type the right-hand-side constants. Press Calculate and the tool returns the solution vector x as a column. Under the hood it uses LU decomposition (lusolve), not an explicit inverse, so it is fast and numerically stable. For example, for 2x + y = 3 and x + 3y = 5, enter A = [[2,1],[1,3]] and b = [[3],[5]]; the solution is x ≈ [0.8, 1.4]. If A is singular you'll get a 'matrix is singular' error — the system then has either no solution or infinitely many.

Whenever you run determinant, inverse or Solve Ax = b on a square matrix, the Calculation box shows a line like 'Condition number ≈ 4.2 (well-conditioned)'. The condition number κ(A) estimates how much the answer can amplify tiny errors in your inputs or in floating-point round-off. The verdicts are: well-conditioned (κ < 1000) — trust the result; borderline (1000–1,000,000) — you may have already lost several significant digits, double-check sensitive results; ill-conditioned / near-singular (κ > 1,000,000 or ∞) — the matrix is almost non-invertible, and the computed x or A⁻¹ can be mostly numerical noise even though a number is returned. A near-zero determinant is the classic warning sign of a high condition number: the matrix is technically invertible but practically unreliable. In that case reformulate the problem, rescale your units, or use a least-squares / regularized approach instead of a raw inverse.

Forget the formula for a moment. Take the two columns of a 2×2 matrix and draw them as arrows from the origin. They span a parallelogram. The signed area of that parallelogram is the determinant. For a 3×3 matrix, the three columns span a parallelepiped, and its signed volume is the determinant. In n dimensions, the columns span an n-dimensional 'box', and the determinant is the signed n-volume. So |det(A)| answers the question 'by what factor does this matrix scale areas (or volumes, or hyper-volumes)?'. The sign answers 'does it flip orientation?' — a 2D rotation has det = +1 (no flip), a reflection has det = −1 (flip). A determinant of 0 means the columns are linearly dependent — they collapse the box flat, into a region of lower dimension — and that is exactly when the matrix has no inverse: you cannot recover an n-dimensional input from a (n−1)-dimensional output.

Because an inverse must undo the matrix's action in both directions. A 3×2 matrix takes a 2-vector and produces a 3-vector — it maps 2D space into 3D space. There is simply no 2×3 matrix that, when applied to an arbitrary 3-vector, recovers the original 2-vector — most 3-vectors are not in the image of the original map. Formally, AB = I requires A to be n × m and B to be m × n, and that constraint plus 'true inverse' (both AB = I AND BA = I) forces m = n. For rectangular matrices, though, there is the Moore–Penrose pseudoinverse A⁺: it gives the least-squares solution to Ax = b when no exact solution exists (over-determined) or picks the minimum-norm solution among many (under-determined). The pseudoinverse is what makes linear regression work — the normal equations are essentially x = (AᵀA)⁻¹Aᵀb = A⁺b.

Because each matrix represents a transformation, and the order in which you apply transformations matters in general. Try this: take a book, rotate it 90° around the vertical axis, then 90° around the horizontal axis. Now reset and do the rotations in the opposite order. The book ends up pointing in different directions. Matrix multiplication encodes exactly this 'do A first, then do B' compositional structure, and the order is baked into the definition. There are exceptions — any matrix commutes with the identity, with itself, and with its own powers; diagonal matrices commute with each other; rotations in 2D commute (because 2D rotations form an abelian group). But in general, AB ≠ BA, and getting the order wrong is one of the most common bugs in graphics and physics code. The first time a beginner multiplies a model matrix by a view matrix in the wrong order in OpenGL, the scene disappears.

Imagine the matrix A as a transformation that stretches, rotates and skews vectors. Most vectors come out pointing in a different direction than they started. Eigenvectors are the rare vectors that come out pointing in the same direction (or exactly opposite) — A only stretches them by a factor λ, the eigenvalue. So eigenvalues and eigenvectors expose the natural axes of whatever transformation A represents. If A is a 2D rotation, it has no real eigenvectors at all (every vector rotates), but it has complex eigenvalues whose magnitude reveals the rotation. If A is symmetric, it has n real orthogonal eigenvectors that form the principal axes of an ellipse (or ellipsoid). In PCA, those axes are the directions of greatest variance in the data. In Google's original PageRank, the dominant eigenvector of the web's transition matrix lists every page's long-run probability of being visited by a random surfer. In structural engineering, the smallest eigenvalue of a stiffness matrix predicts when a column will buckle. Eigenvalues are how a matrix tells you its own diagonal.

A square matrix is singular when its determinant is zero, which happens exactly when its columns are linearly dependent — at least one column is a combination of the others. Geometrically, the matrix flattens space: a 3×3 matrix with two columns in the same plane maps every 3D point onto a 2D plane, losing one dimension forever. For Ax = b this is dramatic. If b happens to lie in the squashed image, the system has infinitely many solutions (any vector in the kernel of A can be added to one particular solution and still solve it). If b lies outside the image, the system has no solutions at all. Software detects this with a 'rank-deficient' or 'matrix is singular' error. The fix in practice is least-squares: use the pseudoinverse A⁺ to find the x that minimises ‖Ax − b‖² — which gives a unique answer even when A is singular or rectangular. Singular doesn't mean broken; it means you have to be careful about what 'solving' means.

The rank of a matrix is the dimension of its column space — equivalently, the number of linearly independent columns (or rows; they agree). A 5×5 matrix can have rank anywhere from 0 (the zero matrix) to 5 (full rank, invertible). Geometrically, rank is the dimension of the image: a 3×3 matrix of rank 2 maps 3D space onto a 2D plane. Rank matters because it tells you how much information the matrix preserves. A full-rank matrix is invertible, has a non-zero determinant, has n non-zero eigenvalues, and lets Ax = b have a unique solution for every b. A rank-deficient matrix collapses something — a dimension, a degree of freedom, an independent measurement. In data science, the rank of a matrix of measurements tells you how many truly independent variables you have; if a dataset's 100-column matrix has rank 12, only 12 directions of variation exist and the rest are redundant. The singular value decomposition exposes this directly: the number of non-zero singular values equals the rank.

Because matrices encode linear transformations, and the row-times-column rule makes composing two transformations equivalent to multiplying their matrices. Think of a matrix as a function: column j tells you where the basis vector eⱼ goes. If matrix B sends eⱼ to column Bⱼ, and matrix A sends each vector v to Av, then to find where (AB)eⱼ lands you compute A(Bⱼ) — which is exactly column j of A·B when you use the standard rule. So the strange definition isn't arbitrary; it is forced on us by the demand 'multiplying matrices = composing the transformations they represent'. This is also why matrix multiplication is associative: composing functions is associative. And why it isn't commutative: function composition usually isn't. Once you see matrices as functions and multiplication as composition, everything else follows. The 'dot product of row and column' shorthand is just the most efficient way to evaluate one specific entry.

Almost anywhere a computer does interesting work. Every pixel you see in a 3D game has been transformed by a chain of 4×4 matrices: model matrix (object position), view matrix (camera), projection matrix (lens), then a few more for shadows and post-processing. Each pixel runs through dozens of matrix multiplications per frame, sixty times per second — that's why GPUs exist. The recommendation system showing you what to watch next is built on a low-rank approximation of a giant user-item matrix. Google's PageRank ranked the early web with the dominant eigenvector of a sparse stochastic matrix. Your phone's GPS fuses signals using Kalman filters, which are matrix updates. Neural networks are essentially deep stacks of matrix multiplications interleaved with non-linearities; training a large language model means adjusting matrices with billions of entries. MRI scans reconstruct images by inverting sparse matrices in Fourier space. Even your morning coffee machine, if it uses PID control, depends on a 2×2 system matrix tuned for stable response. Linear algebra didn't stay in the lecture hall — it became infrastructure.