Matrix-Vector Product

Multiply a matrix by a column vector by taking a dot product of each matrix row with the vector.

Compute each output component

A 3×3 matrix times a 3-component column gives three components. Each row contributes its own dot product with the vector.

[[2, 1, 0], [1, 3, −1], [0, 2, 4]] · [[1], [2], [3]]

Follow row-column alignment

The matrix column count must equal the vector length. Evaluate both row dot products and keep them in a column in the same order.

[[1, 4], [−2, 3]] · [[2], [−1]]

Let zero entries simplify terms

Zero coefficients remove products from a row, while negative coefficients subtract them. The output still contains one component per matrix row.

[[0, 2, −1], [3, 0, 2]] · [[4], [−2], [1]]

Practice

Practice: problems like this one, made and checked in your browser.

Recap

  • Matrix rows dot with the input column.
  • The inner dimensions must agree.
  • The number of matrix rows determines the number of output components.