Mathematics & Statistics

Matrix Calculator

Determinant, rank, inverse, A × B, A + B, A − B and transpose for matrices up to 6 × 6.

Inputs

Calculate from

Separate the entries in a row with spaces (or commas) and the rows with semicolons. Example 3 × 3: 1 2 3; 0 1 4; 5 6 0. Up to 6 × 6.

Result

Determinant det(A)
10
Rank of A
2
Trace (sum of the diagonal)
10
Status
Non-singular (full rank 2): A has an inverse.
Size
2 × 2

det(A) = 10. Non-singular (full rank 2): A has an inverse.

Educational estimate — check the assumptions below.

About this calculator

Matrices organise linear equations, transformations, stiffness and network models. This calculator finds the determinant, rank and inverse of a square matrix, and multiplies, adds, subtracts or transposes matrices up to 6 × 6. Type each row with its numbers separated by spaces, and separate the rows with semicolons.

To solve a system of equations directly, use the Simultaneous Equations Solver.

Formula

Determinant & rank

det A = (−1)s × u₁₁ u₂₂ … unn

Gaussian elimination with partial pivoting turns A into a triangular matrix U; the determinant is the product of its diagonal (the pivots), with the sign changed once per row swap s. The rank is the number of non-zero pivots. For 2 × 2: det = ad − bc.

Inverse A⁻¹

A A⁻¹ = I

Gauss–Jordan elimination of [A | I] into [I | A⁻¹]. For 2 × 2: A⁻¹ = (1/det) [d −b; −c a]. The condition number ‖A‖ ‖A⁻¹‖ shows how many digits may be lost (about log₁₀ of it).

A × B

(AB)ij = Σk aik bkj

A (m × n) times B (n × p) gives an m × p matrix. In general AB ≠ BA.

A + B

(A + B)ij = aij + bij

A − B

(A − B)ij = aij − bij

Transpose Aᵀ

(Aᵀ)ij = aji

Worked example

A = [4 7; 2 6], B = [1 0; 3 2]:

  • det A = 4 × 6 − 7 × 2 = 10, rank 2, trace 10
  • A⁻¹ = (1/10) [6 −7; −2 4] = [0.6 −0.7; −0.2 0.4]
  • A × B = [4·1 + 7·3, 4·0 + 7·2; 2·1 + 6·3, 2·0 + 6·2] = [25 14; 20 12]
  • A + B = [5 7; 5 8]; A − B = [3 7; −1 4]; Aᵀ = [4 2; 7 6]

Assumptions and limitations

  • Real entries, up to 6 rows and 6 columns.
  • A pivot smaller than 10⁻¹² × n × (largest entry) is treated as zero; such a matrix is reported as singular. A matrix that is singular in exact arithmetic but not after rounding may show a tiny non-zero determinant and a large condition number.
  • Results are shown to 10 significant figures (the determinant to 12).

References

  • Golub, G. H. & Van Loan, C. F. Matrix Computations — LU factorisation with partial pivoting.
  • Kreyszig, E. Advanced Engineering Mathematics — matrices, determinants, inverse.