How to use the matrix calculator
- Choose an operation. Multiply, Add and Subtract use two matrices, A and B; the rest use A only.
- Type or paste each matrix, one row per line, with spaces or commas between the numbers. Fractions such as 3/4 and decimals are fine.
- The answer appears as you type, with each step and a summary of A: its size, rank, determinant, trace, and whether it is invertible and symmetric. Use result as A to keep going, for example to multiply the inverse by another matrix.
What a matrix is
OpenStax’s Precalculus puts it simply: “A matrix is a rectangular array of numbers that is usually named by a capital letter”. Its size is written rows × columns, so a 2 × 3 matrix has 2 rows and 3 columns. Matrices store tables of numbers, such as the coefficients of a system of equations, the pixels of an image or the links between web pages, and the operations below let you work with the whole table at once.
Adding, subtracting and multiplying by a number
To add or subtract, combine the entries in matching positions. That is why “addition and subtraction of matrices is only possible when the matrices have the same dimensions.” Multiplying by a number, called scalar multiplication, multiplies every entry: 3 × [1, 2], [3, 4] is [3, 6], [9, 12].
Multiplying two matrices
Each entry of A × B is a row of A times a column of B: multiply matching entries and add them up. For A = [1, 2], [3, 4] and B = [5, 6], [7, 8], the top-left entry is 1·5 + 2·7 = 19, and the whole product is [19, 22], [43, 50]. The product only exists when A has as many columns as B has rows, and the result has A’s number of rows and B’s number of columns, so a 2 × 3 matrix times a 3 × 2 matrix gives a 2 × 2 matrix.
Order matters. OpenStax notes that “matrix multiplication is not commutative”: B × A for the same two matrices is [23, 34], [31, 46], which is different. The calculator shows every entry’s working for products up to 3 × 3.
The determinant
The determinant is a single number worked out from a square matrix. For a 2 × 2 matrix [a, b], [c, d] it is ad − bc. For a 3 × 3 matrix you can expand along the first row, multiplying each entry by the 2 × 2 determinant left when you cross out its row and column, with alternating signs. For [1, 2, 3], [4, 5, 6], [7, 8, 10], that gives −3. For larger matrices, the calculator uses row reduction to an upper triangular form, where the determinant is the product of the diagonal, with the sign flipped for each row swap. That works quickly at any size.
The determinant tells you whether a matrix can be inverted: when it is 0, the matrix is singular and has no inverse. Its size also measures how much the matrix stretches area or volume.
The inverse of a matrix
The inverse A⁻¹ undoes A, just as dividing undoes multiplying. A matrix times its inverse gives the identity matrix, which is “a square matrix containing ones down the main diagonal and zeros everywhere else.” As OpenStax explains, “Only a square matrix may have a multiplicative inverse”, and only when its determinant isn’t 0.
To find it, the calculator writes the identity matrix beside A and row-reduces until the left half becomes the identity. The right half is then the inverse. For a 2 × 2 matrix there is a shortcut: swap a and d, change the signs of b and c, and divide by ad − bc. For [4, 7], [2, 6] that gives [3/5, −7/10], [−1/5, 2/5].
Row echelon form, rank and LU
Row reduction uses three operations that keep a matrix’s essential information: swap two rows, multiply a row by a non-zero number, and add a multiple of one row to another. Reduced row echelon form (RREF) is the end point, with a leading 1 in each non-zero row and zeros above and below it. The rank is the number of those leading 1s, or pivots: the number of independent rows. A square matrix of full rank is invertible.
LU decomposition records the same elimination as two triangular matrices: U is what elimination leaves, and L holds the multipliers used. When rows have to be swapped, a permutation matrix P records the swaps, so PA = LU. Solving many systems with the same A is faster with L and U already found.
Eigenvalues and eigenvectors
An eigenvector of A is a vector that A only stretches: Av = λv, where the number λ is its eigenvalue. The eigenvalues are the roots of the characteristic polynomial det(λI − A). For [2, 0, 0], [0, 3, 4], [0, 4, 9], that polynomial is λ³ − 14λ² + 35λ − 22, and the eigenvalues are 11, 2, 1. The calculator finds whole-number and fraction eigenvalues exactly, gives square-root ones in exact form, and finds the rest numerically. Each real eigenvalue comes with its eigenvectors.
Powers, transpose and trace
- A power such as A⁵ multiplies A by itself; the calculator uses repeated squaring, so even A³² takes only a few multiplications. A negative power uses the inverse. [1, 1], [1, 0] to the power n gives Fibonacci numbers.
- The transpose Aᵀ turns rows into columns.
- The trace is the sum of the main diagonal, and it equals the sum of the eigenvalues.
Where matrices are used
Systems of linear equations are the classic use: the coefficients form a matrix A, the right-hand sides form a column b, and the solution is x = A⁻¹b when A is invertible. Computer graphics rotate, scale and move shapes by multiplying their coordinates by matrices. Economists track how industries feed each other with input-output matrices, statisticians fit regression lines with them, and search engines ranked web pages using an eigenvector of a huge matrix of links. Markov chains, which model anything that moves between states with fixed chances, are powers of a matrix.
Your data stays on your device
Everything is worked out in your browser. Nothing you type is sent anywhere or stored.
Frequently asked questions
How do I enter a matrix?
Type one row per line, with the numbers separated by spaces or commas, such as 1 2 3 on the first line and 4 5 6 on the next. Fractions (3/4), decimals, negative numbers and e-notation (2e3) all work, and so does [[1,2],[3,4]]. You can paste straight from a spreadsheet, and Copy result puts the answer back in spreadsheet form.
Why can’t I multiply these two matrices?
A × B needs A to have as many columns as B has rows. A 2 × 3 matrix can multiply a 3 × 2 matrix, giving a 2 × 2 result, but not a 2 × 2 matrix. Addition and subtraction need matrices of exactly the same size.
Why does my matrix have no inverse?
Only square matrices can have an inverse, and only when the determinant is not 0. A matrix with a determinant of 0 is called singular: one row is a combination of the others, so row reduction produces a row of zeros and can’t reach the identity matrix.
Is A × B the same as B × A?
Usually not. Matrix multiplication is not commutative: with A = [1, 2], [3, 4] and B = [5, 6], [7, 8], A × B is [19, 22], [43, 50] but B × A is [23, 34], [31, 46].
Are the answers exact?
Yes. Every operation uses exact fractions, so an inverse comes out as 3/5 rather than 0.6000001. Choose Decimals to see the same numbers to 6 significant figures. Eigenvalues are exact when they are whole numbers, fractions or square roots; otherwise they are given to 6 significant figures.
Is anything I type saved or sent?
No. Everything is worked out in your browser and nothing you type is sent anywhere or stored.