Matrix Calculator
Add, subtract, multiply, and find the determinant, inverse, transpose, or rank โ with every step shown
What Is This Matrix Calculator?
This calculator performs the core matrix operations โ addition, subtraction, multiplication, determinant, inverse, transpose, and rank โ on 2ร2, 3ร3, and 4ร4 matrices, showing the full working behind every result rather than just the final answer.
How to Use It
- Choose an operation and a matrix size.
- Fill in Matrix A (and Matrix B, if the operation needs two matrices).
- Click Calculate to see the result and the complete step-by-step derivation.
- Use Copy Result or Print to save your work.
Formulas & Methods Used
Addition/Subtraction: C[i][j] = A[i][j] ยฑ B[i][j] for every cell
Multiplication: C[i][j] = ฮฃ A[i][k] ร B[k][j] (dot product of row i of A and column j of B)
Determinant: 2ร2 uses ad โ bc directly; 3ร3 and 4ร4 use cofactor expansion along the first row, recursing into smaller minors
Inverse: Aโปยน = (1 รท det(A)) ร adjugate(A), where adjugate(A) is the transpose of the cofactor matrix
Rank: Gaussian elimination to row echelon form; rank = number of non-zero rows
Explanation of Every Operation
Addition & Subtraction
Element-by-element arithmetic โ both matrices must be the same size.
Multiplication
Each result cell is a dot product of a row from A and a column from B, not simple element-wise multiplication.
Determinant
A single number summarizing the matrix โ zero means the matrix is singular (no inverse exists).
Inverse
The matrix that, multiplied by the original, gives the identity matrix โ only exists when the determinant is non-zero.
Transpose
Flips the matrix across its main diagonal, swapping rows and columns.
Rank
The number of linearly independent rows (or columns) โ the maximum size of a non-singular sub-matrix.
Advantages of Using This Calculator
- Every operation shows genuine step-by-step working, not just a final answer.
- Determinant expansion recurses all the way down to base 2ร2 cases, even for 4ร4 matrices.
- Handles singular matrices gracefully, clearly explaining why no inverse exists.
- Works entirely in your browser โ no data leaves your device.
Limitations
- Only square matrices (2ร2, 3ร3, 4ร4) are supported โ no rectangular matrices.
- Both matrices in a two-matrix operation must be the same size.
- Determinant/Inverse steps for 4ร4 matrices are naturally long, reflecting the real complexity of cofactor expansion at that size.
Common Mistakes to Avoid
- Confusing element-wise multiplication with true matrix multiplication (dot products).
- Trying to invert a matrix with a zero determinant.
- Leaving matrix cells empty โ every cell needs a value, even if it's 0.
Worked Examples
2ร2 Determinant
Input: A = [[4, 3], [6, 3]]
Result: det(A) = (4ร3) โ (3ร6) = 12 โ 18 = โ6
The direct ad โ bc formula is the base case every larger determinant eventually reduces to.
3ร3 Matrix Addition
Input: A = [[1,2,3],[4,5,6],[7,8,9]], B = [[9,8,7],[6,5,4],[3,2,1]]
Result: A + B = [[10,10,10],[10,10,10],[10,10,10]]
Each output cell is simply the sum of the two matching input cells โ no cross-row or cross-column interaction.
2ร2 Matrix Inverse
Input: A = [[4, 7], [2, 6]]
Result: det(A) = 10, Aโปยน = [[0.6, -0.7], [-0.2, 0.4]]
Since the determinant (10) is non-zero, the inverse exists โ each entry of the adjugate is divided by 10.
3ร3 Matrix Rank
Input: A = [[1,2,3],[2,4,6],[1,0,1]]
Result: Rank = 2
Row 2 is exactly double Row 1, so it becomes all zeros during elimination โ only 2 independent rows remain.
Frequently Asked Questions
Which matrix sizes are supported?
This calculator supports square matrices of size 2ร2, 3ร3, and 4ร4. Both matrices in a two-matrix operation (addition, subtraction, multiplication) must be the same size.
How does the determinant step-by-step work?
For a 2ร2 matrix, it uses the direct formula ad โ bc. For 3ร3 and 4ร4 matrices, it expands along the first row into smaller minors and recurses all the way down to 2ร2, showing every intermediate minor and its determinant along the way.
Why does a 4ร4 determinant show so many steps?
Cofactor expansion of a 4ร4 matrix requires four 3ร3 minors, each of which requires three more 2ร2 minors โ the full nested breakdown is shown so nothing is hidden, which naturally produces a longer (but complete) derivation than smaller matrices.
How is the inverse calculated?
Using the adjugate method: compute the determinant, build the cofactor matrix (the determinant of each minor with an alternating sign), transpose it to get the adjugate, then divide every entry of the adjugate by the determinant.
Why does it say a matrix has no inverse?
A matrix only has an inverse if its determinant is non-zero. If the determinant is zero (a "singular" matrix), the matrix cannot be inverted โ this is reported clearly instead of dividing by zero.
How is matrix rank calculated?
Using Gaussian elimination with partial pivoting: the matrix is reduced to row echelon form through row swaps and row-elimination steps (all logged), and the rank is the number of non-zero rows remaining at the end.
Can I multiply two matrices of different sizes?
Not in this version โ both matrices must be the same square size (2ร2, 3ร3, or 4ร4) selected from the size dropdown. General rectangular matrix multiplication may be added in a future update.
What does transpose do?
Transposing a matrix swaps its rows and columns โ element (i, j) in the original matrix becomes element (j, i) in the transposed matrix. A square matrix stays the same size after transposing.
Why is my rank lower than the matrix size?
Rank equals the size of the matrix only when all of its rows (and columns) are linearly independent. A lower rank means at least one row can be written as a combination of the others โ the step-by-step elimination shows exactly where a row became all zeros.
Does this calculator handle decimal entries?
Yes โ every cell accepts decimal numbers, and all calculations (determinant, inverse, rank, etc.) work the same way with decimals as with whole numbers.
What is a practical use of matrix inverses?
Matrix inverses are commonly used to solve systems of linear equations (Ax = b becomes x = Aโปยนb), and they appear throughout computer graphics, engineering, and statistics wherever linear transformations need to be reversed.
Conclusion
Whether you're checking linear algebra homework or need a quick determinant or inverse for a real problem, this calculator shows the complete path from input matrix to final answer โ every cofactor, every row operation, every step.