Home › Calculators › Matrix Multiplication Calculator

Matrix Multiplication Calculator

Enter two or three matrices of any compatible size up to 8 × 8 and get the product A × B with every dot product written out. Tap an entry of the result to see exactly which row and column produced it.

Last updated:

Entries can be integers, decimals or fractions like -3/4. Empty cells count as 0. Use Tab or the arrow keys to move between cells.

Advertisement
Advertisement

How to use the Matrix Multiplication Calculator

  1. Set the sizes of A and B with the row and column menus. The banner tells you straight away whether A × B is defined.
  2. Type the entries: integers, decimals or fractions. Tab and the arrow keys move between cells; Random and Identity fill a matrix quickly.
  3. Press Multiply (or Enter in any cell) to get the product.
  4. Tap any entry of the result to see the highlighted row of A, column of B and the full dot product.
  5. Copy the result for a spreadsheet or as LaTeX, or press Use result as A to keep multiplying.

The row-times-column rule

If A is m × n and B is n × p, the product C = AB is m × p and each entry is

cij = ai1b1j + ai2b2j + … + ainbnj

In words: walk across row i of A and down column j of B at the same time, multiply the pairs, and add. The inner sizes (the two n's) must match because every element of the row needs a partner in the column; the outer sizes give the shape of the answer.

Size reference

ABA × BMultiplications
2 × 22 × 22 × 28
3 × 33 × 33 × 327
2 × 33 × 22 × 212
3 × 22 × 33 × 318
1 × 3 (row vector)3 × 1 (column vector)1 × 1 (dot product)3
3 × 11 × 33 × 3 (outer product)9
4 × 44 × 14 × 116
2 × 32 × 3not defined–

Properties to remember

  • Not commutative: AB and BA are usually different. Try A = [[1, 2], [3, 4]], B = [[0, 1], [1, 0]]: AB swaps the columns of A, while BA swaps its rows.
  • Associative: (AB)C = A(BC), so a chain can be grouped either way, but the order of the matrices must stay the same.
  • Distributive: A(B + C) = AB + AC.
  • Transpose of a product: (AB)ᵀ = BᵀAᵀ, with the order reversed.
  • Determinants multiply: det(AB) = det(A)·det(B) for square matrices.
  • Zero products: AB can be the zero matrix even when neither A nor B is zero, so you cannot "cancel" matrices the way you cancel numbers.

For determinants, inverses and row reduction of the result, continue in the Matrix Calculator.

Frequently asked questions

How do you multiply two matrices?

Each entry of the product C = AB is a dot product: entry (i, j) is row i of A times column j of B, multiplying matching entries and adding them. For A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]], c₁₁ = 1·5 + 2·7 = 19, c₁₂ = 1·6 + 2·8 = 22, c₂₁ = 3·5 + 4·7 = 43 and c₂₂ = 3·6 + 4·8 = 50.

When can two matrices be multiplied?

A × B is defined only when the number of columns of A equals the number of rows of B. If A is m × n and B is n × p, the product is m × p. A 2 × 3 matrix times a 3 × 4 matrix gives a 2 × 4 matrix, but a 2 × 3 matrix cannot multiply another 2 × 3 matrix.

Is matrix multiplication commutative?

No. In general AB ≠ BA, and one of them can be defined when the other is not (a 2 × 3 times a 3 × 4 works, but 3 × 4 times 2 × 3 does not). Use Swap A and B to compare both orders. Matrix multiplication is associative, though: (AB)C = A(BC).

How many multiplications does it take?

Multiplying an m × n matrix by an n × p matrix takes m·n·p multiplications and m·(n − 1)·p additions. Two 3 × 3 matrices need 27 multiplications and 18 additions, which is why seeing every step helps when checking homework.

What does multiplying by the identity matrix do?

The identity matrix I has 1s on the diagonal and 0s elsewhere. For any matrix A of a matching size, AI = A and IA = A, just like multiplying a number by 1.

Can I multiply a matrix by a vector?

