Matrix Calculator
Enter your matrix values and instantly calculate addition, subtraction, multiplication, determinant, inverse, transpose, trace, powers, and more with clear step-by-step results.
Matrix A: 3×3 · Matrix B: 3×3
Was this calculator helpful?
Your feedback helps us improve our calculators.
What Is a Matrix Calculator?
A matrix calculator is an online mathematical tool that performs calculations on matrices, a rectangular arrangement of numbers organized into rows and columns.
For example, this is a (2×3) matrix:
A=[214365]
The notation (2×3) means the matrix contains 2 rows and 3 columns.
Instead of manually carrying out lengthy calculations, an online matrix calculator can evaluate the matrix according to the operation you select and show the resulting matrix or value.
This matrices calculator supports:
Matrix addition
Matrix subtraction
Matrix multiplication
Determinant
Matrix inverse
Transpose
Trace
Matrix power
Scalar multiplication
Row echelon form
LU decomposition
Some operations use one matrix, while addition, subtraction, and matrix multiplication require two matrices.
How to Use the Matrix Calculator
The required inputs depend on the operation you select. Follow these steps:
Choose a matrix operation: Select Add, Subtract, Multiply, Det(A), Inverse, Transpose, Trace, Power, Multiply by, Row echelon, or LU decomposition.
Select the size of Matrix A: Choose the number of rows and columns for Matrix A.
Set Matrix B dimensions when required: For operations involving two matrices, enter or select the required dimensions for Matrix B. For multiplication, its dimensions must be compatible with Matrix A.
Enter the matrix elements: Type each number into its corresponding row and column.
Enter an additional value if needed: For Power, select the exponent. For Multiply by, enter scalar (k).
Click Calculate: The calculator performs the selected operation.
Review the result: Depending on the operation, you may see the resulting matrix or value, result size, determinant, trace, rank, invertibility, exponent, multiplier, and calculation steps.
Use Clear when you want to reset the entered values and start another calculation.
Matrix Dimensions Explained
Matrix dimensions are written as:
m×n
where:
(m) = number of rows
(n) = number of columns
For example:
A=[142536]
has 2 rows and 3 columns, so its size is:
2×3
Dimensions matter because different matrix operations have different compatibility requirements.
Matrix Operation Rules
Before calculating, it helps to understand which matrix sizes can be used together.
Operation | Main Requirement |
Addition | Matrices must have the same dimensions |
Subtraction | Matrices must have the same dimensions |
Multiplication | Columns of (A) must equal rows of (B) |
Determinant | Requires a square matrix |
Inverse | Requires an invertible square matrix |
Transpose | Works with square or rectangular matrices |
Trace | Requires a square matrix |
Power | Ordinary matrix powers require a square matrix |
Scalar multiplication | Each element is multiplied by the scalar |
Row echelon | Uses elementary row operations |
LU decomposition | Factors a matrix into lower and upper triangular matrices |
These requirements are important because matrix operations do not always follow the same rules as ordinary arithmetic.
Matrix Addition
Matrix addition combines two matrices by adding elements in matching positions.
If:
A=[aij]
and:
B=[bij]
then:
C=A+B
where:
cij=aij+bij
The two matrices must have identical dimensions.
For example:
[2435]+[1267]=[36912]
Each entry in Matrix A is simply added to the entry in the same position in Matrix B.
A matrix addition calculator is especially helpful with larger matrices, where performing every element-wise calculation manually can become repetitive.
Matrix Subtraction
Matrix subtraction follows the same compatibility rule as addition: both matrices must have the same dimensions.
The formula is:
C=A−B
For each corresponding element:
cij=aij−bij
For example:
[8659][3124][5535]
Subtracting matrices of different dimensions is not defined because their elements cannot be matched position by position.
Matrix Multiplication
Matrix multiplication is different from simply multiplying elements in matching positions.
To multiply Matrix (A) by Matrix (B), the number of columns in A must equal the number of rows in B.
If:
Am×n
and:
Bn×p
then:
AB=Cm×p
The resulting matrix therefore has the number of rows from (A) and the number of columns from (B).
Each element is calculated using:
cij=∑k=1naikbkj
In simple terms, take a row from Matrix A, multiply its entries by the corresponding entries in a column from Matrix B, and add those products.
Matrix Multiplication Example
Suppose:
A=[1324]
and:
B=[5768]
Then:
AB=[1(5)+2(7)3(5)+4(7)1(6)+2(8)3(6)+4(8)]
Calculate each entry:
AB=[5+1415+286+1618+32]
Therefore:
AB=[19432250]
A matrix multiplication calculator performs these row-by-column calculations automatically, which becomes especially useful as matrix dimensions increase.
Matrix Multiplication Dimension Example
Suppose:
A=3×2
and:
B=2×4
Multiplication is possible because the two inner dimensions match:
(3×2)(2×4)
The result is:
AB=3×4
However:
(3×2)(3×4)
is not valid for (AB), because Matrix A has 2 columns while Matrix B has 3 rows.
Determinant of a Matrix
The determinant is a single numerical value calculated from a square matrix. It provides important information about the matrix, including whether the matrix can have an inverse.
The determinant is commonly written as:
det(A)
or:
∣A∣
For a (2×2) matrix:
A=[acbd]
the determinant is:
det(A)=ad−bc
For example:
A=[4325]
Then:
det(A)=(4)(5)−(2)(3)
det(A)=20−6=14
For larger matrices, determinants can be found using methods such as cofactor expansion or elimination.
One particularly important result is:
det(A)=0
A square matrix with a zero determinant is singular, which means it does not have an ordinary inverse.
Matrix Inverse
The inverse of Matrix (A) is written as:
A−1
It behaves somewhat like the reciprocal of a number. Multiplying an invertible matrix by its inverse produces the identity matrix:
AA−1=A−1A=I
where (I) represents the identity matrix.
For a (2×2) matrix:
A=[acbd]
the inverse is:
A−1=ad−bc1[d−c−ba]
An inverse exists only when:
det(A)=0
If:
det(A)=0
the matrix is singular and cannot be inverted using the ordinary matrix inverse.
The calculator can therefore display the determinant and indicate whether the entered matrix is invertible.
Matrix Transpose
The transpose switches the rows and columns of a matrix.
It is written as:
AT
Mathematically:
(AT)ij=Aji
Suppose:
A=[142536]
Then:
AT=123456
Notice that the first row of (A) becomes the first column of (A^T).
If the original matrix is:
m×n
its transpose has dimensions:
n×m
Unlike determinants, inverses, and traces, a matrix does not need to be square to be transposed.
Matrix Trace
The trace of a square matrix is the sum of all elements on its main diagonal, running from the upper-left to the lower-right.
For an (n×n) matrix:
tr(A)=∑i=1naii
For example:
A=236458179
The main diagonal contains:
2,;5,;9
Therefore:
tr(A)=2+5+9=16
The trace is defined for square matrices and should not be confused with the determinant. Both produce a single number, but they are calculated differently and represent different matrix properties.
Matrix Power
A matrix power means multiplying a square matrix by itself repeatedly.
For a positive integer (n):
An=n timesA×A×⋯×A
For example:
A2=A×A
and:
A3=A×A×A
This is important: matrix powers do not normally mean raising each individual matrix element to the exponent.
For example, if:
A=[1023]
then:
A2=[1023][1023]
which gives:
A2=[1089]
The calculator's Power option lets you provide the matrix and select the exponent before calculating the resulting matrix.
Scalar Multiplication - Multiply a Matrix by a Number
Scalar multiplication multiplies every element of a matrix by the same number.
If (k) is a scalar and:
A=[aij]
then:
kA=[kaij]
For example, let:
A=[1234]
and:
k=2
Then:
2A=[2(1)2(2)2(3)2(4)]=[2468]
This differs from matrix multiplication, which uses two matrices and follows the row-by-column multiplication rule.
Row Echelon Form
Row echelon form is a simplified version of a matrix created using elementary row operations. It is commonly used in linear algebra to solve systems of equations, identify pivot positions, and determine the rank of a matrix.
A matrix is in row echelon form when:
All nonzero rows appear above any rows containing only zeros.
The leading nonzero entry, or pivot, of each row is farther to the right than the pivot in the row above it.
All entries below each pivot are zero.
The three elementary row operations are:
1. Swap Two Rows
Two rows can exchange positions:
Ri↔Rj
2. Multiply a Row by a Nonzero Number
Ri→kRi,k=0
3. Add a Multiple of One Row to Another
Ri→Ri+kRj
These operations change the form of the matrix while preserving the relationships needed for solving the associated linear system.
For example, elimination may transform:
A=100250007
into a row echelon form. In this example, the matrix is already in row echelon form because each pivot moves to the right and all entries below the pivots are zero.
The calculator's Row echelon option performs the required elimination and can also display information such as the resulting matrix, matrix size, rank, and determinant when applicable.
Row Echelon Form vs. Reduced Row Echelon Form
These two terms should not be confused.
In row echelon form (REF), entries below each pivot are zero. In reduced row echelon form (RREF), each pivot is additionally equal to 1 and is the only nonzero entry in its column.
The calculator option shown here is Row echelon, so results should be interpreted as row echelon form rather than automatically assuming reduced row echelon form.
LU Decomposition
LU decomposition factors a matrix into two triangular matrices:
A=LU
where:
L=lower triangular matrix
and:
U=upper triangular matrix
A lower triangular matrix generally has zeros above its main diagonal:
L=l11l21l310l22l3200l33
An upper triangular matrix has zeros below its main diagonal:
U=u1100u12u220u13u23u33
The goal is to find (L) and (U) such that multiplying them reconstructs the original matrix:
LU=A
During elimination, (U) contains the values left after eliminating entries below the pivots, while (L) records the multipliers used during that process.
LU decomposition is useful for solving linear systems and for computations where the same coefficient matrix is used repeatedly.
Depending on the matrix, row exchanges or pivoting may be necessary. Therefore, not every matrix has a straightforward (A=LU) factorization without additional permutation information.
How to Solve Matrices
The phrase how to solve matrices can mean different things depending on the problem. A matrix itself is not always something that has one single “solution.”
Instead, you select an operation based on what you need to find.
For example:
Use Add to combine two matrices of the same size.
Use Subtract to find the element-wise difference between matrices.
Use Multiply to calculate the matrix product (AB).
Use Det(A) to find the determinant of a square matrix.
Use Inverse to calculate (A^{-1}) when it exists.
Use Transpose to switch rows and columns.
Use Trace to add the main diagonal entries.
Use Power to multiply a square matrix by itself a specified number of times.
Use Multiply by for scalar multiplication.
Use Row echelon to simplify a matrix using row operations.
Use LU decomposition to factor a matrix into lower and upper triangular matrices.
This is why an online matrix calculator can be useful as a matrix solver: it lets you select the specific mathematical operation instead of treating every matrix problem the same way.
Matrix Multiplication vs. Scalar Multiplication
Although both operations involve multiplication, they work differently.
Matrix Multiplication | Scalar Multiplication |
Usually involves two matrices | Involves one matrix and one scalar |
Uses row-by-column calculations | Multiplies every element by the same number |
Requires compatible matrix dimensions | Does not require a second matrix |
Written as (AB) | Written as (kA) |
Can change the dimensions of the result | Keeps the original matrix dimensions |
For matrix multiplication:
cij=∑k=1naikbkj
For scalar multiplication:
(kA)ij=kaij
Keeping this distinction clear prevents one of the most common mistakes in matrix calculations.
When Is a Matrix Calculator Useful?
A matrix calculator online can help whenever a problem involves multiple matrix operations or calculations that would be time-consuming to complete manually.
Common applications include:
Linear Algebra
Students can calculate determinants, inverses, matrix products, row echelon forms, and other common operations while studying linear algebra.
Checking Manual Work
After solving a matrix problem by hand, you can enter the same values into the calculator to check the result and review the calculation steps.
Solving Systems of Linear Equations
Matrix methods are widely used to represent and solve systems such as:
Ax=b
Operations including row reduction, matrix inverses, and LU decomposition can play a role in solving these systems.
Engineering and Science
Matrices are used to represent systems of equations, transformations, networks, physical models, and other numerical relationships.
Computer Graphics
Transformation matrices are fundamental to operations such as rotation, scaling, translation, and projection in computer graphics.
Data Analysis and Computing
Matrices provide a structured way to organize and transform numerical data and are fundamental to many computational methods.
Common Matrix Calculation Mistakes
Matrix rules can be easy to mix up. Watch for these common errors.
Adding or Subtracting Different-Sized Matrices
Addition and subtraction require equal dimensions.
For example:
A2×3+B3×2
is not defined.
Ignoring Matrix Multiplication Dimensions
For:
AB
the number of columns in (A) must equal the number of rows in (B).
For example:
A2×3B3×4
is valid and produces:
C2×4
Multiplying Corresponding Elements Instead of Rows and Columns
Standard matrix multiplication does not simply multiply matching positions.
The correct rule is:
cij=∑kaikbkj
Assuming Matrix Multiplication Is Commutative
For ordinary numbers:
ab=ba
But matrices generally do not follow this rule:
AB=BA
In some cases, (AB) may exist while (BA) does not.
Trying to Invert a Singular Matrix
A square matrix cannot have an ordinary inverse when:
det(A)=0
Always check the determinant or invertibility result before expecting an inverse.
Confusing Trace With Determinant
Trace adds diagonal elements:
tr(A)=∑iaii
The determinant uses a different calculation and contains information about properties such as invertibility.
They are not interchangeable.
Raising Every Element to Find a Matrix Power
In standard matrix powers:
A2=A×A
It does not mean squaring every individual element.
Entering Values in the Wrong Position
Matrix calculations depend on the exact location of every element. Moving a number to a different row or column can produce a completely different result.
Double-check the entered matrix before calculating.
Frequently Asked Questions (FAQs)
What is a matrix calculator?
A matrix calculator is an online tool for performing mathematical operations on matrices. Depending on the selected operation, it can calculate matrix addition, subtraction, multiplication, determinants, inverses, transposes, traces, powers, scalar multiplication, row echelon form, and LU decomposition.
How do you multiply two matrices?
Multiply each row of the first matrix by each column of the second matrix and add the products:
cij=∑k=1naikbkj
Matrix multiplication is possible when the number of columns in the first matrix equals the number of rows in the second matrix.
What dimensions are required for matrix multiplication?
If:
Am×n
is multiplied by:
Bn×p
then the multiplication is valid because the inner dimensions (n) match. The result has dimensions:
m×p
Can you add matrices of different sizes?
No. Matrix addition requires both matrices to have exactly the same number of rows and columns. Each element in one matrix must have a corresponding element in the other matrix.
How do you find the determinant of a matrix?
For an (2×2) matrix:
A=[acbd]
the determinant is:
det(A)=ad−bc
Larger square matrices require methods such as cofactor expansion or elimination.
When does a matrix have an inverse?
A square matrix has an inverse when its determinant is nonzero:
det(A)=0
If the determinant equals zero, the matrix is singular and does not have an ordinary inverse.
What is the difference between matrix multiplication and scalar multiplication?
Matrix multiplication combines compatible matrices using row-by-column products. Scalar multiplication takes one number, called a scalar, and multiplies every element of a matrix by that number.
How do you solve matrices online?
Choose the matrix operation you need, select the required matrix dimensions, enter the matrix elements, and calculate the result. The correct method depends on whether you need to add or multiply matrices, find a determinant or inverse, transpose a matrix, reduce it to row echelon form, or perform another matrix operation.
Final Thoughts
Matrix calculations range from simple element-wise addition to more involved operations such as matrix multiplication, inverses, row reduction, and LU decomposition. Understanding the rules behind each operation is important because different calculations have different dimension and invertibility requirements.
An online matrix calculator makes it easier to perform these operations, check manual work, and understand how a result is obtained. Select the appropriate operation, enter the matrix values carefully, and use the displayed calculation steps and matrix properties to better understand the result.
Helpful Resources
Pro Tips
Matrix multiplication is only possible if the number of columns in the first matrix equals the number of rows in the second.
The determinant is a scalar value that can only be calculated for square matrices.
Check that your dimensions are correct before performing operations.