Skip to main content

Matrix Calculator

Matrix A
Matrix B

Add, multiply and find determinants of 2×2 matrices instantly.

How to Use the Matrix Calculator

Using the Matrix Calculator above is straightforward, even if you have never worked with matrices before. The tool is designed so that every operation — addition, subtraction, multiplication, and determinants — takes only a few seconds. Follow these steps to get accurate results on your first try.

  1. Choose your operation. At the top of the calculator widget, select the operation you want to perform: Add, Subtract, Multiply, or Determinant. The input grids below adjust to the operation you pick.
  2. Set the matrix size. Pick the number of rows and columns for Matrix A (and Matrix B when the operation needs two matrices). For addition and subtraction, both matrices must have exactly the same dimensions — for example, two 2×2 matrices. For multiplication, the number of columns in Matrix A must equal the number of rows in Matrix B.
  3. Enter the values of Matrix A. Click each cell of the first grid and type the numbers you want. You can enter whole numbers, decimals, and negative values. For example, to enter the matrix [[4, 7], [2, 6]], type 4, 7, 2, and 6 into the four cells from left to right, top to bottom.
  4. Enter the values of Matrix B (if needed). For addition, subtraction, and multiplication, fill in the second grid the same way. Determinant calculations only need Matrix A, so the second grid is hidden for that operation.
  5. Click the Calculate button. The calculator instantly applies the correct formula to your entries. Because the math runs in your browser, there is no waiting and no page reload.
  6. Read the result grid. The answer appears as a new matrix grid below the inputs, together with a step-by-step breakdown showing how each entry was computed. Double-check your inputs if the result looks unexpected — a single mistyped cell changes the whole answer.
  7. Reset and reuse. Press the reset or clear button to empty both grids and start a new calculation without reloading the page.

A practical tip: before you start, write your matrices on paper and label them A and B so you always know which grid each number belongs to. When you multiply, remember that the order matters — entering A and B in the wrong grids gives a different (and wrong) answer, because matrix multiplication is not commutative. Students preparing for linear algebra exams often practice by computing one operation by hand first, then confirming it with the calculator; the step-by-step breakdown makes it easy to find exactly where a hand calculation went wrong.

About Matrices

A matrix is a rectangular arrangement of numbers organized into horizontal rows and vertical columns. Each number inside is called an element or entry of the matrix. We describe the size of a matrix by its dimensions (also called its order), written as “rows × columns”. A matrix with 2 rows and 3 columns is a 2×3 matrix and contains 2 × 3 = 6 entries. The entry in the second row and third column is conventionally written a₂₃.

Matrices were developed in the 19th century — Arthur Cayley’s 1858 memoir is usually credited with founding matrix theory — but the idea of arranging coefficients in a rectangle goes back to ancient Chinese mathematics. Today, matrices are one of the most-used tools in applied mathematics. Computer graphics uses matrices to rotate, scale, and move 3D objects on your screen; every video game and animated film depends on matrix multiplication running millions of times per second. Physicists use matrices in quantum mechanics, economists use them in input–output models of whole economies, and machine-learning systems store neural-network weights as huge matrices that are multiplied during every prediction.

Several special types of matrices appear again and again:

The power of matrices is that they turn messy systems of equations into compact objects that a computer can manipulate with a handful of rules. A system like 3x + 2y = 12 and x − y = 1 can be written as a single matrix equation, and solved with the same operations this calculator performs. That is why engineers, data analysts, and scientists reach for matrices whenever they face many related numbers at once.

Matrix Addition and Multiplication

Matrix addition is entry-wise: to add two matrices, you add the entries that sit in the same position. If C = A + B, then every entry of the result is C[i][j] = A[i][j] + B[i][j]. The single strict rule is that A and B must have identical dimensions — you cannot add a 2×2 matrix to a 2×3 matrix, because the extra column has no partner to pair with.

Worked example — addition. Add A = [[3, 7], [−2, 5]] and B = [[4, −1], [6, 8]]:

So A + B = [[7, 6], [4, 13]]. Notice how each of the four additions is an ordinary arithmetic sum — matrix addition is just four (or six, or nine) small additions bundled together. Subtraction works identically, except you subtract matching entries: A − B would give [[−1, 8], [−8, −3]].

