Matrix Dimensions and Entries


Matrix Dimensions and Entries

Corey
Let’s connect matrices to vectors. For our purposes, a matrix is a two-dimensional array of numbers. If a matrix is called an m by n matrix, m tells you how many rows it has, and n tells you how many columns.

Maria
So it contains m times n entries altogether. We can name an entry by its row and column: for example, a₁₁ is in row one, column one, and aₘₙ is in the last row and last column.

Corey
Now let’s define how a matrix can multiply a vector. If A has n columns, the vector x must have n components: x₁ through xₙ. If the number of components doesn’t match the number of columns, this matrix-vector product isn’t defined.

Maria
And when the dimensions do match, the result has one component for each row of A. So an m-by-n matrix times an n-component column vector produces an m-component column vector. You can see the dimension pattern as m-by-n times n-by-one, giving m-by-one; the matching n’s are what make the multiplication possible.

Corey
Here’s the rule for each output component: take one row of the matrix, multiply its entries by the corresponding entries of x, then add those products. For the first row, the result is a₁₁x₁ plus a₁₂x₂, continuing through a₁ₙxₙ. Repeat that process for every row.

Maria
That’s exactly a dot product between the row and the vector. In symbols, if the rows of A are the transposes of column vectors a₁ through aₘ, then Ax has entries a₁ dot x, a₂ dot x, and so on through aₘ dot x.

Corey
Let’s calculate one. Take the matrix with rows negative three, zero, three, two, and one, seven, negative one, nine. Multiply it by the vector two, negative three, four, negative one. The vector has four components, matching the matrix’s four columns.

Maria
For the first output entry, compute negative three times two, plus zero times negative three, plus three times four, plus two times negative one. That’s negative six plus zero plus twelve minus two, which equals four.

Corey
For the second entry, use the second row: one times two, plus seven times negative three, plus negative one times four, plus nine times negative one. That’s two minus twenty-one minus four minus nine, giving negative thirty-two.

Maria
So the product is the two-component vector with entries four and negative thirty-two. The two entries come from the two rows, and each one is a row-by-row dot product with the original vector.

Corey
There’s another useful way to understand the same multiplication: look at the columns instead. Suppose A has columns v₁ through vₙ, and x has components x₁ through xₙ. Then Ax equals x₁v₁ plus x₂v₂, continuing through xₙvₙ.

Maria
In other words, the entries of x act as weights on the columns of A. The result is a linear combination of those columns. Each column is scaled by its matching component of x, and then the scaled columns are added together.

Corey
So the row perspective says, ‘take dot products with the rows,’ while the column perspective says, ‘form a weighted sum of the columns.’ They’re two ways to describe exactly the same matrix-vector product.

Maria
And that column viewpoint will be especially useful when studying column spaces. For now, remember the compatibility rule, the output’s one entry per row, and both interpretations: row dot products or a linear combination of columns.

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