Matrix Calculator
English

Matrix multiplication cost tool

Matrix Multiplication Operations & Complexity Calculator

Calculate how many scalar multiplications and additions are required to multiply two matrices using the standard Row × Column method. Enter the matrix dimensions to see the result size, operation count, and the calculation behind it.

Matrix Multiplication Operation Counter

Matrix A

Current size: 3 × 3

Matrix B

Current size: 3 × 3

Result Matrix

3 × 3

Result Cells

9

Per Result Cell

3 multiplications

2 additions

Total Multiplications

27

Total Additions

18

Total Scalar Operations

45

Multiplications + additions

Calculation Behind the Count

  • Multiplications: 9 result cells × 3 multiplications per cell = 27
  • Additions: 9 result cells × 2 additions per cell = 18
  • Total scalar operations: 27 multiplications + 18 additions = 45 total scalar operations

Detailed Operation Breakdown

See exactly how the operation count is built from the Row × Column calculations in the result matrix.

Why Does 3×3 Matrix Multiplication Require 27 Multiplications and 18 Additions?

The 3×3 case is a common example. Here is the same reasoning written out specifically for 3×3 matrices.

A 3×3 result matrix contains 9 result cells. Each result cell is a dot product of one row and one column, so each cell contains 3 scalar multiplications and 2 additions.

9 cells × 3 multiplications = 27 multiplications
9 cells × 2 additions = 18 additions
Total: 45 scalar arithmetic operations

Show all 9 Row × Column calculations Hide all 9 Row × Column calculations
  • c11 = a11b11 + a12b21 + a13b31
  • c12 = a11b12 + a12b22 + a13b32
  • c13 = a11b13 + a12b23 + a13b33
  • c21 = a21b11 + a22b21 + a23b31
  • c22 = a21b12 + a22b22 + a23b32
  • c23 = a21b13 + a22b23 + a23b33
  • c31 = a31b11 + a32b21 + a33b31
  • c32 = a31b12 + a32b22 + a33b32
  • c33 = a31b13 + a32b23 + a33b33

9 cells × 3 multiplications = 27 multiplications
9 cells × 2 additions = 18 additions

Matrix Multiplication Operation Count Formula

You do not need to memorize these formulas: the calculator applies them automatically.

For an m × n matrix multiplied by an n × p matrix, the result dimensions are m × p and there are mp result cells.

  • Scalar multiplications: mnp
  • Scalar additions: mp(n - 1)
  • Total scalar operations: mp(2n - 1)
  • Square N × N case: multiplications N3, additions N2(N - 1), total 2N3 - N2

Common Matrix Multiplication Operation Counts

Matrix ProductResult SizeMultiplicationsAdditionsTotal Operations
2×2 × 2×22×2, 4 cells8412
3×3 × 3×33×3, 9 cells271845
4×4 × 4×44×4, 16 cells6448112
3×3 × 3×13×1, 3 cells9615
2×3 × 3×42×4, 8 cells241640

What Is the Complexity of Standard Matrix Multiplication?

For square N × N matrices, the standard Row × Column algorithm uses N3 scalar multiplications and N2(N - 1) scalar additions, so its arithmetic complexity grows on the order of O(N3).

The calculator above gives the exact operation count for a particular matrix size. Big-O describes how that count grows as the matrix size increases.

Advanced

Standard vs. Faster Matrix Multiplication Algorithms

Reducing scalar multiplications does not automatically make a method faster for small matrices or modern hardware. Additions, memory access, implementation overhead, vectorization, cache behavior, and hardware architecture also matter.

SizeStandardFaster algorithm note
2×28 multiplications, 4 additionsStrassen uses 7 multiplications and more additions/subtractions; a common formulation uses 18 additions/subtractions.
3×327 multiplications, 18 additionsLaderman-type algorithms use 23 multiplications but require substantially more additions/subtractions.
4×464 multiplications, 48 additionsRecursive Strassen uses 49 scalar multiplications with additional additions/subtractions and overhead.

For small matrices, the standard Row × Column method is often preferred because it is simple, predictable, and easy to optimize. Fast matrix multiplication algorithms are mainly important in algorithm analysis and larger-scale computation. Standard square multiplication is O(N3); Strassen is approximately O(N2.807).

About FLOPs

This calculator reports scalar arithmetic operations: multiplications plus additions. When the matrix entries are floating-point values, similar counts are often discussed in terms of floating-point operations (FLOPs). Hardware and FMA conventions can make practical performance accounting different from this simple arithmetic count.

Related Matrix Multiplication Tools