Matrix Calculator: Add, Multiply, Invert and More
Matrix calculations can become difficult when you need to work with several rows and columns, follow multiplication rules, or calculate determinants and inverses. A small mistake in one entry can affect the entire result, especially when working with larger matrices.
This Matrix Calculator helps you perform common matrix operations and check each step of your work. You can add, subtract, and multiply matrices, calculate determinants, and find inverses. It also provides step-by-step working and displays exact fractions by default, making it easier to follow the calculation instead of relying only on a final answer. Whether you need a quick result or a matrix calculator step by step, you can use the tool to check your calculations.
Using the Matrix Calculator
The calculator provides five modes: add and subtract, multiply, transpose, determinant, and inverse. Select the mode you need, enter your matrix values into the number grids, and calculate the result. The working shows how the answer is obtained. The matrix calculator accepts matrices up to 4×4 and shows the working for every mode.
1. Add / Subtract
Choose addition when you need to add two matrices with the same dimensions. Enter the corresponding entries in both grids and calculate the result. The matrix calculator addition mode adds entries in matching positions.
For example: A = [[1, 2], [3, 4]], B = [[5, 6], [7, 8]]. Add the entries in the same positions: A + B = [[1+5, 2+6], [3+7, 4+8]]. The result is: [[6, 8], [10, 12]]. Both matrices must have the same number of rows and columns. You cannot add matrices with different dimensions using ordinary matrix addition.
For subtraction, subtract each entry in the second matrix from the corresponding entry in the first matrix. Using the same matrices: B − A = [[5−1, 6−2], [7−3, 8−4]]. The result is: [[4, 4], [4, 4]]. The order matters in subtraction. Reversing the matrices changes the signs of the resulting entries. The matrix subtraction calculator follows the order in which you enter the matrices.
2. Multiply
Choose multiplication when you need to calculate the product of two matrices. Unlike addition and subtraction, the matrices do not need identical dimensions. The number of columns in the first matrix must equal the number of rows in the second.
For example: A = [[1, 2], [3, 4]], B = [[5, 6], [7, 8]]. Multiply each row of the first matrix by each column of the second: AB = [[(1 × 5) + (2 × 7), (1 × 6) + (2 × 8)], [(3 × 5) + (4 × 7), (3 × 6) + (4 × 8)]]. The result is: [[19, 22], [43, 50]]. Reversing the multiplication order produces a different result: BA = [[23, 34], [31, 46]]. Always check the order of the matrices before calculating their product. A multiply matrices calculator is useful for checking the result, but the row-by-column rule explains how each entry is obtained.
3. Transpose
Choose transpose to flip a matrix: rows become columns and columns become rows. For example, the transpose of [[1, 2, 3], [4, 5, 6]] is [[1, 4], [2, 5], [3, 6]]. The full explanation is in the transpose section below.
4. Determinant
Choose the determinant operation to calculate the determinant of a square matrix. A determinant is a single numerical value, not another matrix.
For a 2×2 matrix: A = [[1, 2], [3, 4]]. Use the formula: det(A) = ad − bc. Substitute the entries: det(A) = (1 × 4) − (2 × 3). det(A) = −2.
For a 3×3 matrix, the calculation involves more terms. For example: A = [[6, 1, 1], [4, −2, 5], [2, 8, 7]]. Its determinant is: det(A) = −306. The matrix determinant calculator displays the determinant and its working so you can follow the calculation. A 3x3 matrix calculator is useful when you need to check a larger square matrix.
5. Inverse
Select the inverse operation when you need to find the inverse of a square matrix. An inverse is a matrix that produces the identity matrix when multiplied by the original matrix.
For example: A = [[2, 1], [1, 2]]. Its inverse is: A⁻¹ = [[2/3, −1/3], [−1/3, 2/3]]. An inverse exists only when the determinant of the original square matrix is not zero.
For a singular matrix such as A = [[1, 2], [2, 4]], the determinant is zero, so no inverse exists. The calculator reports that no inverse is available because the determinant is zero. A matrix inverse calculator can help check the result, but a zero determinant means an inverse cannot be calculated.
Worked Matrix Examples at a Glance
The following examples show the results of common operations using the matrices described above.
| Operation | Input | Result |
|---|---|---|
| Addition | A + B | [[6, 8], [10, 12]] |
| Multiplication | A × B | [[19, 22], [43, 50]] |
| Reversed multiplication | B × A | [[23, 34], [31, 46]] |
| 2×2 determinant | det(A) | −2 |
| 3×3 determinant | det(A) | −306 |
| Inverse | A⁻¹, for A = [[2, 1], [1, 2]] | [[2/3, −1/3], [−1/3, 2/3]] |
What Each Mode Accepts
| Mode | Sizes accepted | What it returns |
|---|---|---|
| Add / Subtract | Two matrices, same size, up to 4×4 | The sum or difference matrix |
| Multiply | A is m×n and B is n×p, up to 4×4 | The product matrix with each dot product shown |
| Transpose | Any size up to 4×4 | The matrix with rows and columns swapped |
| Determinant | Square only, 2×2 to 4×4 | A single number |
| Inverse | Square only, 2×2 to 4×4, determinant not zero | The inverse matrix in exact fractions, or a "no inverse" message |
About Matrices
A matrix is a rectangular arrangement of numbers organized into rows and columns. Each number is called an element or entry. Matrices are commonly used to organize data and perform mathematical calculations involving multiple values.
For example: A = [[1, 2, 3], [4, 5, 6]]. This matrix has two rows and three columns, so its dimensions are 2 × 3. The first number represents the number of rows, and the second represents the number of columns.
Matrices can have different dimensions and structures: Row matrix: Contains one row. Column matrix: Contains one column. Square matrix: Has the same number of rows and columns. Rectangular matrix: Has different numbers of rows and columns. Identity matrix: A square matrix with ones on its main diagonal and zeros elsewhere. Zero matrix: Contains zeros in every position.
Matrices are used in algebra, geometry, computer graphics, data analysis, and systems of linear equations. Their structure makes it possible to represent and calculate relationships between multiple values. A matrix calculator handles the arithmetic so you can focus on the method.
How to Multiply Matrices
Matrix multiplication combines rows from the first matrix with columns from the second. Each result entry comes from multiplying corresponding values and adding their products. This is known as the row-by-column method.
The Row-by-Column Rule
Suppose you have two matrices: A = [[1, 2], [3, 4]], B = [[5, 6], [7, 8]]. To calculate the first entry of the product, multiply the first row of A by the first column of B: (1 × 5) + (2 × 7) = 19. For the second entry, use the first row of A and the second column of B: (1 × 6) + (2 × 8) = 22. Repeat the process for the second row: (3 × 5) + (4 × 7) = 43, (3 × 6) + (4 × 8) = 50. The final product is: AB = [[19, 22], [43, 50]].
Matrix Multiplication Dimensions
The number of columns in the first matrix must match the number of rows in the second matrix. For example, a 2 × 3 matrix can be multiplied by a 3 × 2 matrix. The resulting matrix has dimensions 2 × 2. Using the verified example: [[1, 2, 3], [4, 5, 6]] × [[7, 8], [9, 10], [11, 12]] = [[58, 64], [139, 154]]. The inner dimensions match, so multiplication is possible. The outer dimensions determine the size of the result.
Does Matrix Multiplication Change When You Reverse the Order?
Yes. Matrix multiplication is generally not commutative, which means changing the order can change the result. For the earlier example: AB = [[19, 22], [43, 50]]. But reversing the order gives: BA = [[23, 34], [31, 46]]. Therefore: AB ≠ BA. Do not reverse the matrices unless the question specifically asks you to calculate the product in that order.
How to Find a Matrix Determinant
The determinant is a numerical value associated with a square matrix. It helps determine whether a matrix has an inverse and provides information about its mathematical properties. The method depends on the matrix dimensions. A 2×2 determinant uses a short formula, while a 3×3 determinant requires additional calculations. This section explains how to find the determinant of a matrix for the two sizes students meet most often.
Determinant of a 2×2 Matrix
For a square matrix: A = [[a, b], [c, d]]. The determinant formula is: det(A) = ad − bc. Consider: A = [[1, 2], [3, 4]]. Substitute the entries into the formula: det(A) = (1 × 4) − (2 × 3) = 4 − 6. det(A) = −2. Multiply the main diagonal entries, multiply the other diagonal entries, and subtract the second product from the first.
Determinant of a 3×3 Matrix
For a 3×3 matrix, you can use Sarrus' rule or cofactor expansion. Sarrus' rule works only for 3×3 matrices. It involves adding the products of the downward diagonals and subtracting the products of the upward diagonals.
For example: A = [[6, 1, 1], [4, −2, 5], [2, 8, 7]]. The determinant is: det(A) = 6((−2)(7) − (5)(8)) − 1((4)(7) − (5)(2)) + 1((4)(8) − (−2)(2)) = 6(−54) − 18 + 36. det(A) = −306. This is one way to calculate the determinant of a 3x3 matrix. A calculator can also help check the arithmetic.
Cofactor Expansion
Cofactor expansion is another method for calculating determinants. You select a row or column, multiply each entry by its corresponding minor, and apply alternating positive and negative signs.
For example: A = [[2, −3, 1], [2, 0, −1], [1, 4, 5]]. Expanding along the first row: det(A) = 2(4) + 3(11) + 1(8). det(A) = 49. Both methods produce the same determinant when applied correctly. Sarrus' rule is limited to 3×3 matrices, while cofactor expansion can also be used for larger square matrices.
What Does a Determinant Tell You?
A determinant helps identify whether a square matrix is singular or nonsingular. If the determinant is zero, the matrix is singular and has no inverse. If the determinant is nonzero, the matrix is nonsingular and has an inverse. The determinant also appears in other matrix calculations, including inverse formulas and linear algebra problems. The absolute value of a 2×2 determinant is the area of the parallelogram formed by its two rows.
2×2 vs 3×3 Determinants
| Feature | 2×2 Matrix | 3×3 Matrix |
|---|---|---|
| Formula or method | ad − bc | Sarrus' rule or cofactor expansion |
| Calculation | Two diagonal products and subtraction | Three terms from cofactor expansion |
| Verified example | [[1, 2], [3, 4]], determinant −2 | [[6, 1, 1], [4, −2, 5], [2, 8, 7]], determinant −306 |
How to Find the Inverse of a Matrix
The inverse of a square matrix is another matrix that produces the identity matrix when multiplied by the original matrix. It is written as A⁻¹. For a matrix A, the inverse satisfies: AA⁻¹ = A⁻¹A = I. Here, I represents the identity matrix. An inverse exists only if the determinant of the original square matrix is nonzero.
Inverse of a 2×2 Matrix
For a 2×2 matrix: A = [[a, b], [c, d]]. The inverse formula is: A⁻¹ = (1 / (ad − bc)) × [[d, −b], [−c, a]]. The denominator is the determinant of the original matrix.
Consider: A = [[2, 1], [1, 2]]. First, calculate its determinant: det(A) = (2 × 2) − (1 × 1) = 3. Substitute the values into the inverse formula: A⁻¹ = (1/3) × [[2, −1], [−1, 2]]. Therefore: A⁻¹ = [[2/3, −1/3], [−1/3, 2/3]].
Another 2×2 Inverse Example
Consider: A = [[1, 2], [3, 4]]. Its determinant is: det(A) = (1 × 4) − (2 × 3) = −2. Using the inverse formula: A⁻¹ = (1/−2) × [[4, −2], [−3, 1]]. The result is: A⁻¹ = [[−2, 1], [1.5, −0.5]].
Inverse of a 3×3 Matrix Using the Adjoint Method
Finding the inverse of a 3×3 matrix requires more steps than using the 2×2 formula. One common approach is the adjoint method. The process involves four main steps: 1. Calculate the determinant: Find the determinant of the original matrix. Continue only if it is nonzero. 2. Find the cofactors: Calculate the minor for each entry and apply the appropriate alternating signs. 3. Calculate the adjugate: Arrange the cofactors into a matrix and transpose it. 4. Divide by the determinant: Multiply the adjugate matrix by the reciprocal of the original determinant.
The general formula is: A⁻¹ = (1 / det(A)) × adj(A). The adjugate is the transpose of the cofactor matrix. This method applies to invertible square matrices. It explains how to find the inverse of matrix 3x3 using its determinant and cofactors, and the same process is used to calculate the inverse of a 3x3 matrix by hand.
What Happens When a Matrix Has No Inverse?
A square matrix has no inverse when its determinant equals zero. Such a matrix is called singular. For example: A = [[1, 2], [2, 4]]. Its determinant is: det(A) = (1 × 4) − (2 × 2) = 0. Since the determinant is zero, the inverse does not exist. This is a mathematical condition, not a calculation mistake. The inverse formula requires division by the determinant, and division by zero is undefined.
How to Verify a Matrix Inverse
You can check an inverse by multiplying it by the original matrix. The result should be the identity matrix. Using: A = [[2, 1], [1, 2]] and A⁻¹ = [[2/3, −1/3], [−1/3, 2/3]]. Multiply the inverse by the original matrix: A⁻¹A = [[1, 0], [0, 1]]. This is the identity matrix, so the inverse is correct.
Other Useful Matrix Operations
In addition to addition, subtraction, multiplication, determinants, and inverses, two other useful operations are transpose and scalar multiplication. Both are included in this matrix calculator.
How to Find the Transpose of a Matrix
The transpose of a matrix is formed by switching its rows and columns. Each row becomes a column, and each column becomes a row. The transpose of matrix A is written as Aᵀ.
Consider this rectangular matrix: A = [[1, 2, 3], [4, 5, 6]]. Its first row becomes the first column, and its second row becomes the second column. Therefore: Aᵀ = [[1, 4], [2, 5], [3, 6]]. Notice that the original matrix has dimensions 2 × 3, while its transpose has dimensions 3 × 2. Transposing a matrix does not change its entries, only their positions.
An important transpose rule for multiplication is: (AB)ᵀ = BᵀAᵀ. When you transpose a product of two matrices, you also reverse their multiplication order. The transpose of AB is not generally AᵀBᵀ. A transpose matrix calculator can help check the new arrangement of rows and columns.
How to Multiply a Matrix by a Scalar
A scalar is a single number. Scalar multiplication means multiplying every entry in a matrix by that number.
For example, multiply matrix A by scalar 3: 3A = 3 × [[1, 2], [3, 4]]. Multiply each entry individually: [[3(1), 3(2)], [3(3), 3(4)]]. The result is: 3A = [[3, 6], [9, 12]]. Scalar multiplication does not involve the row-by-column rule used in ordinary matrix multiplication. Every entry is multiplied by the same number.
What This Matrix Calculator Does Not Support in Version 1
This calculator focuses on its five supported modes and does not currently calculate eigenvalues or eigenvectors, perform Reduced Row Echelon Form (RREF), solve systems of linear equations, calculate matrix powers, or find matrix rank. It is not a general matrix solver for those operations. Matrix powers are a separate operation from multiplying individual entries by themselves. For example, A² means A × A, not squaring each entry. For the verified matrix, the actual square is [[7, 10], [15, 22]], whereas entry-wise squaring produces [[1, 4], [9, 16]]. These are different calculations.
Why Matrix Results Differ
Two matrix calculations can produce different results even when they use the same entries. The difference may come from the operation selected, the order of multiplication, the matrix dimensions, or how the result is displayed. If two matrix calculator results disagree, the cause is usually one of the reasons below.
Exact Fractions vs Decimal Approximations
Some matrix calculations produce fractional results. A calculator that displays exact fractions can show a different-looking answer from one that converts everything into decimals. For example: 2/3 = 0.6666… The fraction is exact, while a displayed decimal may be rounded to a chosen number of places. Both can represent the same value, but rounding can introduce small differences in later calculations.
Matrix Multiplication Order
Changing the order of two matrices can change the result. For the verified example: AB = [[19, 22], [43, 50]]. But: BA = [[23, 34], [31, 46]]. Always check which matrix comes first in the question. Reversing the order is not a valid shortcut.
Invalid Matrix Dimensions
Different operations have different dimension requirements. Addition and subtraction require matrices with identical dimensions. Multiplication requires the first matrix's column count to match the second matrix's row count. Determinants and ordinary inverses require square matrices. Transpose works with both square and rectangular matrices. If an operation does not accept your selected dimensions, check these rules before changing the matrix entries.
Singular Matrices and Undefined Inverses
A matrix with a determinant of zero has no inverse. This is a mathematical restriction, not a calculator error. For example: A = [[1, 2], [2, 4]]. Its determinant is zero, so an inverse cannot be calculated. A correct result should identify the matrix as singular rather than provide an inverse.
Frequently Asked Questions
These questions cover the operations this matrix calculator supports and the traps students meet most often.
Final Thought
Matrix calculations become easier when you understand the rules behind each operation. Use the Matrix Calculator to check your results, follow the intermediate working, and learn how matrix dimensions, multiplication order, determinants, and inverses affect the final answer.
