100+ free calculators, no signup | 💰 Financial ❤️ Health & Fitness 📐 Math 🔧 Other
🇺🇸 USD | About Contact

Matrix Calculator

Add, subtract and multiply matrices, or find a determinant, inverse, transpose, rank, RREF or power, with exact fractions and every step.

Matrix A
Matrix B

Cells accept whole numbers, decimals and fractions such as −3, 0.25 or 2/3.

Quick examples
A × B
19224350
2 × 2

Each entry is a row of A times a column of B, added up.

Size rule and order

(2 × 2) × (2 × 2) gives 2 × 2: the inner sizes match (2 = 2) and the outer sizes give the result.

B × A is a different matrix, so the order of multiplication matters.

Your calculation

The same exact steps the calculator runs, with your numbers.

    Entry by entry

    Every entry of the result with its calculation.

    All arithmetic uses exact fractions, so inverses and row reductions have no rounding error. Decimal view rounds to 6 places for display only.

    What Is a Matrix?

    A matrix is a rectangular array of numbers arranged in rows and columns. A matrix with m rows and n columns has size m × n, read "m by n". The entry in row i and column j is written aᵢⱼ, so in A = [1 2; 3 4] the entry a₂₁ is 3.

    A square matrix has as many rows as columns. Only square matrices have a determinant, an inverse, a trace and powers. The identity matrix I has 1s on the main diagonal and 0s elsewhere, and it acts like the number 1: A × I = I × A = A.

    Matrices store the coefficients of linear systems and describe transformations such as rotations and scalings. This calculator handles sizes up to 6 × 6 with exact fractions.

    How to Use the Matrix Calculator

    1. Choose the operation. Add, subtract and multiply use matrices A and B. Determinant, inverse, transpose, RREF and powers use only A. Scalar multiple multiplies A by a number k.
    2. Set the sizes. Pick the rows and columns for each matrix from 1 to 6. Existing entries are kept when you resize.
    3. Fill the cells. Type whole numbers, decimals or fractions such as 2/3. A cell that is empty or not a number turns red and the message names it.
    4. Read the result. The hero shows the answer matrix or number. The next card explains what it means, such as whether A is invertible or the solution of a linear system. Below are the size, rank, nullity, determinant and trace, the steps with your numbers and a full table of entries or row operations.

    Results update as you type. Use the result as matrix A to chain operations, for example to multiply by a third matrix.

    Matrix Addition, Subtraction and Scalar Multiplication

    Add or subtract two matrices of the same size entry by entry. Multiply by a scalar by multiplying every entry.

    (A ± B)ᵢⱼ = aᵢⱼ ± bᵢⱼ (kA)ᵢⱼ = k·aᵢⱼ [1 2; 3 4] + [5 6; 7 8] = [6 8; 10 12] [1 2; 3 4] − [5 6; 7 8] = [−4 −4; −4 −4] 3 × [1 2; 3 4] = [3 6; 9 12]

    A 2 × 2 matrix cannot be added to a 2 × 3 matrix, because some entries would have no partner.

    Matrix Multiplication

    Entry cᵢⱼ of A × B is row i of A times column j of B: multiply matching entries and add. The columns of A must equal the rows of B, and (m × n)(n × p) gives m × p.

    cᵢⱼ = aᵢ₁b₁ⱼ + aᵢ₂b₂ⱼ + … + aᵢₙbₙⱼ [1 2; 3 4] × [5 6; 7 8] c₁₁ = 1·5 + 2·7 = 19 c₁₂ = 1·6 + 2·8 = 22 c₂₁ = 3·5 + 4·7 = 43 c₂₂ = 3·6 + 4·8 = 50

    Multiplication is not commutative. For the same matrices, B × A = [23 34; 31 46], not [19 22; 43 50].

    Matrix Operation Rules

    Which operations are defined depends only on the sizes of the matrices.

    OperationSize requirementResult sizeOrder matters?
    A + B, A − BSame size m × nm × nAddition no, subtraction yes
    k × AAny sizeSame as ANo
    A × BColumns of A = rows of BRows of A × columns of BYes, usually AB ≠ BA
    AᵀAny sizen × m(AB)ᵀ = BᵀAᵀ
    det(A), traceSquareA single numberdet(AB) = det(A)·det(B)
    A⁻¹Square with det(A) ≠ 0Same as A(AB)⁻¹ = B⁻¹A⁻¹
    AⁿSquareSame as APowers of A commute
    RREF, rankAny sizeSame as A; rank ≤ smaller size—

    Check with the default example: det(A) = −2, det(B) = −2 and det(AB) = 19·50 − 22·43 = 4, which equals (−2)·(−2). The traces of AB and BA are both 69, because tr(AB) = tr(BA) always holds.

    How to Find the Determinant

    For a 2 × 2 matrix, multiply down the main diagonal and subtract the product of the other diagonal.

    det [a b; c d] = ad − bc det [3 8; 4 6] = 3·6 − 8·4 = 18 − 32 = −14

    For a 3 × 3 matrix, expand along the first row. Each entry multiplies its minor, the 2 × 2 determinant left after deleting that entry's row and column, and the signs alternate plus, minus, plus.

    det = a₁₁M₁₁ − a₁₂M₁₂ + a₁₃M₁₃ A = [2 −3 1; 2 0 −1; 1 4 5] M₁₁ = 0·5 − (−1)·4 = 4 M₁₂ = 2·5 − (−1)·1 = 11 M₁₃ = 2·4 − 0·1 = 8 det = 2·4 − (−3)·11 + 1·8 = 8 + 33 + 8 = 49

    For 4 × 4 and larger, cofactor expansion takes too many terms. Row reduce to upper triangular form instead. Adding a multiple of one row to another leaves the determinant unchanged, swapping two rows flips its sign, and the determinant of a triangular matrix is the product of its diagonal. The calculator shows this reduction for every size.

    ℹ️
    The absolute value of the determinant is the factor by which the matrix scales area (2 × 2) or volume (3 × 3). A negative determinant means the transformation also flips orientation, and a determinant of 0 squashes space into a lower dimension.

    How to Find the Inverse of a Matrix

    The inverse A⁻¹ satisfies A × A⁻¹ = A⁻¹ × A = I. It exists only for a square matrix with a nonzero determinant.

    [a b; c d]⁻¹ = (1 / (ad − bc))·[d −b; −c a] A = [4 7; 2 6], det = 24 − 14 = 10 A⁻¹ = [6 −7; −2 4] ÷ 10 = [3/5 −7/10; −1/5 2/5]

    For 3 × 3 and larger, write the augmented matrix [A | I] and apply Gauss Jordan elimination until the left half is I. For A = [1 2 3; 0 1 4; 5 6 0], which has determinant 1, the right half becomes A⁻¹ = [−24 18 5; 20 −15 −4; −5 4 1].

    Singular Matrices

    A square matrix with determinant 0 is singular. It has no inverse, its rows are linearly dependent and its rank is less than its size.

    • [1 2; 2 4] is singular: det = 1·4 − 2·2 = 0, and row 2 is twice row 1.
    • [1 2 3; 2 4 6; 1 0 1] has rank 2, because row 2 is twice row 1, so its determinant is 0.
    • For a singular A, the system Ax = b has no solution or infinitely many, never exactly one.

    With decimal inputs, a tiny determinant from rounded data can hide a matrix that is singular in theory. Entering exact fractions avoids that problem.

    RREF, Rank and Solving Systems of Equations

    A matrix is in reduced row echelon form (RREF) when every nonzero row starts with a leading 1, each leading 1 sits to the right of the one above, and each leading 1 is the only nonzero entry in its column. Three row operations get there: swap two rows, multiply a row by a nonzero number, and add a multiple of one row to another.

    The rank is the number of leading 1s (pivots). It equals the number of linearly independent rows, and also of independent columns. The nullity is the number of columns minus the rank.

    Worked example: three equations, three unknowns

    For x + y + z = 6, 2y + 5z = −4 and 2x + 5y − z = 27, write the augmented matrix and reduce it:

    [1 1 1 | 6; 0 2 5 | −4; 2 5 −1 | 27] RREF → [1 0 0 | 5; 0 1 0 | 3; 0 0 1 | −2] x = 5, y = 3, z = −2 Check: 5 + 3 − 2 = 6; 2·3 + 5·(−2) = −4; 2·5 + 5·3 + 2 = 27

    Choose RREF and enter the coefficients with the constants in the last column. The calculator reads the result as a linear system and reports a unique solution, no solution or the number of free variables.

    Transpose and Special Matrices

    The transpose Aᵀ turns rows into columns: [1 2 3; 4 5 6]ᵀ = [1 4; 2 5; 3 6]. A matrix equal to its transpose is symmetric.

    TypeDefinition
    Identity1s on the diagonal, 0s elsewhere
    DiagonalNonzero entries only on the diagonal
    Upper triangularZeros below the diagonal
    SymmetricA = Aᵀ
    SingularSquare with det(A) = 0
    OrthogonalAᵀA = I, so A⁻¹ = Aᵀ

    Matrix Powers

    For a square matrix, Aⁿ multiplies A by itself n times, A⁰ = I and A⁻ⁿ = (A⁻¹)ⁿ. Powers model repeated steps such as population transitions or Markov chains.

    [1 1; 1 0]ⁿ = [Fₙ₊₁ Fₙ; Fₙ Fₙ₋₁] [1 1; 1 0]¹⁰ = [89 55; 55 34]

    The entries are Fibonacci numbers: F₁₀ = 55 and F₁₁ = 89. A non square matrix has no powers, because A × A is not defined.

    Common Mistakes

    • Multiplying entry by entry. A × B is row times column, not aᵢⱼ × bᵢⱼ. For [1 2; 3 4] × [5 6; 7 8] the top left entry is 19, not 5.
    • Swapping the order. AB and BA are usually different, and one can exist when the other does not.
    • Losing the sign pattern. In cofactor expansion the middle term of a 3 × 3 row is subtracted.
    • Inverting a singular matrix. Always check that det(A) ≠ 0 first.
    • Rounding during elimination. Rounded decimals in early row operations compound. Keep fractions until the end.
    • Assuming (A + B)² = A² + 2AB + B². It equals A² + AB + BA + B², which is different unless AB = BA.

    Related Calculations

    The Fraction Calculator checks the fraction arithmetic inside inverses and row reductions, and the Scientific Calculator handles decimal work. The Exponent Calculator covers powers of single numbers, the scalar version of Aⁿ.

    The Slope Calculator works with the lines behind two variable systems, and the Quadratic Formula Calculator solves the equation for 2 × 2 eigenvalues.

    Frequently Asked Questions

    How do you multiply two matrices?

    Matrix multiplication works row by column. Each entry of A × B comes from multiplying the entries of one row of A by the matching entries of one column of B and adding the products. For A = [1 2; 3 4] and B = [5 6; 7 8], the top left entry is 1·5 + 2·7 = 19, and the full product is [19 22; 43 50]. The number of columns in A must equal the number of rows in B. Order matters: B × A is [23 34; 31 46], a different matrix.

    How do you find the determinant of a 3x3 matrix?

    Expand along the first row. Multiply each entry of row 1 by the 2 × 2 determinant left after deleting its row and column, then combine the three products with the signs plus, minus, plus. For the matrix [2 −3 1; 2 0 −1; 1 4 5], the three minors are 0·5 − (−1)·4 = 4, 2·5 − (−1)·1 = 11 and 2·4 − 0·1 = 8. The determinant is 2·4 − (−3)·11 + 1·8 = 8 + 33 + 8 = 49. Row reduction to triangular form gives the same value.

    How do you find the inverse of a matrix?

    For a 2 × 2 matrix [a b; c d], swap a and d, change the signs of b and c, and divide every entry by the determinant ad − bc. For [4 7; 2 6], the determinant is 4·6 − 7·2 = 10, so the inverse is [6 −7; −2 4] ÷ 10 = [3/5 −7/10; −1/5 2/5]. For larger matrices, write [A | I] and use row operations until the left half becomes the identity. The right half is then the inverse. Multiplying A by its inverse must give the identity matrix.

    When does a matrix have no inverse?

    A square matrix has no inverse exactly when its determinant is 0. Such a matrix is called singular. Its rows are linearly dependent, which means at least one row is a combination of the others, so row reduction produces a row of zeros and the left half of [A | I] cannot become the identity. For example, [1 2; 2 4] has determinant 1·4 − 2·2 = 0, because the second row is twice the first. A matrix that is not square never has an ordinary inverse.

    Can you multiply a 2x3 matrix by a 3x2 matrix?

    Yes. A product A × B exists when the number of columns of A equals the number of rows of B, and the result takes the rows of A and the columns of B. A 2 × 3 matrix times a 3 × 2 matrix therefore gives a 2 × 2 matrix. For example, [1 2 3; 4 5 6] times [7 8; 9 10; 11 12] equals [58 64; 139 154]. Reversing the order also works here but gives a 3 × 3 matrix, [39 54 69; 49 68 87; 59 82 105]. A 2 × 3 matrix times another 2 × 3 matrix is not defined.

    How do you solve a system of equations with matrices?

    Write the coefficients and constants as an augmented matrix, then row reduce it to reduced row echelon form. For x + y + z = 6, 2y + 5z = −4 and 2x + 5y − z = 27, the augmented matrix is [1 1 1 6; 0 2 5 −4; 2 5 −1 27]. Its RREF is [1 0 0 5; 0 1 0 3; 0 0 1 −2], so x = 5, y = 3 and z = −2. If a row reduces to 0 = a nonzero number, the system has no solution. A column without a pivot means infinitely many solutions.

    Sources & References

    • NIST Digital Library of Mathematical Functions. §1.3 Determinants, Linear Operators, and Spectral Expansions (2 × 2 and 3 × 3 formulas, minors and cofactors, row operation rules, det(Aᵀ), det(A⁻¹), det(AB), triangular matrices). dlmf.nist.gov
    • NIST Digital Library of Mathematical Functions. §1.2 Elementary Algebra (matrix operations, transpose of a product, identity, inverse, trace). dlmf.nist.gov
    • OpenStax. College Algebra 2e, 7.5 Matrices and Matrix Operations (addition, scalar multiples, multiplication and its size rule). openstax.org
    • OpenStax. College Algebra 2e, 7.6 Solving Systems with Gaussian Elimination (augmented matrices, row operations, row echelon form). openstax.org
    • OpenStax. College Algebra 2e, 7.7 Solving Systems with Inverses (identity matrix, 2 × 2 inverse formula, augmenting with the identity). openstax.org

    Results are for educational purposes. Every worked number on this page was recomputed with the same functions the calculator uses. Methodology reviewed: 2026.