How to use the Matrix Multiplication Visualizer
- 1. Type matrix AOne row per line, numbers separated by spaces or commas.
- 2. Type matrix BIts row count must equal A's column count.
- 3. MultiplySee A, B and C side by side with every cell's working.
The rule
If A is m × n and B is n × p, then C = A × B is m × p, and each cell is a dot product: Cᵢⱼ = Σₖ Aᵢₖ × Bₖⱼ, row i of A times column j of B. The inner sizes (n) must match, or the product does not exist.
Worked example: A = [1 2; 3 4] and B = [5 6; 7 8]. The top-left cell is 1×5 + 2×7 = 19, then 1×6 + 2×8 = 22, 3×5 + 4×7 = 43 and 3×6 + 4×8 = 50, so C = [19 22; 43 50]. Swap the order and B × A = [23 34; 31 46], a different answer.
Why data scientists care
- Neural networks: a dense layer is a matrix multiplication of inputs by weights, plus a bias.
- Linear regression: the normal equation is β = (XᵀX)⁻¹Xᵀy.
- Graphics and images: rotations and scaling are matrix products.
- Speed: GPUs are fast mainly because they multiply big matrices in parallel.
In NumPy, use A @ B or np.matmul(A, B). A * B multiplies element by element, a common bug. For a 2 × 3 matrix times a 3 × 2 matrix, the result is 2 × 2 and needs 12 multiplications. See how layer shapes turn into weight counts in the neural network parameter calculator.
Frequently asked questions
Why does the tool say the sizes do not match?
The number of columns in A must equal the number of rows in B. Transposing one of them often fixes it.
Can I use decimals and negatives?
Yes. Any real numbers work.
Is the Matrix Multiplication Visualizer free?
Yes, the Matrix Multiplication Visualizer is free. The first time you see your first result, you are asked for your name and WhatsApp number once. After that, this and every other Uncodemy tool opens straight away without the form.