When the number of columns of the first (A) equals the number of rows of the second (B). The result has A's rows and B's columns. Matrix multiplication is not commutative: A×B ≠ B×A in general.
Addition, product, inverse, determinant, rank and echelon form.
A matrix is a rectangular array of numbers arranged in rows and columns, the central object of linear algebra. This calculator performs the standard operations on real matrices up to 6×6: addition and subtraction (which act entry by entry and require identical dimensions), scalar multiplication, matrix multiplication (defined only when A's column count equals B's row count), and transposition (swapping rows and columns). For square matrices it computes the determinant by Gaussian elimination with partial pivoting, reducing to triangular form and multiplying the pivots, the inverse by the Gauss-Jordan method on the augmented matrix [A | I] → [I | A⁻¹], the rank, and the reduced row echelon form (RREF). Computations use 64-bit floating point, and values within 10⁻¹⁰ of an integer are cleaned up so results read cleanly. A matrix with determinant 0 is singular and reported as having no inverse.
Addition and subtraction act position by position and only exist between matrices of the same dimension. Multiplication A × B requires A's column count to equal B's row count; each entry of the result is the sum of products of a row of A with a column of B (cᵢⱼ = Σ aᵢₖ · bₖⱼ). The transpose Aᵀ simply swaps rows and columns.
For square matrices, the determinant comes from Gaussian elimination (product of the pivots, flipping sign on each row swap), the inverse from Gauss-Jordan, and the rank from counting the pivots in the reduced row echelon form (RREF). Only matrices with a non-zero determinant have an inverse.
Example 1, product: A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]]. Entry (1,1) is 1·5 + 2·7 = 19; continuing this way, A × B = [[19, 22], [43, 50]].
Example 2, determinant and inverse: for M = [[4, 7], [2, 6]], the determinant is 4·6 − 7·2 = 24 − 14 = 10. Since it is non-zero, the inverse exists: M⁻¹ = (1/10)·[[6, −7], [−2, 4]] = [[0.6, −0.7], [−0.2, 0.4]].
Matrix multiplication is not commutative: in general A × B ≠ B × A, and the order of the factors matters. Common mistakes are trying to add matrices of different sizes or inverting a singular matrix (determinant 0), cases where the tool shows a specific message.
Matrices describe linear systems, geometric transformations (rotation, scaling, projection), graphs, Markov chains, and data in machine learning. RREF and rank reveal whether a system has a unique solution, infinitely many, or none.
Paste the code into your HTML and the tool shows up on your page, without J-Kit's navigation and ads. It still runs in the browser of whoever visits your site.
<iframe
src="https://jkit.tools/embed/en-US/matrix-calculator"
width="100%"
height="600"
style="border:0"
loading="lazy"
title="Matrix Calculator"
></iframe>These references help contextualize formulas, standards, APIs and limitations used on this page. They do not replace professional validation when a result has legal, financial, medical or operational impact.
When the number of columns of the first (A) equals the number of rows of the second (B). The result has A's rows and B's columns. Matrix multiplication is not commutative: A×B ≠ B×A in general.
Calculations run in your browser. No data is sent to a server.