01 / 21

Matrix-Vector
Products

Master how to multiply a matrix by a vector and discover the powerful connection to linear combinations.

Linear Algebra

What Is a Matrix-Vector Product?

A matrix-vector product \( A\mathbf{x} \) takes a matrix \( A \) and a vector \( \mathbf{x} \) and produces a new vector. It is the most fundamental operation in linear algebra: it transforms inputs into outputs.

Quick Refresher: Vectors and Matrices

Vector
An ordered list of numbers arranged in a column, like \( \begin{bmatrix} 3 \\ -1 \end{bmatrix} \).
Matrix
A rectangular array of numbers with rows and columns, like \( \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \).
Dimensions
An \( m \times n \) matrix has \( m \) rows and \( n \) columns. The number of columns must match the vector's length.

Why Does This Matter?

Matrix-vector products appear everywhere: systems of linear equations, computer graphics, machine learning, and physics simulations. The equation \( A\mathbf{x} = \mathbf{b} \) is at the heart of all of them.

The Row-Vector Rule

The row-vector rule says: each entry of \( A\mathbf{x} \) is the dot product of a row of \( A \) with \( \mathbf{x} \).

\(a_{11}\)
\(a_{12}\)
\(a_{21}\)
\(a_{22}\)
\(a_{31}\)
\(a_{32}\)
\(x_1\)
\(x_2\)
=
\(\text{row}_1 \cdot \mathbf{x}\)
\(\text{row}_2 \cdot \mathbf{x}\)
\(\text{row}_3 \cdot \mathbf{x}\)
Each output entry = dot product of one row with \(\mathbf{x}\)

The Column Rule: Linear Combinations

\( A\mathbf{x} \) can also be seen as a linear combination of the columns of \( A \), weighted by the entries of \( \mathbf{x} \):

Visualizing Linear Combinations

\(x_1\)
\(x_2\)
\(\mathbf{a}_1\)
\(\mathbf{a}_2\)
\(2\mathbf{a}_1\)
\(1\mathbf{a}_2\)
\(A\mathbf{x} = 2\mathbf{a}_1 + 1\mathbf{a}_2\)
\(\mathbf{x} = [2, 1]^T \rightarrow A\mathbf{x} = 2\mathbf{a}_1 + 1\mathbf{a}_2\)

Row View vs. Column View

Row-Vector (Dot Product) Column (Linear Combination)
Approach Dot each row with \( \mathbf{x} \) Weight each column by entries of \( \mathbf{x} \)
Formula \( (\text{row}_i) \cdot \mathbf{x} \) \( x_1\mathbf{a}_1 + x_2\mathbf{a}_2 + \cdots \)
Gives you One entry at a time The whole vector at once
Best for Computing answers Understanding geometry

Dimension Requirements

For \( A\mathbf{x} \) to be defined, the number of columns of \( A \) must equal the number of entries in \( \mathbf{x} \).

\(A\)
\(m \times n\)
\(\mathbf{x}\)
\(n \times 1\)
=
\(\mathbf{b}\)
\(m \times 1\)
must match!

How to Compute \( A\mathbf{x} \)

1
Check dimensions: Confirm the number of columns of \( A \) equals the length of \( \mathbf{x} \).
2
Row-by-row: For each row \( i \), compute the dot product of row \( i \) with \( \mathbf{x} \): multiply matching entries and add.
3
Stack results: The dot products become the entries of the result vector, in order from top to bottom.
4
Verify: The result should have \( m \) entries (one per row of \( A \)).

Example 1: \( 2 \times 2 \) Product

Compute \( A\mathbf{x} \) where:

1
Row 1: \( (1)(4) + (3)(2) = 4 + 6 = \) \( 10 \)
2
Row 2: \( (2)(4) + (-1)(2) = 8 - 2 = \) \( 6 \)

Example 2: \( 3 \times 2 \) Product

1
Row 1: \( (2)(5) + (0)(-2) = \) \( 10 \)
2
Row 2: \( (-1)(5) + (3)(-2) = -5 - 6 = \) \( -11 \)
3
Row 3: \( (4)(5) + (1)(-2) = 20 - 2 = \) \( 18 \)

Example 3: Column View in Action

Express \( A\mathbf{x} \) as a linear combination of columns:

Connection to Systems of Equations

The system of equations:

can be written as the single matrix-vector equation:

Common Mistakes

✕ Wrong dimensions
Trying to multiply when the number of columns of \( A \) does not equal the length of \( \mathbf{x} \). Always check dimensions first.
✕ Row-by-row, not entry-by-entry
Multiplying \( a_{ij} \cdot x_j \) individually without summing across the row. Each output entry is a sum of products.
✕ Wrong output size
Expecting the result to be \( n \times 1 \) instead of \( m \times 1 \). The output has as many entries as \(A\) has rows.

Summary Table

Concept Key Idea Formula
Matrix-vector product Transform a vector \( A\mathbf{x} = \mathbf{b} \)
Row view Dot products, one per row \( b_i = \text{row}_i \cdot \mathbf{x} \)
Column view Linear combination of columns \( x_1\mathbf{a}_1 + \cdots + x_n\mathbf{a}_n \)
Dimension rule Columns of \( A \) = length of \( \mathbf{x} \) \( (m \times n)(n \times 1) = m \times 1 \)
Systems connection Every system is \( A\mathbf{x}=\mathbf{b} \) Coefficients form \( A \)

Question 1 of 5

Compute \( \begin{bmatrix} 2 & 1 \\ 0 & 3 \end{bmatrix} \begin{bmatrix} 4 \\ -1 \end{bmatrix} \).

Question 2 of 5

If \( A \) is a \( 4 \times 3 \) matrix and \( \mathbf{x} \) is a \( 3 \times 1 \) vector, what is the size of \( A\mathbf{x} \)?

Question 3 of 5

The product \( A\mathbf{x} \) can be interpreted as a linear combination of which objects?

Question 4 of 5

Which of the following products is undefined?

Question 5 of 5

Express \( \begin{bmatrix} 1 & -2 \\ 3 & 0 \end{bmatrix}\begin{bmatrix} 2 \\ 5 \end{bmatrix} \) as a linear combination. What is the result?