Skip to content
ENExplore Calculators

Matrix Multiplication Calculator

Multiply two matrices and view the resulting matrix, used in neural network layers.

About Matrix Multiplication Calculator

Matrix multiplication (matmul) is the core operation in neural networks — every linear layer, attention mechanism, and convolution can be expressed as matmuls. For A(m×k) × B(k×n), the result is an m×n matrix requiring m×k×n multiplications and m×(k-1)×n additions.

Formula

Matrix Multiply

C[i,j] = sum(A[i,k] * B[k,j]) for k=1..K

m, k, n
Dimensions of input and output matrices

Worked example

With the default values below, Matrix Multiplication Calculator returns Result Elements of 6. Change any input above and every figure here is recalculated in your browser.

Inputs used

Rows in Aaccepts 1–10,000
3
Columns in A (= Rows in B)accepts 1–10,000
4
Columns in Baccepts 1–10,000
2

Results

Result Elements
6
Total Scalar Operations
42
Multiplications
24

Step by step

  1. 1Result matrix shape= 3×2
  2. 2Scalar multiplications: m × k × n= 24
  3. 3Scalar additions: m × (k−1) × n= 18

Assumptions and limits

  • The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

Why is matrix multiplication so important in deep learning?

Every fully connected layer computes Y = XW + b, which is a matrix multiplication. Transformers, CNNs (via im2col), and RNNs all reduce to batched matmuls, making it the single most performance-critical operation in ML.

How does this relate to FLOPs calculations?

The FLOPs for a matmul are typically counted as 2×m×k×n (counting multiply and add as separate operations), which is the standard used by hardware vendors and ML papers.

Matrix Multiplication Calculator (Vector Math) | Calcrivo