We're gonna start. Uh, these are the-this is the very first lecture, uh, associated with, um, the book Introduction to Applied Linear Algebra, Vectors, Matrices, and Least Squares. And we're gonna jump right in now at the very beginning, which is- vectors. Uh, so we'll start by talking a little bit about the, uh, notation.
So we'll talk about notation. Uh, we'll go on then and I'll-I'll say a little bit about examples and, uh, we'll talk a little bit about adding, uh, the first-first set of operations on vectors. But first, we're just gonna talk about vectors themselves.
Okay. So a vector, um, is just an ordered list of numbers. Uh, so-and it's usually-it's written-we'll use in-in-in the book, in the course, um, two notations for that. Um, so you can either write it, uh, vertically, uh, as an array of numbers stacked on top of each other, um, or you can write it in line like this.
Uh, and-and these are reasonably uniform-these are reasonably standard, uh, notations. Um, so, um- Up here, you'd see the conventional ones, which is where we, uh, these are the-this is where we denote it as a stacked, uh, list. Um, And we'll see later that these are called column vectors, but that-that's another story. Um, so these are-this is a vector.
Um, and we do-and-and it's-I should have mentioned it's-it's, uh, it's a little bit-it's not casual here, right? That, uh, right, we use commas here and we don't use, uh, we don't use semicolons or something and-and so on. And there-there's no notation in-in the stacked column things.
Okay. Now, that's what a vector is. So this is a-this is a vector, uh, here, uh, and three different ways you can see to write it.
Like this. this, or that. Okay. Now, the numbers, uh, in-in the-in the vector, uh, in-in these lists, um, those are called, uh, entry-they're called elements.
So the elements of the vector, the entries, coefficients, or components. So these are the-these are the words that would be used to describe it. All of these are used-used widely to describe-describe-to describe the entries.
So for example, you would say that the second component of this vector is. 0, right? You would say that its fourth entry is minus 7.2, right? So that's how you would refer to that. Um, now the number of elements in-in a vector, that's called its size.
Although maybe a better name to say it because later we're gonna have a concept of size of a vector. So to be less confusing, maybe a better term is dimension or length. So you would say that this vector, which I've now written three different ways for this three ways to denote this vector, you would say that its dimension is 4, right?
And so that's the idea. And if you have a vector of size n, or n is an integer like 1, 2, 3, 4, then you refer to that as an n vector, okay? So-so the vector described by these-any of these three equivalent notations, that's a four vector as people call it. Right? Um, now a-a one vector, um, I-I should say that the numbers inside are called scalars.
I mean, they're just numbers, right? But they're called scalars, right? And although we're not gonna-for us, the scalars are gonna be real-real numbers, like minus 1.1 or pi or, um, 3.267, they're gonna be numbers like that. Now- it is possible and there are applications where the entries are, for example, complex numbers, right?
Um, we won't encounter those, but it's not hard to extend what we do to the case where the entries are-are complex numbers. And so for us, these are called, uh, scal-scalars. Um, okay. Um, Now, we can't just-we don't just write down vectors with numerical entries. Um, a lot of times our discussion is they're gonna be abstract.
And so then what that means is you're gonna use a symbol to note a vector. And there's lots of ways to do that. Um, so for example, uh, here's a lowercase a and-and that's meant to denote a vector, uh, or capital X or P or Beta or E superscript ought.
Uh, actually, I don't know what that is. I presume ought is a mnemonic for whatever that is supposed to be. Um, and there's-there's some other conventions. So here, um, we don't-we're-we're gonna use a method where we just write these out and they're vectors. Um, Now, in some fields, in some areas, uh, people do things like, well, in fields where a vector is like a fancy thing, um, they consider them fancy and they might do things like write them in bold, or with an arrow on top.
So-so you'd see this and this. And you might see that in physics or mechanical engineering or some other areas where, you know, for whatever historical reasons they like to. remind you in the notation that something is a vector. Um, but we're not gonna do that.
Uh, we're gonna-we're gonna just write them as, you know, a lowercase a, capital X, that kind of thing. Um, now when you have abstract notation, the question is how do you refer to an entry of a vector? And that's done this way with subscripting, right?
So, um, if A is a vector, an n-vector, then, uh, you would have-you would denote the ith entry element, or coefficient, is gonna be A sub i, right? Obviously here, i goes from 1 to n. Um, if you-if you have a four vector and you say what's A sub 5, the answer is it has no-it's meaningless, right? So, um, That-that-that's the idea of what it-what it means.
So, uh, this is how we're gonna denote an-an entry, is by A sub i. Um, and so for example, let's go back to our vector here, uh, here. So we would say if-if this vector, if we call that a, then for example, a2 is equal to 0.0, okay? Which I guess is just 0. Um, so that's what a2 is. That's-that's how you'd refer to that.
Um, okay. Um, okay. So here, uh, the i in a sub i, um, is called the index. And the index, because it's an index into the vector, it tells me, you know, where do-where do I find, you know, the ith element and whatever.
Anyway, so it's-it's traditionally called an index. Um, and by the way, this is just a convention, but we typically use as indices and this is following long, actually centuries of mathematical tradition, is that indexes are typically denoted by i, j, k, l, n, m. Um, these are just conventions.
You can use anything you like to denote an index, but these are the-these are the traditional ones. Um, and then vectors, you know, are typically denoted A, B, C, or, you know, it could be, uh, P, Q, uh, you know, Z, Y, U, V, these-these kinds of things. And again, these are just pure conventions.
There-there's nothing-you-you can use anything to denote a vector. Okay. So i is gonna be the-the-the index. Um. Um, now, uh, as I said, uh, in so-called mathematical notation, uh, you index a vector from-from i equals 1 to n.
So a-so a is a vector, a sub 1 is what we'd say is the first entry, and a sub n is the last entry or something like that. Um... Now, there's gonna be some-an ambiguity in notation and, you know, we'll-we'll talk about it when we get there. But sometimes a sub i is not going to mean the i-th, uh, element of a single vector a, but actually we're gonna be talking about a list of vectors and a sub i is itself a vector.
We'll talk more about that when we come to that, but it's just something to be aware of. Um, okay. Uh, First concept about vectors, um, is equality, right?
So what we're gonna do is if I have two vectors, a and b of the same size, we'll say that they're gonna be equal, um, if all the-all the corresponding entries are the same. Okay? So that means, uh, you know, for example, I could write this, 1, 0 minus 1 equals, whoop. uh, equals, uh, you know, 1, 0 minus 1. Now that's not a very exciting equation there, right there.
Um, but I'd say a couple of things about this. The first thing is a concept that we are going to see over and over again in this course. And it's the concept of-it's the concept of sym-of symbol overloading. Um, and overloading is a really interesting, uh, concept.
What it means is that we have a single symbol, which is equality. Now, you know what equality is. You know, for example, what it means for two numbers to be equal.
It means that the same number, right? So 3.1 is 3.1. So that's-that's what equality between two numbers is. But here, we're gonna use the very same simple equals, uh, the symbol equals, and we're gonna use it between two vectors, and we're gonna write something like that, right?
And that doesn't mean the same as, you know, 3.1 equals 3.1, right? This- This says that vectors a and b are-are equal is what this says. And so, um, anyway, it's just a-it's a-I mean, it's related, you know, good overloading does the following.
You see something in a-in a-in a symbol or a concept that in an-that in a simpler context you understand, like equality. We know what it means for two numbers to be equal. Here we just borrow that concept and-and make it hold and define what it means for vectors, right? And so the idea is, you know, it should be kind of very natural. So that's the idea.
Um, actually before we go on, I would-I do want to make one, uh, one comment. Um, And that is that in what I'm describing now is-is-is standard mathematical notation. And it's how it's, you know, by default that's the language we're gonna be speaking, is just math, okay?
Um, actually the notation I'm using here would be universally understood throughout not just pure math, but- many, many mathematical areas where people use, uh, vectors. And just for the record, that's a whole lot of them, okay? So-so this is standard mathematical notation. Um, you really need to be careful and distinguish that from computer, uh, language notation, right? So each com-many computer languages or, uh, packages for doing vect-for handling and manipulating vectors, um, they'll have s-they'll have different syntax.
And so you have to be very careful. You're gonna have to learn-so what it means is, None is gonna be exactly like the mathematical one. Uh, some will be close.
Um, they might have semicolons or something like that. But-so what that really means is that, well, kind of unfortunately, at a very minimum, uh, you're gonna wanna learn two notation systems, right? One is mathematical notation. That's-that's the standard.
And the second one is whichever computer language you intend to work with, to follow along this way, you'll have to learn- uh, the language there and then you'll have to be able to translate back and forth. Now, what is absolutely critical is that you should never be confused, which of these two dialects you're speaking. Are you speaking math or are you speaking Julia or Python or whatever it is you-you choose to-to use. Um, so you need to keep those straight in your minds and don't mix them. I mean that-that's a-that's actually a very bad thing, it leads to great confusion.
Okay. So that's what a vector is. Um, by the way, at this point, I want to be completely honest. There-you should have no interest whatsoever because, well, it's not interest-we haven't said anything interesting. We've just said these are what vectors are.
This is-I mean, like who cares? Don't worry, we're gonna get to that. Uh, in fact, I would hope that within-by the end of this particular lecture, you'll at least have some idea that vectors can be like su-could be super interesting in some applications. Okay.
Um, now we have the concept of block vectors. And what this means is, um, if I have, uh, three vectors, I'm gonna call them b, c, and d. Um, and they have sizes, let's say m and p. Again, these are sort of standard mathematical conventions where things like m and p are typically dimensions and they're also typically integers, okay?
Um, so the stacked vector or concatenation. of the-of the vectors is-is denoted simply, you just stack them on top of each other like this, um, and put brackets around it, and there you go, you've got a stacked vector. Now, what this is, is it's a vector obtained by, uh, first putting all the entries of b, then the entries of C, then the entries of D, okay?
So let's just do a super simple example here. Um, let me-let me stack. I'll do it this way. How about, uh, s equals, you know, minus 1, 1. and t is going to be 0, 2, uh, 2, okay? And then I can form the following.
I can say that s stacked on t. So let's talk about this. Um, s is a two vector, right?
Meaning it's got dimension 2. Um, t is a three vector, meaning it's got dimension, uh, 3. Um, now the stack here, which is S stacked on top of T, this thing has dimension 5 and it is-here are the entries. It is the entries from S, right? Then the entries from T Okay.
So there's-that's S stacked on top of T That would be sort of the slang, uh, you would say or it's a-well, just a stacked vector. Okay. So this is an important concept and we're gonna see later, uh, that's gonna come up in a whole lot of applications and it's gonna be kind of interesting.
It's a way to just put two vectors together. Okay. Um, There are some special vectors that we're gonna talk about.
Um, so, um, a very special vector is the zero-is the so-called zero vector. Um, and what we're gonna do is we are gonna simply write it as zero, just like the number zero. That's strong overloading, right?
So in this course, when you see the symbol zero, it could mean- 0 the number or it could mean a 0, 12 vector or another 0 vector of some size. We'll-we'll get to that later. But the idea is, so we're gonna use the same symbol just without even thinking about it, is gonna represent both possibly a number, uh, or a-a vector itself. Uh, now if we really wanna say what the size is, we'll put a subscript. So 0, if I write 0 sub 3, right?
Then that's the following vector. It's the 3 vector with all- entries 0, that's the-that's the 3 vector. Okay.
Um, uh, so we're gonna write it that way. Um, now there's another vector. This-the 0 vector is- absolutely standard throughout all of mathematics, um, and-and mathematical applications. Um, now, the next vector that we're gonna encounter is something called one-the one vector, or sometimes the ones vector because it-there are many entries in it.
Um, that's the ones vector. And, uh, now that we are gonna distinguish a little bit, and we're gonna use this bold one to represent that, right? So here-here for example is one, I'll try to make that bold.
And this is the-the ones vector of size 2, and it's just a-a 2 vector with both entries equal to 1. Okay? So that's the ones vector. Um, oh, I should add that, you know, whatever computer language you're using will have operations to create, for example, zero vectors and ones vectors and things like that. So, um, I'm not gonna go into that, but-and they'll be-they may be different from our notation, but you'll see something like that. For example, it would be ones of, So a 5 and that would automatically give you a ve-a ones vector, a 5 vector with all entries 1. Okay.
A unit vector, that's another thing that's gonna come up. It's very, very, uh, important concept that's gonna come up a lot. Um, a unit vector is a vector where all entries are 0 except 1, and that entry is 1. So for example, that's a unit vector, uh, that is a unit-a unit 3 vector. So these three are-are unit vectors.
Uh, they are 3 vectors, meaning they have 3 entries, their dimension is 3. And this is e sub 2. And E sub 2 means it's the second one and it means that the entry in that vector that's one is-is two. So the second entry, the first and third entry are zero as you can see. So these are unit vectors, right?
So, um, again, I-I acknowledge that at this point, this should mean nothing to you. It should be like all of your other terrible math classes in the past. You're-if you're not thinking, why am I learning this or what-why should I care about this?
Well, you should be thinking that, okay? But don't worry, we're gonna get to it. These are just some very basic notation stuff and then we'll get into what, you know, what they represent.
And then later, I mean, actually later in the course you can actually do real stuff with them, like stuff you couldn't do before and that's kind of awesome. Okay. Uh, one last concept is, uh, sparsity, um, for a vector. So You say that a vector is sparse if a lot of its entries are 0, okay? Now, you know, if-if it's a small vector with dimension 10 or 20, I mean, who cares, right?
Um, but a lot of times we're gonna be messing around with vectors which have dimension like 1 million or 10 million or 100 million. I mean, there are plenty of vectors that-that-that people deal with that have those, okay? So that's an example, um, of-of-those are big vectors, right? And sometimes, uh, all the-you know, all the entries are non-zero or something like that. But in a lot of applications, you encounter a vector where Like, uh, it's a-let's say it's a 1 million long vector, but there's only a few hundred entries that are non-zero.
This is very common. We're gonna get to some examples and it'll become completely clear in examples when these things come up, but that would be an example. Um, anyway, a vector that has most of its entries zero is called sparse.
Um, and there's lots of things you can do with those. I mean, the most obvious is you can store them in a much more efficient way. Instead of storing on a computer, you know, almost a million.
numbers which are 0 and then, you know, 100 that are not. Instead of that, what you do is you simply make a list of-you make a data structure that, that, that somehow specifies which entries are non-zero and gives their values. And there's a lot of ways to do that. Um, it's also true that when you do operations on vectors, which we're gonna get to, we haven't seen them yet, but when you-but when we get to them, Those can be done-those can be performed quite, uh, efficiently, uh, on sparse, uh, vectors. Uh, so, uh, one concept for a vector is NNZ.
NNZ stands for number of non-zeros. And so that tells you how many of the entries in the vector are non-zero. So here-here's some sparse vector. Here's the sparsest vector in the world, zero, because all the entries are zero.
So that's a sparse-that's a very sparse vector. Um- Unit vectors, that's-that's about the second most sparse vectors you can have, right? Because if I say here is e 17, and it's a 100 vector, that means it's a 100 long vector.
If you wrote it out, you'd see 99 zeros, and then, you know, as the 17th entry, you would see a 1, and all the others entries would be 0. So that's a sparse vector. And you would say that nnz of that vector is 1. It has one non-zero entry. So that's-that's the idea.