AIWalay Tools

Matrix Calculator

Add, subtract and multiply matrices, or compute the determinant, inverse and transpose — up to 8×8, with results you can copy.

About the Matrix Calculator

This matrix calculator handles the core operations of linear algebra: addition, subtraction and multiplication of two matrices, plus determinant, inverse and transpose of a single matrix. Type each matrix with one row per line, numbers separated by spaces or commas, and the result updates instantly — no fixed grid to fight with.

Multiplication follows the row-by-column rule (entry ij is the dot product of row i of A and column j of B), which requires the column count of A to match the row count of B. Determinants and inverses are computed by Gauss-Jordan elimination with partial pivoting — numerically stable and exact to floating-point precision for matrices up to 8×8.

The tool tells you when an operation is undefined — mismatched sizes for addition, incompatible dimensions for multiplication, or a singular matrix (determinant zero) that has no inverse — instead of guessing. Results can be copied as tab-separated text that pastes cleanly into spreadsheets.

How to Use the Matrix Calculator

  1. 1Choose the operation: A+B, A−B, A×B, determinant, inverse or transpose.
  2. 2Type matrix A (and B if needed), one row per line, values separated by spaces or commas.
  3. 3Read the result matrix or scalar instantly.
  4. 4Copy the result for use in a spreadsheet or assignment.

Frequently Asked Questions

How does matrix multiplication work? A worked example

For A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]], entry (1,1) of A×B is row 1 of A dotted with column 1 of B: 1×5 + 2×7 = 19. Completing the rule gives A×B = [[19, 22], [43, 50]]. Note that B×A = [[23, 34], [31, 46]] — matrix multiplication is not commutative.

When does a matrix have no inverse?

Exactly when its determinant is zero (a 'singular' matrix), which happens when the rows or columns are linearly dependent. For example [[2, 4], [1, 2]] has determinant 2×2 − 4×1 = 0, so no inverse exists — the calculator reports this instead of returning garbage.

How is the determinant calculated for a 2×2 and 3×3 matrix?

For [[a, b], [c, d]] it's ad − bc: the determinant of [[1, 2], [3, 4]] is 1×4 − 2×3 = −2. For 3×3 you can expand along a row, but this tool uses Gaussian elimination, which scales to larger sizes with better numerical stability and gives identical results.

Why can't I add my two matrices?

Addition and subtraction are element-wise, so both matrices must have identical dimensions — you can add a 2×3 to a 2×3 but not to a 3×2. For multiplication the inner dimensions must agree: a 2×3 times a 3×4 works (result 2×4), a 2×3 times a 2×3 does not.

What is the transpose used for?

Transposing flips a matrix over its diagonal, turning rows into columns: the transpose of [[1, 2, 3], [4, 5, 6]] is [[1, 4], [2, 5], [3, 6]]. It appears throughout statistics (covariance matrices), computer graphics and solving least-squares problems (the normal equations use AᵀA).

Related Tools