What it is
The online matrix multiplication service with a detailed solution lets you calculate the product of matrices of the size you need and shows the detailed solution and the process of multiplying the matrices — how each element of the result is obtained.
A matrix is a mathematical object written as a rectangular table of numbers that allows algebraic operations (addition, subtraction, multiplication) between it and other similar objects. Matrix multiplication is one of the basic matrix operations. The matrix obtained as the result is called the product of matrices.
The rule
Multiplication of two matrices is possible only if the number of columns of the first factor equals the number of rows of the second; in this case the matrices are said to be compatible. The product of a matrix Am×n and a matrix Bn×p is a matrix Cm×p such that
cik = ai1·b1k + ai2·b2k + … + ain·bnk,
i.e. cik is the sum of products of the elements of the i-th row of A and the corresponding elements of the k-th column of B ("row by column"). The result has as many rows as A and as many columns as B.
Example
Multiply a 2×3 matrix by a 3×2 matrix — the result is 2×2:
| A | ||
|---|---|---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| B | |
|---|---|
| 7 | 8 |
| 9 | 10 |
| 11 | 12 |
- c11 = 1·7 + 2·9 + 3·11 = 7 + 18 + 33 = 58
- c12 = 1·8 + 2·10 + 3·12 = 8 + 20 + 36 = 64
- c21 = 4·7 + 5·9 + 6·11 = 28 + 45 + 66 = 139
- c22 = 4·8 + 5·10 + 6·12 = 32 + 50 + 72 = 154
Result: C = {{58, 64}, {139, 154}}. You can enter the same example as the string {2,3,1,2,3,4,5,6} for A and {3,2,7,8,9,10,11,12} for B.
Good to know
- Multiplication is not commutative: in general A·B ≠ B·A, and B·A may not exist at all. For A = {{1, 2}, {3, 4}} and B = {{0, 1}, {1, 0}}: A·B = {{2, 1}, {4, 3}} (columns swapped), while B·A = {{3, 4}, {1, 2}} (rows swapped).
- Associativity: (A·B)·C = A·(B·C), so a chain of transformations can be collapsed into a single matrix in advance.
- Distributivity: A·(B + C) = A·B + A·C.
- The identity matrix E (ones on the diagonal) changes nothing: A·E = E·A = A.
- Transpose of a product: (A·B)T = BT·AT; determinant: det(A·B) = det A · det B.
- Cost: two n×n matrices need n3 multiplications — 27 for 3×3 and a billion for 1000×1000.
Where it is used
- 3D graphics and games — rotation, scaling and translation are 4×4 matrices; their product is one matrix for the whole transformation. For example, a 90° rotation: {{0, −1}, {1, 0}}·(3, 1) = (−1, 3).
- Systems of linear equations are written as A·x = b; solution methods (Gaussian elimination, inverse matrix) rely on multiplication.
- Neural networks and machine learning — each layer is a weight matrix multiplied by an input vector; GPUs accelerate exactly this operation.
- Economics — the Leontief input–output model, cost calculations: a "product × material" matrix times a vector of material prices.
- Graphs — if A is an adjacency matrix, the entries of A2 count the paths of length 2 between vertices.
- Markov chains and probability — the transition over k steps is a power of the transition matrix.
- Image and signal processing — colour transforms (RGB → YUV), filters, the Fourier transform.
- Studying — check homework and see how each element was obtained.
How to use
- Set the size of A with the add/remove row and column buttons. The number of rows of B follows automatically — it always equals the number of columns of A; the number of columns of B can be changed.
- Enter the elements into the cells. Fractions (1/2) and expressions work.
- A matrix can also be entered as a string in the field below the editor:
{rows,cols,elements…}, e.g.{2,2,1,2,3,4}. - The result C and the detailed solution for every cik appear automatically. The link to the calculation can be copied and shared.