Home › All Tools ›

Matrix Calculator

Use Matrix Calculator online for free at FreeToolZones — no sign-up, no watermark.

Loading tool...

The Matrix Calculator on FreeToolZones performs addition, subtraction, and multiplication on two square matrices, and computes the determinant, inverse, and transpose of the first matrix, for sizes 2 by 2 and 3 by 3. Matrices are rectangular arrays of numbers that represent transformations, systems of equations, rotations, and data tables. Matrix arithmetic follows rules that differ from ordinary number arithmetic, most notably that multiplication is not commutative: A times B is generally different from B times A. This tool applies the rules correctly and displays results as formatted grids, so you can read the output matrix row by row and compare it with your own working.

The distinction between the two-matrix operations and the single-matrix operations is central to the interface. Addition, subtraction, and multiplication combine Matrix A and Matrix B. Determinant, inverse, and transpose act on Matrix A alone. That design matches how matrices are used: you combine two matrices when composing transformations or adding data, and you analyse one matrix when asking whether it is invertible, what its determinant is, or what its transpose looks like. Keeping the two groups separate prevents the common error of applying a single-matrix operation to the wrong matrix.

What Is the Matrix Calculator?

The Matrix Calculator works with square matrices of size 2 by 2 or 3 by 3, selected from a dropdown. You fill in the cells of Matrix A and Matrix B in editable grids, then press one of six operation buttons. The A plus B button adds corresponding cells. The A minus B button subtracts corresponding cells of B from A. The A times B button performs matrix multiplication, where each cell of the result is the dot product of a row of A with a column of B. The Determinant of A button computes the determinant of A. The Inverse of A button computes the inverse of A, or reports that A is singular if the determinant is zero. The Transpose of A button swaps the rows and columns of A.

For 2 by 2 matrices, the determinant is a times d minus b times c, where the matrix is written with rows (a, b) and (c, d). For 3 by 3 matrices, the determinant uses the cofactor expansion along the first row, with the standard formula involving the three 2 by 2 minors. The inverse for a 2 by 2 matrix swaps the diagonal entries, negates the off-diagonal entries, and divides by the determinant. The inverse for a 3 by 3 matrix is the adjugate, the transpose of the cofactor matrix, divided by the determinant. The tool reports a matrix as singular, with no inverse, when the absolute value of the determinant is below one trillionth.

Changing the size rebuilds both grids with default values and clears the output, so you start fresh for the new size. The 2 by 2 defaults are A as rows (1, 2) and (3, 4), and B as rows (5, 6) and (7, 8). The 3 by 3 defaults are A as rows (1, 2, 3), (4, 5, 6), and (7, 8, 9), and B as rows (9, 8, 7), (6, 5, 4), and (3, 2, 1). Note that the default 3 by 3 A matrix is singular, with determinant 0, because its rows follow an arithmetic pattern, so pressing Inverse of A with the defaults produces the singular error message. That is a useful teaching case, not a fault.

How to Use the Matrix Calculator

  1. Choose the matrix size in the Matrix size dropdown: 2 by 2 or 3 by 3. Changing the size rebuilds the grids with default values and clears the previous result.
  2. Fill in every cell of Matrix A with a number. Every cell must contain a valid number, or the tool will ask you to fill in every cell.
  3. Fill in every cell of Matrix B with a number, if you plan to use a two-matrix operation. Matrix B is not needed for determinant, inverse, or transpose, but the fields are always shown.
  4. Press the button for the operation you want: A plus B, A minus B, A times B, Determinant of A, Inverse of A, or Transpose of A.
  5. Read the result, which appears as a titled formatted grid for matrix results, or as a single large value for the determinant. For the inverse of a singular matrix, read the error message explaining that no inverse exists.

With the 2 by 2 defaults, A plus B gives rows (6, 8) and (10, 12). A minus B gives rows (minus 4, minus 4) and (minus 4, minus 4). A times B gives rows (19, 22) and (43, 50). The determinant of A is 1 times 4 minus 2 times 3, which is minus 2. The inverse of A is rows (minus 2, 1) and (1.5, minus 0.5). The transpose of A is rows (1, 3) and (2, 4). Verify the multiplication by hand for the top-left cell: 1 times 5 plus 2 times 7 is 5 plus 14, which is 19. Verify the inverse by multiplying A by its inverse, which should give the identity matrix, rows (1, 0) and (0, 1).