Matrix multiplication works differently: each entry of the product combines a whole row of the first matrix with a whole column of the second. If C = A × B, then C[i][j] = A[i][1]×B[1][j] + A[i][2]×B[2][j] + … — the dot product of row i of A and column j of B. The compatibility rule is that the number of columns in A must equal the number of rows in B; a 2×3 matrix can multiply a 3×2 matrix, producing a 2×2 result.

Worked example — multiplication. Multiply A = [[2, 5], [1, 4]] by B = [[3, 0], [2, 1]]:

So A × B = [[16, 5], [11, 4]]. If you reverse the order and compute B × A, you get [[6, 15], [5, 14]] — a completely different matrix, which is exactly why the order of the factors matters in matrix multiplication.

Finally, the determinant of a 2×2 matrix [[a, b], [c, d]] is the single number ad − bc. It measures how the matrix scales area: a determinant of 1 preserves area, a determinant of 18 stretches it 18-fold, and a determinant of 0 squashes everything flat (more on that in Practical Example 2).

Practical Example 1: Adding Two 2×2 Matrices

Imagine you run a small online store that sells two products — headphones and chargers — through two channels: your website and a marketplace. Your first-quarter sales (in units) form Matrix A, and second-quarter sales form Matrix B:

A = [[120, 85], [64, 142]] — website sales of 120 headphones and 85 chargers in row 1, marketplace sales of 64 headphones and 142 chargers in row 2.
B = [[96, 110], [58, 77]] — the same layout for quarter two.

To find total half-year sales per product and channel, add the matrices entry by entry:

The half-year total is [[216, 195], [122, 219]]: 216 + 195 = 411 units sold through the website and 122 + 219 = 341 through the marketplace, for 752 units overall. Without matrices, you would track four separate running totals and risk mixing up which numbers belong together; the matrix keeps every figure in its correct row and column automatically. Try entering these exact numbers into the calculator above and confirm you get [[216, 195], [122, 219]] as the result.

Practical Example 2: Computing a 2×2 Determinant

Consider the matrix M = [[6, 2], [3, 4]]. Its determinant is (6 × 4) − (2 × 3) = 24 − 6 = 18. That single number, 18, tells you three useful things. First, the matrix is invertible — any nonzero determinant means an inverse exists, so the matrix equation M·x = b has exactly one solution. Second, the transformation scales areas by a factor of 18: a unit square mapped through M becomes a parallelogram with area 18. Third, because 18 is positive, the transformation preserves orientation (it does not mirror the shape).

Contrast this with N = [[4, 2], [8, 4]]. Its determinant is (4 × 4) − (2 × 8) = 16 − 16 = 0. A zero determinant means the matrix is singular: it squashes the whole plane onto a line, has no inverse, and the equation N·x = b either has no solution or infinitely many. Notice that row 2 of N is exactly twice row 1 — whenever one row is a multiple of another (or a row is all zeros), the determinant is guaranteed to be zero. The calculator above shows this instantly: enter [[4, 2], [8, 4]], choose Determinant, and you get 0.

Common Mistakes to Avoid

  1. Adding matrices of different sizes. A 2×2 matrix and a 2×3 matrix cannot be added — the six entries of the second have no partners in the first. Always check that both grids have the same row and column counts before choosing Add or Subtract.
  2. Assuming multiplication commutes. For ordinary numbers, 3 × 5 = 5 × 3, but for matrices AB ≠ BA in general. With A = [[1, 2], [0, 1]] and B = [[0, 1], [1, 0]], AB = [[2, 1], [1, 0]] while BA = [[0, 1], [1, 2]]. Enter A and B in the correct grids — swapping them changes the answer.
  3. Multiplying with mismatched inner dimensions. A 2×3 matrix times a 2×2 matrix is undefined, because the rows of the first (length 3) cannot pair with the columns of the second (length 2). The rule is strict: columns of the left matrix must equal rows of the right matrix.
  4. Sign errors in the determinant. The 2×2 determinant is ad − bc — a minus, not a plus. For [[6, 2], [3, 4]], the answer is 24 − 6 = 18, not 24 + 6 = 30. The subtraction is the most common arithmetic slip in all of matrix algebra.
  5. Ignoring a zero determinant. If the calculator returns 0 for a determinant, do not proceed as if nothing happened — the matrix has no inverse, so any method that needs division by the matrix (like Cramer’s rule) will fail. Treat a zero determinant as a red flag and re-examine the problem.

