For now, I'm gonna talk about a very important operation involving matrices and vectors.
It's matrix-vector multiplication.
It's not something that we've seen before,
but it's actually going to be used basically throughout
the entire book and class from now on,
it's matrix-vector, uh, multiplication.
So here's what it is.
If I have an m by n matrix and n vector, uh,
so that means that the matrix here,
if I write it out,
it's got- it's going to have m,
uh, rows and n columns.
Then I can multiply it by an n vector like that.
Um, and the way we, uh,
denote matrix vector multiplication is just concat- concatenation,
meaning, you'd put the two symbols next to each other.
So you just say, ax.
Um, just like a lot of algebra,
just put the two symbols next to each other and it means the product,
in this case it means, matrix-vector product.
And so we'll call it the vets- it it- if that's that,
what you get from the matrix-vector product is an m vector,
um, and its ith entry is exactly this.
You go across the ith row of a and you multiply those by all the entries in x.
Um, that's- if you rec- you might recognize that as an inner product and you are right,
it is an inner product, right.
Um, so let's see how- let's just do
a quick example now just to see- make sure this makes sense.
Um, and it's confusing at first,
with all the indices flying around and you'll get used to it.
And also right now,
you don't really- you haven't seen any applications of this,
so it doesn't mean anything.
So just consider this for the moment,
kind of like the rules of chess.
You don't ask why can you do that,
or why can you not do that?
It's just the rules for now.
Okay. Let's- let's multiply- let's do matrix-vector multiplication.
Here is a 2 by 3,
uh, matrix, and here's a 3vector.
The first check is when you multiply an m by n matrix
by a vector x. N, that's the second dimension of the matrix,
has to match the vector dimension.
And that's true here because this is 2 times 3 and that's a 3 by 1,
if you like, or a 3 vector, okay?
The result is going to be a two vector.
So and sure enough it is.
Now let's see how to get it.
Well, what you do is the first entry in y,
which just happens to be 3,
is you take the first row of a, this is a,
this matrix here, this is a, and this is x,
and that is y, we take- we go across
the first row of x and we multiply it by the corresponding ith.
Or if you like, you could say roughly,
we take the inner product of the first row of a and x,
and that gives this,
and I mean we can even check that,
it's 0 plus 2,
and then, uh, plus 1 and minus 1 times minus 1, and so we get 3.
Okay, and that's correct. So that's the- that's matrix-vector multiplication.
Now, we can interpret this tons of ways, right?
And all of them we're going to use every single one in this sequel.
Um, and so the first is, you can express this as simply if- if you have
the rows of a and call them b_1 transpose up to b_m transpose.
Now b here are column vectors, right?
Not row vectors, but when you transpose them,
they become row vectors.
So b one transposes the first row of a.
Um, then you can write this,
y equals Ax is, well,
it's b_1 transpose x,
but which we now know is the inner product, right?
So it's the inner product of b and x.
So you could think of matrix-vector multiplication as simply,
it's like taking the inner product of every row
of the matrix with the vector x, let's say, okay.
Um, so you needed a batch inner product for example.
And here's an example,
if I say what is a_1's?
Bold 1 is the vector with all entries 1.
Then that's a- that gives you a vector and it gives you the row sums of a,
right? So for example, if I have a matrix a is,
you know, 0, 1, minus 1, 2,
then if I multiply that by 1,
1, uh, what I get is,
the first one is I get 1 here,
and down here, I get 1, right?
And this is 1, is the sum of the first row,
this 1 is the sum of the second row, right?
So when you see a_1,
you should be thinking, okay,
that's row sums, okay?
By the way, these are- these are kind of important because you're going to
wanna be thinking about rows,
columns, row sums, column sums,
all sorts of stuff like that.
Okay. Column interpretation is
also super interesting and uses a concept we've already seen.
If I write y equals Ax,
I can think of it as y is a linear combination of the columns of a.
So if a_1 through an are the columns of a,
then y is literally x_1,
a_1 plus x_2, a_2 plus xa_n.
And so you can think of the- you can think of
vector-matrix multiplication as super compact notation for
forming linear combinations of the columns of a using the coefficients given by x.
Okay? So here's a super, uh,
important example, It's something you just absolutely need to know.
A times e_j, e_j is the jth unit vector is the jth column of a.
Okay? And so it's kind of interesting, right?
It- so we- peep- you would say things like this.
You would say that multiplying a matrix by e_j picks out the jth column.
So let's just check that just for fun,
let's go to 0 minus 1,
3, 1, 0, and let's multiply that by the second unit vector, okay?
And what do we get?
Well, let's just do matrix multiplication,
let's sort of take the inner product of this with this and I'll do it in my head.
0, oh, it's 0, okay?
So I get up here, 0, okay?
And now in my head I'm going to take the inner product of this with this,
and I get 1.
And sure enough, look what I just got,
I just got the second column because this is a times e_2 equals a_2.
Okay? So and we're going to use this both ways.
If you multiply a matrix by a unit vector,
you're picking out a column.
Ah, also sometimes we will want to,
uh, we'll do it- we'll go the other- the interpretation will go the other way.
So, okay. Um, linear independence.
Linear independence says that,
if a linear combination of- of a bunch of vectors is 0,
the only way to do that is with the coefficients being 0.
So now we can write it in matrix vector notation, super compact way.
We would say, the columns of a are linearly independent if,
ax equals 0 implies a equals 0.
And just to kind of put a seed in your mind,
I'm going to say something more about that.
Um, you can- we can interpret it this way,
if a and x were numbers,
and I walked up to you and I said,
hey ax is 0,
product of two numbers is 0.
Um, then what you know is one of those two numbers is 0.
Or another way to say this is this,
if I say that ax is 0 and these- think of these as numbers now, 0.
And I tell you a is non zero,
then you could say, well the next has to be 0, period.
Okay. Um, or you could say things like I can
cancel a from- from this equation or something like that.
Okay. Now that's what linear independence means,
except it's for matrices and vectors.
It says- it says that when- if you have ax equals 0,
we can conclude x is 0, right?
So roughly speaking, we can cancel a or something from the equation.
Um, and so we can see there that linear independence can be interpreted
as sort of like the columns can be- can be
sorta- sort of interpreted as
a fancy matrix appropriate way of saying a is non-zero in the sense that it can be canceled.
So, okay, that was all vague and weird,
but we'll get to all those ideas later.