Yes. A column vector is an n × 1 matrix, so set B to n rows and 1 column. The product of an m × n matrix and an n × 1 vector is an m × 1 vector, the standard way to apply a linear transformation.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Matrix CalculatorAdd, multiply, invert and row-reduce matrices up to 5×5 with exact fractions and steps.Vector Calculator2D and 3D vectors: add, subtract, dot and cross product, magnitude, angle, unit vector, projection.Fraction CalculatorAdd, subtract, multiply and divide fractions with steps.Partial Derivative CalculatorPartial derivatives ∂/∂x, ∂/∂y, second and mixed orders with steps, gradient and Hessian.Cramer's Rule CalculatorSolve 2x2 and 3x3 linear systems by Cramer's rule with every determinant shown step by step.Percentage CalculatorWork out percentages, increases and decreases.Percentage Change CalculatorPercent increase or decrease between two values, and reverse.Percentage Difference CalculatorFind the percent difference between two values, with the formula.Ratio CalculatorSimplify, solve and scale ratios with step-by-step working.Proportion CalculatorSolve A/B = C/D for x with cross multiplication steps.Scientific CalculatorTrig, logs, powers and more in your browser.Multiplication Table GeneratorPrintable multiplication charts up to 30 × 30, single tables and practice sheets.Times Tables PracticeTimed times tables drills with a number pad, streaks and an accuracy heatmap.Fraction VisualizerInteractive fraction circles and bars: equivalents, comparing, adding and simplifying.Number Line GeneratorDraw number lines with any range, fractions or decimals, points, jumps and inequalities.Significant Figures CalculatorCount sig figs, round to any number of significant figures and do arithmetic with sig fig rules.Scientific Notation ConverterConvert numbers to and from scientific, engineering and E-notation, with exact digits and SI prefixes.Caffeine CalculatorAdd up daily caffeine, compare it with 400 mg and see how much is left at bedtime.Percent Error CalculatorPercent error between experimental and theoretical values, for one result or several trials.Rounding CalculatorRound to decimal places, significant figures or the nearest 10, 100 or 0.5, any rule.Long Division CalculatorDivide with quotient, remainder, decimals and a step-by-step long division layout.Cube Root CalculatorFind cube roots and nth roots, check perfect cubes and simplify radicals.2-Stroke Oil Mix CalculatorHow much 2-stroke oil to add to gas for 50:1, 40:1, 32:1 and more, in fl oz or ml.Math Worksheet GeneratorCreate printable addition, subtraction, multiplication and division worksheets with answer keys.Simplify Fractions CalculatorReduce any fraction to lowest terms with GCD steps, mixed number, decimal and equivalents.Complex Number CalculatorAdd, subtract, multiply, divide complex numbers; polar form, modulus, argument, powers and roots.Big Number CalculatorExact + − × ÷ mod and powers for huge integers with hundreds of digits, plus digit count.Three-Phase Power CalculatorkW, kVA and kVAR from volts, amps and power factor, or three-phase current from kW or kVA.Compression Ratio CalculatorStatic engine compression ratio from bore, stroke, chamber, gasket, deck and piston volume.Expanded Form CalculatorWrite any number or decimal in expanded form, word form and a place value chart.Mixed Number CalculatorAdd, subtract, multiply and divide mixed numbers, or convert improper fractions, with steps.Nth Root CalculatorAny root of any number: real nth root, simplified radical and all complex roots.Long Multiplication CalculatorMultiply whole numbers or decimals with the column method shown digit by digit.Order of Operations Calculator (PEMDAS)Solve arithmetic expressions step by step with PEMDAS/BODMAS, brackets, powers and fractions.Virtual Base Ten BlocksDrag ones, rods, flats and cubes onto a place value mat to model regrouping, addition and subtraction.Compare Fractions CalculatorCompare two or more fractions with <, > or = and put them in order, with steps.Equivalent Fractions CalculatorList equivalent fractions, check if two are equal, or find a missing number, with bars.Map Scale CalculatorConvert map distance to real distance and back for scales like 1:24,000 or 1 in = 1 mi.Number Properties CalculatorIs it prime, perfect, square, triangular or Fibonacci? See every property of a number.Paper Tape CalculatorAdding machine calculator with a running paper tape: edit entries, subtotals, notes, print or export.Pi Digits CalculatorCalculate π to up to 100,000 digits, find any number or your birthday in pi, and download it.PSAT Score CalculatorEstimate your PSAT/NMSQT section scores, total score and National Merit Selection Index.Rational Expressions CalculatorSimplify, add, subtract, multiply and divide rational expressions with excluded values.Rationalize the Denominator CalculatorRemove square roots and cube roots from a denominator, with conjugates and full steps.Reverse Percentage CalculatorFind the original value before a percentage increase or decrease, or the whole from a part.Riemann Sum CalculatorLeft, right, midpoint and trapezoid sums of f(x) on [a, b] with a table and rectangle graph.Sum CalculatorPaste any list or column of numbers to get the total, count, average, min and max instantly.Unit Rate CalculatorFind the unit rate (per 1) from two quantities, compare rates and see the steps.Math Formulas Cheat SheetSearchable algebra, geometry, trig, calculus and statistics formulas with a printable sheet.
See all 46 Arithmetic & Number Calculators →