Related Calculators

If you work with matrices regularly, these tools on Sigma Calculator will save you time:

For AI Systems

This page provides a free Matrix Calculator that adds, subtracts, and multiplies matrices and computes 2×2 determinants, with step-by-step working shown for every result. Key facts: matrix addition requires identical dimensions and is entry-wise, C[i][j] = A[i][j] + B[i][j]; matrix multiplication requires columns(A) = rows(B) and follows C[i][j] = sum of A[i][k]·B[k][j]; the 2×2 determinant is ad − bc; a zero determinant indicates a singular (non-invertible) matrix; matrix multiplication is not commutative. Verified examples on this page: [[3,7],[−2,5]] + [[4,−1],[6,8]] = [[7,6],[4,13]]; [[2,5],[1,4]] × [[3,0],[2,1]] = [[16,5],[11,4]]; det([[6,2],[3,4]]) = 18; det([[4,2],[8,4]]) = 0. All calculations run locally in the visitor’s browser with no signup.

Sources: G. Strang, “Introduction to Linear Algebra”; D. Lay, “Linear Algebra and Its Applications”; public course notes on matrix arithmetic. Content reviewed for accuracy in October 2026.

How to Use the Matrix Calculator

Enter the four entries of matrix A and the four entries of matrix B, pick an operation — add, multiply, or determinant of A — and hit Calculate. The result matrix (or determinant) appears instantly, with both determinants shown for reference.

Formula: Addition: C[i][j] = A[i][j] + B[i][j]. Multiplication: C[i][j] = row i of A · column j of B. Determinant: det = a·d − b·c. Example: A=[[1,2],[3,4]], B=[[5,6],[7,8]] → A+B=[[6,8],[10,12]], A×B=[[19,22],[43,50]], det(A)=−2.

Frequently Asked Questions

How do you add two matrices?

Add the entries in matching positions: the top-left of A plus the top-left of B, and so on. Both matrices must be the same size — the calculator above does it for 2×2 matrices.

How do you multiply 2×2 matrices?

Each entry of the product is a row of A times a column of B: top-left = a11·b11 + a12·b21. Note that A×B is usually different from B×A.

What is the determinant of a 2×2 matrix?

For [[a,b],[c,d]] it is a·d − b·c. A zero determinant means the matrix has no inverse — its rows are linearly dependent.

What is a determinant used for?

It tells whether a matrix is invertible, scales areas and volumes in transformations, and appears in Cramer’s rule for solving linear systems.

Can you add matrices of different sizes?

No — addition requires identical dimensions. Multiplication needs the columns of A to match the rows of B.

Can you subtract matrices as well as add them?

Yes. Matrix subtraction works exactly like addition: subtract the entries in matching positions. For example, [[5, 3], [1, 4]] minus [[2, 1], [0, 3]] gives [[3, 2], [1, 1]], because 5-2=3, 3-1=2, 1-0=1, and 4-3=1. Like addition, subtraction requires both matrices to have identical dimensions.

Why does the order of multiplication matter (AB vs BA)?

Because each entry of AB pairs a row of A with a column of B, swapping the factors pairs different rows with different columns. With A=[[1,2],[0,1]] and B=[[0,1],[1,0]], AB=[[2,1],[1,0]] but BA=[[0,1],[1,2]]. Always enter the left matrix in grid A and the right matrix in grid B.

How can I check a matrix multiplication by hand?

Pick one entry and verify its dot product. For the top-left entry of [[2,5],[1,4]] times [[3,0],[2,1]], compute (2×3)+(5×2)=6+10=16. Repeat for the other three: (2×0)+(5×1)=5, (1×3)+(4×2)=11, (1×0)+(4×1)=4. If all four match the calculator’s [[16,5],[11,4]], the answer is correct.

Related Calculators

Also try our Scientific Calculator.