Skip to content

Matrix Calculator

Find the determinant, inverse, transpose or trace of a matrix, or add, subtract and multiply two matrices up to 10 by 10. Type rows on separate lines with entries separated by spaces or commas, using integers, decimals or fractions. Every result is computed exactly as fractions with mathjs, then also shown as decimals rounded to the places you choose. Useful for linear algebra homework, checking hand calculations and engineering work.

Reset

Frequently asked questions

How do I type a matrix?

Put each row on its own line and separate the entries with spaces or commas, for example 1 2 on the first line and 3 4 on the second. You can also separate rows with semicolons, as in 1 2; 3 4, or paste bracket notation such as [[1, 2], [3, 4]]. Every row needs the same number of entries.

Which numbers can a matrix contain?

Entries can be integers, decimals, numbers in scientific notation such as 2.5e-3, fractions such as 3/4 and repeating decimals such as 0.(3). Each entry is converted to an exact fraction before any calculation. Expressions such as sqrt(2) or pi are not accepted as entries, so use their decimal values instead.

How large can the matrices be?

Each matrix can have up to 10 rows and 10 columns, and each input can be up to 2000 characters long. Larger matrices are rejected with a size message. The limit keeps exact fraction arithmetic fast, because the numerators and denominators of an inverse can grow quickly.

Why are the results shown as fractions?

The calculator works with exact rational numbers, so the inverse of [[1, 2], [3, 4]] is shown as -2, 1, 3/2 and -1/2 instead of a rounded decimal. Whenever the result contains a non-integer value, a second block shows the same matrix as decimals rounded to the decimal places you selected. Exact values avoid the rounding errors that floating point arithmetic adds.

Which operations need a second matrix?

Addition, subtraction and multiplication use Matrix B, and the calculator asks for it when it is empty. Determinant, inverse, transpose and trace work on Matrix A alone and ignore Matrix B. The operation menu shows which matrices each choice uses.

What sizes are compatible for addition and multiplication?

A + B and A - B require both matrices to have exactly the same number of rows and columns. A × B requires the number of columns in A to equal the number of rows in B, and the result has the rows of A and the columns of B. The tool explains which rule was broken when the sizes do not fit.

Why does the inverse fail for some matrices?

Only square matrices with a nonzero determinant have an inverse. When the determinant is exactly zero the matrix is singular, and the tool reports that instead of returning a matrix of huge numbers. Because the determinant is computed exactly, the check is not affected by rounding.

What is the trace of a matrix?

The trace is the sum of the entries on the main diagonal of a square matrix. For [[1, 2], [3, 4]] the trace is 1 + 4 = 5. It equals the sum of the eigenvalues and does not change when the matrix is transposed.

How is the determinant calculated?

The tool uses the mathjs det function on exact fractions, which reduces the matrix step by step and multiplies the pivots. A 1 by 1 matrix returns its single entry and a 2 by 2 matrix returns ad - bc. Determinant, inverse and trace all require a square matrix.

Is matrix multiplication commutative here?

No, A × B and B × A are usually different, and one of them may not even be defined for the given sizes. The tool always multiplies Matrix A on the left by Matrix B on the right. Swap the two inputs if you need B × A.

About OneClick Pro

OneClick Pro is a free collection of more than 150 web tools for everyday work: converting images and units, formatting and validating code, checking domains and SEO, and working with text, dates and numbers. Every tool runs without registration or subscription, and what you enter is only used to calculate your result and is never stored. Use it as a quick toolbox for one-off tasks, or bookmark the tools you rely on every day.