Matrix Multiplication Calculator
Enter a 2×2 matrix and a 2×1 vector to compute their product.
What matrix multiplication does
Multiplying a 2×2 matrix by a 2×1 column vector produces another 2×1 vector: the matrix applies a linear transformation to the point or vector you feed it. Each output entry is the dot product of one matrix row with the input vector. At the defaults, [[1, 2], [3, 4]] × [5, 6] gives [17, 39].
How each entry is built
Row 1 of the result mixes the inputs with weights from the first matrix row: r1 = m11 × v1 + m12 × v2. Row 2 repeats the pattern with the second row of the matrix. Each output is a single dot product — multiply pairwise, then add. The dimension rule sits behind this: the matrix has 2 columns and the vector has 2 rows, so the inner sizes match and the product is defined, with shape 2×1 inherited from the outer sizes.
Geometrically, the matrix moves the point (5, 6) to (17, 39). Column 1 of the matrix, [1, 3], is where the basis vector (1, 0) lands; column 2, [2, 4], is where (0, 1) lands. Reading the matrix by columns tells you the transformation instantly, and the determinant 1 × 4 − 2 × 3 = −2 says the transformation flips orientation and doubles area.
Worked example with the default inputs
Row 1: r1 = 1 × 5 + 2 × 6 = 5 + 12 = 17. Row 2: r2 = 3 × 5 + 4 × 6 = 15 + 24 = 39. The result vector is [17, 39]. Both rows used the same input entries, only the weights changed, which is why one matrix can transform many vectors at the cost of four multiplications per vector.
A quick sanity check: if the matrix were the identity [[1, 0], [0, 1]], the outputs would be 5 and 6 unchanged. Any deviation of the result from the input measures what the transformation adds — here, mostly a stretch along both axes.
Sample transformations and their outputs
| Matrix | Action on [5, 6] | Result |
|---|---|---|
| [[1, 2], [3, 4]] | General shear and stretch | [17, 39] |
| [[2, 0], [0, 2]] | Doubles both coordinates | [10, 12] |
| [[0, −1], [1, 0]] | Rotates 90° counterclockwise | [−6, 5] |
| [[1, 0], [0, −1]] | Flips across the x-axis | [5, −6] |
The rotation row is worth memorizing: [[0, −1], [1, 0]] sends (5, 6) to (−6, 5), a quarter turn. Check it with the formula: 0 × 5 + (−1) × 6 = −6, and 1 × 5 + 0 × 6 = 5. Graphics engines chain such matrices — scale, then rotate, then translate — by multiplying them together first, so each vertex costs one final multiplication.
What matrix times vector is used for
- Computer graphics: every 2D sprite position is a 2-vector multiplied by a combined scale-rotate-translate matrix, billions of times per second across a game engine.
- Linear systems: the equations 4x + 7y = 1 and 2x + 6y = 1 are exactly [[4, 7], [2, 6]] × [x, y] = [1, 1], and solving them means finding the vector that produces the given output.
- Neural networks: a layer with two inputs and two neurons performs precisely this dot-product structure, scaled up to millions of entries on GPU hardware.
- Economics and input-output models: sector outputs are vectors multiplied by interindustry coefficient matrices.
Chaining transformations
Applying matrix M then matrix N to a vector v equals N × (M × v), and because matrix multiplication is associative you can pre-compute N × M once and apply the combined matrix to every vertex. Order still matters: for the default vector, rotating 90° then scaling by 2 gives [−12, 10], and scaling first gives the same [−12, 10] only because these two particular matrices happen to commute. A shear and a rotation generally do not commute, and swapping their order visibly bends the result.
Common mistakes
- Multiplying in the wrong order: [5, 6] × [[1, 2], [3, 4]] treats the vector as a 1×2 row and produces the row [23, 34], not the column [17, 39]. Row and column vector products differ.
- Adding entries instead of dot products: (1 + 2) × (5 + 6) = 33 looks superficially close to 17 but is not the operation. Multiply pairwise first, then sum.
- Ignoring dimension compatibility: a 2×2 matrix cannot multiply a 3×1 vector. The inner dimensions must match exactly.
- Assuming commutativity: M × v exists here but v × M is a different object entirely. Even for two 2×2 matrices, AB = BA holds only in special cases such as shared diagonal structure.
- Confusing the result shape: a 2×2 times 2×1 gives 2×1, always. If you expect a 2×2 output, you are multiplying two matrices, not a matrix and a vector.
Relation to solving systems and inverses
Matrix-vector multiplication is the forward direction of a linear system: given v, it produces M·v. The reverse direction — finding the v that yields a desired output — uses the inverse matrix, and the matrix inverse calculator computes it for any 2×2 input. Together the two tools cover the full loop: transform points with this calculator, undo the transformation with the inverse, and verify by multiplying back to the identity.
Scaling up beyond 2×2
Cost at larger sizes
The dot-product rule extends mechanically: an n×n matrix times an n×1 vector costs n² multiplications and n² − n additions, so 2×2 costs 4 multiplications while a 1000×1000 matrix costs a million. That quadratic growth is why graphics and machine-learning code lean on GPUs, which run the small multiply-adds in parallel. The hand arithmetic you practice here is identical in structure; only the volume changes.
Frequently asked questions
What is [[1, 2], [3, 4]] times [5, 6]?
Row 1 gives 1 × 5 + 2 × 6 = 17, and row 2 gives 3 × 5 + 4 × 6 = 39, so the result is [17, 39].
Why a 2×2 by 2×1 product?
The inner dimensions must match: the matrix has 2 columns and the vector has 2 rows, so the product is defined and inherits the outer shape, 2 rows × 1 column.
Can I multiply the vector first?
Not as a column. [5, 6] × [[1, 2], [3, 4]] only works if you treat the vector as a 1×2 row, and it produces the row [23, 34], a different answer from the column product [17, 39].
What is the dimension of the result?
2×1: two rows, one column. The rule is (m×n) × (n×p) = m×p, so (2×2) × (2×1) = 2×1.
How does a matrix rotate a point?
The matrix [[cos θ, −sin θ], [sin θ, cos θ]] rotates counterclockwise by θ. For 90°, [[0, −1], [1, 0]] sends [5, 6] to [−6, 5].
How many multiplications does this cost?
A 2×2 times 2×1 needs 4 multiplications and 2 additions, one dot product per row. An n×n matrix times an n-vector needs n² multiplications, which is 1,000,000 at n = 1000.
How do I use this to solve two equations?
Write the system as M·[x, y] = [b1, b2], then multiply the inverse of M by the output vector. For [[4, 7], [2, 6]] and output [1, 1], the solution is [−0.1, 0.2].
Does the identity matrix change anything?
No. [[1, 0], [0, 1]] × [5, 6] = [5, 6], since each dot product just picks out the original entry. It is the zero-action transformation and the fixed point of every inverse check.
Method and sources
- Standard matrix-vector multiplication rule (row by column).