Skip to content
CalcSpectrum

Matrix Calculator

Add, scalar-multiply, multiply, or find the determinant of matrices up to 4x4, with step-by-step validated results.

Free to use · Instant results

Calculator Inputs

Addition and matrix product use both Matrix A and Matrix B. Scalar multiplication and determinant use only Matrix A.

Matrix A
Col 1Col 2Col 3Col 4Remove row

Add one row per row of Matrix A (up to 4 rows). Use "Matrix A columns" to set how many of the 4 columns are used.

Matrix B
Col 1Col 2Col 3Col 4Remove row

Add one row per row of Matrix B (up to 4 rows). Ignored for scalar multiplication and determinant.

Used only for scalar multiplication.

Determinant
—
Operation
addition
Result Rows
2
Result Columns
2
Result [1,1]
6.00
Result [1,2]
8.00
Result [1,3]
—
Result [1,4]
—
Result [2,1]
10.00
Result [2,2]
12.00
Result [2,3]
—
Result [2,4]
—
Result [3,1]
—
Result [3,2]
—
Result [3,3]
—
Result [3,4]
—
Result [4,1]
—
Result [4,2]
—
Result [4,3]
—
Result [4,4]
—
Your spreadsheet is generated in your browser.

About these results

CalcSpectrum calculators produce automated estimates using established formulas and the specific values you enter. Because real-world outcomes depend on input accuracy, mathematical assumptions, and rounding conventions, please verify critical figures with an appropriately qualified financial, tax, medical, legal, or other professional, as relevant.

How It's Calculated

Formula

(A+B)ij=Aij+Bij(kA)ij=k Aij(AB)ij=∑kAikBkjdet⁡(A)=∑j(−1)jA1j M1j(A+B)_{ij} = A_{ij}+B_{ij} \qquad (kA)_{ij} = k\,A_{ij} \qquad (AB)_{ij} = \sum_k A_{ik}B_{kj} \qquad \det(A) = \sum_j (-1)^{j}A_{1j}\,M_{1j}

This calculator supports four matrix operations on matrices up to 4x4: addition, scalar multiplication, matrix product, and determinant. Addition and subtraction-style operations require both matrices to have identical dimensions — each entry is added to the entry in the same position. Scalar multiplication multiplies every entry of Matrix A by a single number k. Matrix product (A × B) requires Matrix A's column count to equal Matrix B's row count; the result has Matrix A's row count and Matrix B's column count, with each entry computed as the dot product of a row of A and a column of B. The determinant is only defined for a square matrix (equal rows and columns) and is computed here by cofactor (Laplace) expansion along the first row, recursively reducing to 2x2 and 1x1 sub-matrices — an exact method well suited to this calculator's bounded 4x4 size. Matrix A and Matrix B each use a "columns" selector because the underlying input table always shows 4 columns; only the selected number of columns is treated as part of the matrix, and unused cells are ignored.

Worked Examples

Matrix addition (2x2)

  1. A = [[1,2],[3,4]], B = [[5,6],[7,8]]
  2. Same dimensions (2x2), so addition is defined
  3. (A+B) = [[1+5, 2+6],[3+7, 4+8]] = [[6,8],[10,12]]

Matrix product (2x3 by 3x2)

  1. A is 2x3, B is 3x2 — A's columns (3) equal B's rows (3), so the product is defined
  2. Result is 2x2 (A's rows x B's columns)
  3. Each result entry is the dot product of the matching row of A and column of B

3x3 determinant by cofactor expansion

  1. A = [[6,1,1],[4,-2,5],[2,8,7]]
  2. Expand along the first row: det = 6·M11 − 1·M12 + 1·M13
  3. M11 = det[[-2,5],[8,7]] = -14-40 = -54; M12 = det[[4,5],[2,7]] = 28-10 = 18; M13 = det[[4,-2],[2,8]] = 32+4 = 36
  4. det = 6(-54) - 1(18) + 1(36) = -324 - 18 + 36 = -306

Frequently Asked Questions

Why do I need to set a separate 'columns' value for each matrix?

The input table always displays 4 columns so it can represent any matrix up to 4x4 without changing shape as you work. The "columns" selector tells the calculator how many of those columns actually belong to your matrix — for a 2x2 matrix, set it to 2 and ignore columns 3 and 4.

Why is there no subtraction, inverse, or transpose?

This calculator implements exactly the operations its specification calls for: addition, scalar multiplication, matrix product, and determinant. A general-purpose matrix inverse in particular requires careful numerical handling of near-singular matrices that is out of scope here.

What happens if I try to add matrices with different dimensions?

The calculation is not performed, and a message explains that both matrices' dimensions must match exactly for addition.

What happens if I try to find the determinant of a non-square matrix?

The determinant is only defined for square matrices (equal rows and columns), so the calculation is not performed and a message explains that Matrix A must be square.

What is the largest matrix this calculator supports?

4x4. This keeps input and computation fast and reliable in the browser; larger matrices are out of scope for this tool.