Matrix Dimensions and Entries
Matrix–Vector Multiplication
Matrices and their dimensions
A matrix is a two-dimensional array of numbers. Its size is described by its number of rows and columns:
An m×n matrix has m rows and n columns.
It therefore contains mn entries in total.
The entry in row i and column j is often written aij.
A general m×n matrix A has the form
Rows run horizontally and columns run vertically. For instance, a23 denotes the entry in row 2, column 3.
When matrix–vector multiplication is defined
A matrix can multiply a vector only when the vector has as many components as the matrix has columns. If A is m×n, then the vector must have n components and be written as an n×1 column vector:
The product Ax is then an m×1 vector:
The inner dimensions—the number of columns of A and the number of entries in x—must match. The output has one entry for each row of A, so it has m entries.
Matrix–vector multiplication is defined when the input vector’s length equals the matrix’s number of columns. The result’s length equals the matrix’s number of rows.
The row-by-row definition
Each entry of the output is formed by taking the dot product of a row of A with x. Thus,
For each row:
Multiply the first entry of the row by x1, the second by x2, and continue matching entries.
Add the products.
Use the resulting sum as the corresponding entry of the output vector.
This operation is a convention that defines matrix–vector multiplication. Its usefulness comes partly from how naturally it connects to dot products and linear combinations.
Example: calculating the product by rows
Consider the matrix and vector
The matrix has 4 columns, and the vector has 4 components, so the product is defined. Since A has 2 rows, the result has 2 entries.
The first output entry is the dot product of the first row with x:
The second output entry is the dot product of the second row with x:
Therefore,
Interpretation using row vectors and transposes
A row of a matrix can be treated as a row vector. If the rows of A are written as the transposes of column vectors a1,a2,…,am, then
The transpose switches rows and columns: a column vector becomes a row vector, and a row vector becomes a column vector. The output can then be written as
Each expression aiTx is a dot product. This notation makes clear that matrix–vector multiplication can be viewed as taking one dot product per row.
Interpretation as a linear combination of columns
There is another useful way to understand Ax. Suppose the columns of an m×n matrix A are the vectors v1,v2,…,vn. Then the matrix can be written as
Multiplying by x produces
Thus, matrix–vector multiplication is a linear combination of the columns of the matrix. The entries of x act as the weights on those columns.
Example using columns
Consider
The columns of A are
Therefore,
The coefficients x1,x2,x3,x4 determine how much each column contributes to the resulting vector.
Two complementary ways to read the product
For an m×n matrix A and an n-component vector x:
By rows: Each output entry is the dot product of one row of A with x. This produces m entries.
By columns: The result is a weighted sum of the n columns of A, with the components of x serving as weights.
Both interpretations describe the same operation. The row perspective is useful for calculating output entries, while the column perspective helps explain how the input vector combines the matrix’s columns.

Ask anything
We've read this whole study set, so questions about it get the best answers.