Results are formatted as aligned grids with cells padded so columns line up, making rows and columns easy to read. Values are shown to six decimal places, trimmed of unnecessary trailing zeros. Unlike some tools on this site, the Matrix Calculator does not update live as you type: you must press an operation button to compute, because there are six possible operations and the tool cannot know which one you want until you choose it. After editing cells, press the operation button again to refresh the result.

Key Features of the Matrix Calculator

  • Two sizes: Supports 2 by 2 and 3 by 3 square matrices, with editable grids for both matrices.
  • Addition and subtraction: Adds and subtracts corresponding cells of A and B.
  • Matrix multiplication: Computes A times B with the row-by-column dot product rule, in the correct order.
  • Determinant: Computes the determinant of A for both sizes, using the direct formula for 2 by 2 and cofactor expansion for 3 by 3.
  • Inverse: Computes the inverse of A when it exists, and reports singular matrices honestly when the determinant is zero.
  • Transpose: Swaps rows and columns of A.
  • Formatted output: Results appear as aligned grids with a title naming the operation, so the output matrix is easy to read and copy.

Matrix multiplication order matters, and the tool respects it. A times B is computed as rows of A dotted with columns of B. B times A would generally give a different matrix. To compute B times A with this tool, swap the contents of the two grids: enter the second matrix as A and the first as B, then press A times B. For the defaults, B times A gives rows (23, 34) and (31, 46), which differs from A times B, rows (19, 22) and (43, 50). That difference is the clearest possible demonstration that matrix multiplication is not commutative.

Practical Use Cases and Worked Examples

Example 1: Addition and subtraction

Two stores record weekly sales in 2 by 2 tables, with rows for two products and columns for two weeks. Store A records rows (1, 2) and (3, 4), and Store B records rows (5, 6) and (7, 8), using the defaults for illustration. The combined sales are A plus B, rows (6, 8) and (10, 12). The difference, A minus B, is rows (minus 4, minus 4) and (minus 4, minus 4), showing that Store B sold 4 more in every cell. Addition and subtraction of matrices are cell-by-cell operations, and they require matrices of the same size, which this tool guarantees by using one size for both grids.

Example 2: Multiplication and composition

Matrix multiplication composes transformations. With the defaults, A times B is rows (19, 22) and (43, 50). Compute the bottom-right cell by hand: row 2 of A is (3, 4), column 2 of B is (6, 8), and the dot product is 3 times 6 plus 4 times 8, which is 18 plus 32, which is 50. In graphics, multiplying a rotation matrix by a scaling matrix gives a single matrix that performs both transformations at once. The order of multiplication corresponds to the order of application, which is why swapping A and B changes the result.

Example 3: Determinant of a 2 by 2 matrix

Enter A as rows (1, 2) and (3, 4) and press Determinant of A to get minus 2. The determinant measures how the matrix scales area: an absolute value of 2 means areas are doubled, and the negative sign means orientation is reversed, like a reflection. Enter A as rows (2, 0) and (0, 3) to get determinant 6, the product of the diagonal entries for a diagonal matrix. Enter A as rows (1, 2) and (2, 4) to get determinant 0, because the second row is twice the first, so the rows are linearly dependent and the matrix collapses area to zero.

Example 4: Inverse of a 2 by 2 matrix

Enter A as rows (1, 2) and (3, 4) and press Inverse of A to get rows (minus 2, 1) and (1.5, minus 0.5). Verify by multiplication: A times its inverse should be the identity. The top-left cell is 1 times minus 2 plus 2 times 1.5, which is minus 2 plus 3, which is 1. The top-right cell is 1 times 1 plus 2 times minus 0.5, which is 0. The bottom-left cell is 3 times minus 2 plus 4 times 1.5, which is 0. The bottom-right cell is 3 times 1 plus 4 times minus 0.5, which is 1. The inverse undoes the transformation represented by A, which is how it solves systems of equations.

Example 5: A 3 by 3 determinant and inverse

