Matrix Calculator
Matrix A
Matrix B
What each operation is really doing
Addition and subtraction are the only operations that work element by element: each entry of the answer is the sum or difference of the two entries in the same position, which is why both matrices must be the same size. Multiplication is not element-wise at all. Each entry of A × B is a row of A dotted with a column of B — row one of A against column one of B for the top-left entry, and so on — which is why the order matters and A × B is generally not B × A. On the defaults above, A × B can be checked by hand for one entry: the top-left is 6×2 + 1×1 + 1×0 = 13. The transpose flips a matrix over its diagonal, swapping rows and columns. The scalar operation is the simple one: every entry multiplied by the same number.
The determinant and the inverse, in plain terms
The determinant is a single number that measures how a matrix scales space. A 2×2 determinant is ad − bc; the defaults for A, the 3×3 matrix with rows 6 1 1 / 4 −2 5 / 2 8 7, give −306. Two facts about it earn their keep. Its size is the factor by which areas (in 2D) or volumes (in 3D) are stretched — here, 306 times, with the negative sign recording that orientation flips. And a determinant of exactly zero means the matrix flattens space into a lower dimension, which is why such a matrix has no inverse: you cannot un-flatten what has lost a dimension. The inverse, when it exists, is the matrix that undoes A — A × A⁻¹ is the identity matrix — and it is the engine behind solving simultaneous equations: the solution of Ax = b is simply A⁻¹b. This calculator finds it by Gauss-Jordan elimination with partial pivoting, the numerically careful version, and tells you plainly when a matrix is singular instead of returning near-zero garbage. Floating-point honesty matters: results are rounded to ten significant digits for display, and a matrix that is merely close to singular will produce a large, unstable inverse — the mathematics is warning you, and the page will not hide it.
Where matrices stop being homework
The same operations run underneath a surprising amount of the modern world. Computer graphics is matrix multiplication at industrial scale — every rotation, projection and camera move in a game or a film is a 4×4 matrix of exactly the kind this page handles, multiplied against millions of points. Simultaneous equations from circuit analysis, structural engineering and economics are solved by inversion or elimination. Search ranking, recommendation systems and neural networks are, at their computational core, very large matrices being multiplied very fast. Learning the 3×3 case by hand is not nostalgia; it is the smallest size at which every real behaviour — non-commutativity, singular matrices, the determinant's meaning — is already present.
Frequently asked questions
How do you multiply two matrices?
Entry by entry, but not the way addition works: the entry in row i, column j of the product is row i of the first matrix dotted with column j of the second — each pair multiplied, then summed. For the defaults on this page, the top-left entry of A × B is 6×2 + 1×1 + 1×0 = 13. Two consequences follow. The inner dimensions must match (here both are square, so any size works), and order matters: A × B and B × A are both defined for square matrices but are usually different matrices. If you are checking your homework, compute one entry by hand this way — if it matches, the rest of the grid almost certainly does too.
What does a determinant of zero mean?
That the matrix is singular: it squashes space into a lower dimension — a plane into a line, a line into a point — and information is destroyed in the process. Practically, three things follow: the matrix has no inverse, the system of equations it represents has either no solution or infinitely many, and at least one row or column is a combination of the others. The classic 2×2 case is [[1, 2], [2, 4]], where the second row is exactly double the first and the determinant is 1×4 − 2×2 = 0. This calculator reports singularity plainly rather than dividing by something near zero and printing an enormous, meaningless inverse.
How is the inverse of a matrix calculated?
Here, by Gauss-Jordan elimination: the matrix is written next to an identity matrix, and row operations — swapping rows, scaling a row, subtracting multiples of one row from another — are applied to both until the original becomes the identity, at which point the identity has become the inverse. Partial pivoting (always dividing by the largest available entry in each column) keeps rounding errors small. You can verify any inverse this page returns in seconds: multiply it by the original matrix with the A × B operation, after swapping it into B, and you should get the identity matrix back, ones on the diagonal and zeros elsewhere.
Can a non-square matrix have a determinant or an inverse?
No to both, in the standard sense. The determinant is defined only for square matrices — it is the scaling factor of a transformation that maps a space to itself — and only a square matrix can have a two-sided inverse. Rectangular matrices still add, subtract, transpose and multiply (when the inner dimensions match), and they have generalisations like the pseudoinverse used in least-squares fitting, but those are different objects with different rules. That is why this calculator keeps A and B the same square size: every operation on the menu is always defined, and the one genuine failure case — a singular matrix — is reported honestly.
Why is matrix multiplication not commutative?
Because the operations it represents do not commute in the real world. A matrix is a transformation — a rotation, a stretch, a projection — and doing them in different orders gives different results: rotate a book 90 degrees then tip it forward, versus tip it forward then rotate, and it ends in a different orientation. The algebra inherits that: A × B applies B first, then A, and swapping the order applies a genuinely different sequence. The numbers show it too — with this page's defaults, A × B and B × A (swap the matrices and multiply again) differ in almost every entry. Addition and scalar multiplication do commute; it is specifically composition of transformations that does not.
Related tools
Algorithms last verified in Node against known determinants, products and inverses: 24 November 2026. Everything is calculated in your browser — nothing you type is sent anywhere.