About the Matrix Calculator
Matrices store numbers in rows and columns, and they are the language of linear algebra, computer graphics, economics models, statistics and machine learning. The operations themselves are simple, but they involve many small multiplications and additions, and a single slip in one entry spoils the whole answer.
This calculator performs nine matrix operations: multiplication, addition, subtraction, scalar multiplication, whole-number powers, transpose, reduced row echelon form, rank and trace. Entries can be integers, decimals or fractions, and all arithmetic is exact, so a result such as is shown as a fraction rather than a rounded decimal. Row reduction lists each row operation in order.
What is a matrix?
A matrix is a rectangular array of numbers with rows and columns, called an matrix. The entry in row and column is written . A square matrix has the same number of rows and columns, and the identity matrix has ones on its main diagonal and zeros elsewhere.
Matrices represent linear maps and systems of linear equations. Multiplying a matrix by a vector applies a transformation such as a rotation or a scaling, and multiplying two matrices composes two transformations into one.
How to use the Matrix Calculator
- Choose an operation from the list.
- Enter matrix A with spaces between entries and semicolons between rows, for example 1 2; 3 4.
- For multiply, add and subtract, enter matrix B in the same format.
- For scalar multiplication or powers, enter the number .
- Press Calculate and follow the steps to the result.
Formulas
Matrix product entry
Sum
Transpose
Trace
Worked example: A × B (2×2)
The example multiplies by . Each entry of the product is a row of dotted with a column of ; the top-left entry is .
Repeating for the other three positions gives . Swapping the order produces , a different matrix, which shows that matrix multiplication is not commutative.
The solution below is generated by the same engine that powers the calculator above.
Final answer
How we read your problem
Compute A × B exactly.
Step-by-step solution
Read matrix A
Read matrix B
Each entry is a row of A dotted with a column of B
The result is 2×2.
Result
Formulas used
Matrix product
A is 2×2 and B is 2×2, so AB is 2×2. Matrix multiplication is not commutative: BA is generally different.
Verification
- All arithmetic is exact (fractions, no rounding).
Detailed explanation
When operations are defined
Addition and subtraction need matrices of exactly the same size and work entry by entry. Multiplication needs the number of columns of to equal the number of rows of ; an matrix times an matrix gives an result. A matrix cannot multiply a matrix, and the calculator explains the size mismatch rather than returning an error code.
Powers are defined only for square matrices, because needs matching sizes. Raising to the fifth power gives , whose entries are Fibonacci numbers.
Row reduction and rank
Reduced row echelon form (RREF) is obtained with three row operations: swapping two rows, multiplying a row by a nonzero number and adding a multiple of one row to another. The goal is a leading 1 in each nonzero row, with zeros above and below it. RREF is the standard way to solve linear systems, find a basis and test independence.
The rank is the number of nonzero rows in the RREF, which equals the number of linearly independent rows or columns. The matrix reduces to a form with a zero row, so its rank is 2: the third row is a combination of the first two.
Transpose and trace
The transpose flips a matrix across its main diagonal, turning rows into columns. It appears in dot products, least-squares fitting and the definition of symmetric matrices, which equal their own transpose. The trace adds the diagonal entries of a square matrix; it equals the sum of the eigenvalues, which makes it a quick check on eigenvalue calculations.
Common mistakes
- Multiplying matrices entry by entry instead of rows by columns.
- Assuming ; the order of factors matters.
- Trying to add matrices of different sizes.
- Reading the product size wrongly; an times product is .
- Changing a row by multiplying it by zero during row reduction, which loses information.
Tips
- Write the sizes next to each matrix before multiplying to confirm the product exists.
- Use fractions rather than rounded decimals to keep row reduction exact.
- Check a product by computing one entry by hand.
- Use the determinant calculator to test whether a square matrix is invertible.
- Use the systems of equations calculator when your matrix comes from a linear system.
Frequently asked questions
How do I enter a matrix?
Separate entries in a row with spaces or commas and separate rows with semicolons. For example, 1 2; 3 4 is the 2×2 matrix with rows (1, 2) and (3, 4).
Why is matrix multiplication not commutative?
AB combines rows of A with columns of B, while BA combines rows of B with columns of A. These are different calculations, so the results usually differ, and one product may exist while the other does not.
When can two matrices be multiplied?
When the number of columns of the first equals the number of rows of the second. The product has the row count of the first and the column count of the second.
What is reduced row echelon form?
A form in which each nonzero row starts with a leading 1, each leading 1 is to the right of the one above, and every other entry in a leading 1's column is zero.
What does the rank of a matrix tell me?
The number of linearly independent rows or columns. For a square matrix, full rank means the matrix is invertible and the related linear system has a unique solution.
Can I use fractions in the matrix?
Yes. Entries such as 1/2 are accepted, and all results are computed with exact fractions.
What is the trace of a matrix?
The sum of the entries on the main diagonal of a square matrix. It also equals the sum of the matrix's eigenvalues.
Run your matrix operation
Enter your matrices above to multiply, reduce or analyse them with exact fractions and every step shown.