Switch to 3 by 3 and enter A as rows (1, 2, 3), (0, 1, 4), and (5, 6, 0). The determinant is 1 times (1 times 0 minus 4 times 6) minus 2 times (0 times 0 minus 4 times 5) plus 3 times (0 times 6 minus 1 times 5), which is 1 times minus 24 minus 2 times minus 20 plus 3 times minus 5, which is minus 24 plus 40 minus 15, which is 1. Because the determinant is 1, the matrix is invertible, and its inverse has whole-number entries. Press Inverse of A to see the result, then verify by checking that A times the inverse gives the 3 by 3 identity matrix. Contrast with the default 3 by 3 A, rows 1 through 9 in order, whose determinant is 0, so it has no inverse.

Example 6: Transpose and symmetry

Enter A as rows (1, 2) and (3, 4) and press Transpose of A to get rows (1, 3) and (2, 4). The first row of the transpose is the first column of the original. Enter a symmetric matrix, rows (1, 2) and (2, 1), and its transpose is itself, which is the definition of symmetry. The transpose appears in least-squares problems, in quadratic forms, and in the definition of the inverse for 3 by 3 matrices, where the adjugate is the transpose of the cofactor matrix. Transposing twice returns the original matrix, which you can verify by entering the transpose as a new A and transposing again.

Tips and Best Practices

First, double-check that you have entered every cell, and that the numbers are in the intended rows and columns. A transposed entry, a number in the wrong row, changes the result completely but looks plausible. Second, remember that multiplication is A times B, in that order. If your problem needs B times A, swap the grids. Third, check determinants before inverses: a zero determinant means no inverse exists, so the singular message is the correct answer, not an error to work around.

Fourth, verify inverses by multiplication. The product of a matrix and its inverse must be the identity matrix, with 1s on the diagonal and 0s elsewhere. Fifth, for 3 by 3 work, keep track of cofactor signs: the checkerboard pattern of plus and minus signs in the cofactor expansion is the most common source of hand errors, and the tool’s determinant gives you a reliable check. Sixth, note that changing the size clears your entries, so finish your work at one size before switching. Finally, read results row by row and copy them carefully, since a grid is easy to misread if you copy column by column.

Limitations

The Matrix Calculator supports only square matrices of size 2 by 2 and 3 by 3. It does not handle rectangular matrices, larger square matrices, or matrices with complex entries. It does not compute eigenvalues, eigenvectors, rank, row echelon form, or matrix powers. The determinant, inverse, and transpose act on Matrix A only; there is no direct button for the determinant, inverse, or transpose of B, although you can enter B’s contents as A to analyse B.

All cells must contain numbers; empty or non-numeric cells produce an error. Results are shown to six decimal places, so inverses involving repeating decimals are rounded. The singularity threshold is an absolute determinant below one trillionth, so matrices with extremely small but non-zero determinants may be reported as singular. The tool does not update live: you must press an operation button after editing cells.

Frequently Asked Questions

What sizes are supported?

Two by two and three by three square matrices. Choose the size from the dropdown. Changing the size rebuilds the grids with default values.

Why is A times B different from B times A?

Because matrix multiplication is not commutative. The dot products combine different rows and columns in each order, so the results generally differ. To compute B times A, swap the contents of the two grids.

What does singular mean?

It means the determinant is zero, so the matrix has no inverse. The tool reports this with an error message when you press Inverse of A for a singular matrix, such as the default 3 by 3 matrix with rows 1 through 9.

How do I find the inverse of Matrix B?

Enter B’s numbers into the Matrix A grid, then press Inverse of A. The single-matrix operations act on Matrix A only.

What is the transpose?

It is the matrix formed by swapping rows and columns. The first row of the transpose is the first column of the original matrix.

Why must every cell be filled?

Because matrix operations need complete matrices. An empty cell has no numeric value, so the tool asks you to fill in every cell with a number before computing.

Related Tools

Continue with the Linear Equation Solver for systems that matrices represent, the Scientific Calculator for arithmetic checks on individual cells, the Quadratic Equation Solver for equations involving determinants, the Number Rounding Tool to round matrix entries, and the Standard Deviation Calculator for data tables summarised as statistics. You can also return to the FreeToolZones home page to browse the full tool collection.

Browse More Tools