- Published on
Linear Algebra Ch1: Vectors and Vector Spaces
- Authors
- Name
- 走歪的工程師James
This series will the the culmination of the last 4 months I spent studying linear algebra. I intend to make a video series on linear algebra. This text version will serve as a stepping stone that will allow me to organize the logic and content to include in the video version, so that I can later focus entirely on crafting the animations without splitting my attention.
Most of the content is extracted from Linear Algebra Done Right and put in my own language. The numbering for all the definitions and theorems will be the same as the original text to allow the reader to refer back to the original text.
The purpose of this series is to provide an easier starting point for beginning learners, not to replace the original text or serve as a standalone resource for learning. I encourage motivated readers to read the original text for deeper understanding and insights.
The original text provides many exercises for readers to complete. Maybe too many! And I think doing exercises is only effective up to a certain point. The main goal is to understand the key concepts. You will forget a lot of the details after you are done with the book anyway. Hence, I will pick a selection of the problems for readers to complete for optimal efficiency.
Math cannot be learnt without actually writing it down on paper and thinking it through step by step. So I highly recommend doing these exercises. Refer to the original text or use help from AI to to facilitate your learning. They will definitely be of great help!
1.A:Vectors
Before taking linear algebra, most of us have seen a lot of vectors. In high school math, what we regarded as vectors were arrows or points on the 2D plane. Such as .
We've also seen arrows and points in the 3D space like . But vectors are not limited to 2 or 3 dimensional spaces. We can extend this concept to n-dimensional spaces.
Up to this point, we have denoted vectors by vertical matrices. Conventionally, we call vertical matrices vectors, not horizontal matrices.
Horizontal matrices such as are called row vectors.
Another way to denote (column) vectors are parentheses. For example, Both of these notations denote the same vector.
More generally,
Besides arrows or points in spaces, vectors can take on many physical meanings:
Color Codes
Asset Allocation
The asset allocation below can be represented by
Stock Returns
A vector can represent the daily return of a stock. , for example, can represent a stock that went down 2.2% on the first day, up 1.4% the next day, and up again 0.4% on the third day.
Cash Flow
Can flow can be represented by a vector as well. Suppose each entry gives the cash flow in a quarter. means a 1 year loan of $1000 with 1% interest payments made each quarter, and the principle and the last interest payment at the end.
Images
Above is a image. Flattening it gives us a 65536-vector that represents the image.
Videos
A grayscale video composed of frames that are , can be represented by a -vector.
Other Examples
There are many other examples I can't fit into this article. Here are some of them. Try to think of a way to represent these data with vectors:
- quantities of products hold
- values across a population (e.g. blood pressure)
- probabilities (e.g. coin flip)
- time series (temperature measurements)
- customer purchases
- features or attributes of an entity
- frequencies (e.g. word count)
Notations
One of the biggest mistakes I've made with math is the mindset of "as long as it's understandable" and not appreciating the importance of writing math in a neat, organized fashion. I used to just write down just a pile of numbers to show the process of my calculation. It was through learning how to write proofs that I understood how you can use language and words to explain and illustrate what you are doing with the numbers and notations. Knowing how to do this will make your math much more readable and understandable.
Knowing the notations well is necessary in order to translate your thoughts into clear and rigorous expressions.
Think of code. Using your notations well is equivalent to naming your variables well when coding. Explain each steps in your reasoning is equivalent to writing readable code and meaningful commit messages and comments.
Now we will look at notations that you will often see and use in linear algebra. It is crucial to familiarize yourself with notations.
vectors
For convenience, we have cleaner notations for vectors. For example:
We often leave out the subscript as well. In this example, the dimensionality of is implied by the context. So we can write:
unit vectors
The i-th unit vector refers to the vector that has 1 in the ith position and 0 everywhere else.
In other words:
Here, is a vector, and is a number. (the -th element).
ones vectors
We use the notation for the n-vector with all its elements equal to 1. As with zero vectors, the size is usually determined from the context, in which case we just write .
Definition of Vector and Notations
Lists
Having looked at various examples, we've familiarized ourselves with vectors. However, we have not defined what a vector truly is. Before we do that, let us define lists.
Definition 1.8:list
- Suppose is a non-negative number, a list of length is an ordered collection of elements. (an element could be a number, a list or other objects)
- Two lists are equal if they are equal in length and have the same elements in the same order
Some examples of valid lists:
You maybe thinking
Lists look similar to vectors, are vectors just lists?
The answer is it depends. Lists are indeed one of the most commonly seen form of vectors. However, vectors are a more general concept, so besides lists, there are other instantiations of vectors. As we formally define vector spaces, and see examples that are not lists, you will gradually develop an intuition for it.
, , and
You are probably already familiar with the notations and . represents the set of all the real numbers, and the set of all the complex numbers.
, naturally, represents the set of all n-lists of real numbers.
For example:
So, are vectors just lists of length n of elements of or ?
From an application perspective, this definition indeed works most for of the cases. But mathematicians are not satisfied with this. They want to go as abstract as possible. They want to find a structure more general than or . You will see what this means should you stay till the end. For now, you can think of vectors as just or to help conceptualize it.
Many times, we don't specify if we are working with or , so we will use to denote or .
Definition 1.6:notation: F
In fact, many of the theorems that work for and also work for arbitrary fields. A field is essentially a set over which addition, subtraction, multiplication and division are defined. So and are both fields.
Even though many theorems can be applied to any field, most applications are concerned with and . In this series, we will not deal with fields other than and .
Addition and Scalar Multiplication on F^n
What linear algebra does, to put it in very simple terms, is to extend addition and multiplication from 1 dimension to multi-dimensional spaces. So let's start with the most intuitive example, extending addition to .
Addition on
Addition on is identical to the familiar addition on 以及: you just perform number addition on each entry of the list.
定義1.13: F^n中的加法
A few examples:
- If ,then
- If ,then
This definition of addition satisfies commutativity, as you may verify.
Theorem 1.14:commutativity in F^n
If , then .
Notice that we use the word "define" here. This implies we could define a non-commutative addition. For example:
This definition of addition is not commutative.
We are not typically interested in these types of addition though, as they don't have the properties we desire.
Scalar Multiplication
Now we turn to define scalar multiplication on
As its name suggests, we multiply a vector by a scalar. We don't multiply 2 vectors with scaler multiplication.
Suppose we have a vector , and a scalar , then
Definition 1.18:scalar multiplication on F^n
A few examples:
- If ,then
- If ,then , the on the right being a vector, not a number
- If ,then
Linear Algebra Done Right, Ch1.A
Selected Exercises from- Find such that
- Explain why there does not exist such that
- Show that for all and all .
1.B:Vector Spaces
Defining Vector Spaces
We previously defined addition and multiplication over to show how these operations extend from one dimension to multiple dimensions.
Now we can proceed to define a vector space.
In simple terms, a vector space is a set where we can perform addition and scalar multiplication meaningfully
Let's break this down:
- For any two elements in a vector space , their sum is also in .
- For any scalar and vector , their product is in .
To make this intuitive concept more formal, let us look at the actual definition of a vector space.
Definition 1.20:definition of vector space
A vector space is a set along with an addition and scalar multiplication on such that the following properties hold.
commutativity
for all 。
associativity
and for all and for all 。
additive identity
There exists an element such that for all 。
additive inverse
For every ,there exists such that 。
multiplicative identity
for all 。
distributive properties
且 for all and all 。
Wow, that's a lot of conditions all at once - looks complicated!
Actually, this concept is quite simple. Remember what we said earlier? The most intuitive way to understand a vector space is as a "multi-dimensional set with defined addition and multiplication."
We want all the familiar properties of addition and multiplication that we know from and to apply to as well. That's really all there is to it - you'll notice that all the rules above are just properties we're familiar with from addition and multiplication in or .
We want these same properties to work in vector spaces, which is why we define vector spaces this way.
At this point, you might want to go back and verify that the addition and multiplication operations we defined earlier for satisfy all these conditions. Check why is a vector space, whether or . Let me demonstrate how to verify that satisfies the third rule.
F^n has an additive identity
Suppose and ,then there exists such that
Proof:
"Isn't this obvious just by looking at it? Why do we need to prove it?"
It might seem tedious, but this is the nature of mathematical proof - we need to ensure each step is rigorous and can't skip any steps. This example is simple, so you might feel an urge to skip the proof since the result seems obvious. However, as the things we need to prove become more complex, you'll start to appreciate the importance of becoming familiar with this step-by-step reasoning process.
You can verify in the same way that satisfies all the conditions for a vector space. It's precisely because meets these conditions that we can say is indeed a vector space.
The vector spaces and are so common they get their own names:
Definition 1.22: Real Vector Space, Complex Vector Space
- A vector space over is called a real vector space
- A vector space over is called a complex vector space.
Now we look at an example to illustrate that vector spaces aren't limited to , but are actually a more general structure.
Definition 1.24:Vector Space of Functions
- If is a set, then denotes the set of all functions from set to
- For , their sum is a function. For all , we define by
- For and ,their product is a function. For any ,we define by
The above definition, is a set of functions. We defined addition and multiplication on this set to make it a vector space. You may verify this definition satisfies the definition of a vector space, making a valid vector space.
As an example, let us verify has an additive identity.
In the set , there exists defined by
for all
This function is the additive identity in . The other conditions can be verified in a similar fashion.
As such, is a valid vector space, and we can refer to functions in this set as vectors, as with any other vector spaces.
At this point, you should be able to appreciate that vector spaces are not limited to the form , and a vector doesn't have to be a list.
Further Thoughts: Matrices
We can use to represent the set of all matrices.
For example:
So, is a vector space? What definitions of matrix addition and scalar multiplication would make satisfy the conditions of a vector space?
Linear Algebra Done Right, Ch1.B
Selected Exercises FromThe empty set is not a vector space. The empty set fails to satisfy only one of the requirements listed in the definition of a vector space (1.20). Which one?
Show that in the definition of a vector space (1.20), the additive inverse condition can be replaced with the condition that
Here the 0 on the left side is the number 0, and the 0 on the right side is the additive identity of .
The phrase a "condition can be replaced" in a definition means that the collection of objects satisfying the definition is unchanged if the original condition is replaced with the new condition.
Suppose is a real vector space.
The complexification of , denoted by , equals . An element of is an ordered pair , where , but we write this as .
Addition on is defined by
for all .
Complex scalar multiplication on is defined by
for all and all .
Prove that with the definitions of addition and scalar multiplication as above, is a complex vector space.
1.C:Subspaces
Now that we have a clear idea of what vector spaces are, we are ready to learn what a subspace is.
Definition 1.33:Subspace
Let be a subset of . If satisfies the definition of a vector space under the same additive identity, vector addition, and scalar multiplication definitions, then is a subspace of .
In simple terms, if a subset of is itself a vector space, then it's a subspace. For example, is a vector space, and is a subset, but clearly it's not a vector space. This is because when you multiply by any scalar, the resulting vector isn't in this subset. However, is a subspace.
So, how can we quickly check if a subset is a valid subspace? Do we really need to verify all the six rules every time?
Actually, it's simpler than you might think. We only need to check:
Theorem 1.34: quick check for subspaces
A subset of a vector space is a subspace of if and only if it satisfies these three conditions:
Additive identity
Closed under addition
If , then
Closed under scalar multiplication
If and , then 。
Straightforward, isn't it? A vector space is, by definition, closed under addition and multiplication after all.
Straightforward as it may seem, it not not that simple. To prove these 3 conditions are both necessary and sufficient for a subspace, we need to prove both directions: left to right and right to left.
From left to right, that is
is a subspace the three conditions hold
This proof is straightforward because if we assume is a subspace, then satisfies all 6 basic definitions of a vector space, so naturally it satisfies these three conditions as well.
The trickier part is proving from right to left, that is:
The three conditions hold is a subspace
To complete this proof, we need to first assume those 3 conditions holds and derive from there that satisfies the definition of a subspace.
Since this series is meant to be just an introduction, providing an entry point, we won't delve into the details of the proof. If you want to understand more deeply, you can refer to Linear Algebra Done Right.
Back to the main topic. Now that we know how to verify a subspace, let's look at a few examples to familiarize ourselves with the concept:
If , then
is a subspace of if and only if .
The set of all differentiable real-valued functions on is a subspace of .
Example 1
Let's first look at the first example
If ,then implies is not . This implies the additive identity is not in this set. Therefore is not a subspace.
The above characterization provides an intuition as an entry point. To complete a rigorous proof, we, again, need to prove both directions.
- Suppose is a subspace, and then prove
- Suppose ,and then prove is a subspace
I will leave out the details here. Try to complete the proof following the sketch of the proof provided.
Example 2
The set of all differentiable functions on can be denoted by:
Since is a function that maps to , , so is a subset of .
So to show, is a subspace, we only need to verify is (a) closed under addition, (b) closed under scalar multiplication, and (c) has an additive identity.
(a): The sum of two differntiable function is clearly differentiable. Hence (a) holds.
(b): A scalar multiple of a differentiable function is still differentiable. Hence (b) holds.
(c): Lastly, is trivially a differentiable function, so the additive identity exists in .
With that, we have successfully proved is indeed a subspace of .
Sum and Direct Sum of Vector Spaces
We have learned what is a valid subspace via some examples.
An idea that naturally follows is, how do we combine subspaces?
The Union operation on sets may come to mind as vector spaces are, in fact, sets. However, some quick verification will reveal that the sum of two vector spaces is not always a valid vector space with union as addition
For example, suppose , and . Even though both and are vector spaces, their union is not a vector space, because and , but the sum 。
So, union is not the definition of addition that we want.
You may pause and think, what kind of definition of addition will make the sum still a valid subspace? Below is the natural result you will arrive at:
Definition 1.36: sum of subspaces
Suppose are subspaces of . The sum of denoted by , is the set of all possible sums of elements in . Specifically,
With this definition of addition, the sum of vector spaces will still be a vector space.
Going back to the example we just looked at: and . With this definition of addition, .
Direct Sums
The sum of vector spaces involves adding vector spaces together, and a common application of this is when we want to decompose a vector space into multiple subspaces. In this case, we are particularly interested in situations where each vector can be uniquely decomposed.
This situation is called a direct sum. Let's look at the definition of a direct sum.
Definition 1.41: Direct Sum
Suppose are subspaces of .
- If every element in can be represented uniquely as a sum (where each ), then the sum is called a direct sum.
- If is a direct sum, we denote as , where the symbol is used to indicate that this is a direct sum.
Let's use a few examples to deepen our understanding of direct sums:
Example of a Direct Sum
Suppose is the subspace of where the last coordinate is equal to 0, and is the subspace of where the first two coordinates are equal to 0, that is:
Then , which you can verify for yourselves.
Here's the English translation of the paragraph:
Example of a Non-Direct Sum
Suppose
Then , because every vector can be written as
where the first vector on the right side belongs to , the second vector belongs to , and the third vector belongs to .
However, is not a direct sum of , because the vector can be written as a sum in multiple ways. Specifically, here's one way to decompose it:
And here's another way:
where in each of the above equations, the first vector on the right side belongs to , the second vector belongs to , and the third vector belongs to . Therefore, the sum is not a direct sum.
Next, let's look at some properties of direct sums.
Theorem 1.45: Condition for Direct Sum
Suppose are subspaces of . Then is a direct sum the only way to represent 0 as a sum (where each ) is by having each equal to 0.
First, how do we prove this theorem? Since this is an if and only if relationship, we need to prove both directions.
To prove the forward direction, we first assume that is a direct sum. Then by the definition of a direct sum, all vectors have only one way to be decomposed. So naturally, the 0 vector also has only one way to be decomposed.
To prove the reverse direction, we first assume that 0 has only one way to be decomposed. Since are individually subspaces, they each contain the 0 vector (the additive identity element). So, 0 can be decomposed in the following way:
Since we've already assumed that 0 has only one way to be decomposed, this means the above decomposition is the only way.
Next, assume any vector , and let's decompose in two ways:
Subtracting these two equations, we get
Because we've already proven that the only way to decompose 0 is
We get
Therefore, any vector v has only one way to be decomposed. With this, we have proven both directions.
How should we interpret this theorem? What does it mean?
It means that "we only need to confirm that the only way to decompose the 0 vector into a combination of is , to be certain that is a direct sum." In other words, we don't need to confirm that every vector in can only be decomposed into a unique combination, we just need to confirm that 0 has only one combination.
You might have also got a vague sense that the intersection of two subspaces and must be for them to be a direct sum. Because any subspace must contain , the intersection must also have .
Moreover, if the intersection contains vectors other than 0, it won't be a direct sum, because there will be vectors with more than one way to decompose. Specifically: if contains a non-zero vector , then it can have two decompositions , so they are not a direct sum.
In fact, is not only a necessary condition, it's also a sufficient condition. That is, as long as , it means . Let's see why below.
Theorem 1.46: Direct Sum Implies Intersection is Zero
Suppose and are subspaces of , then:
is a direct sum .
Proof:
This proof also requires proving both directions.
Assume is a direct sum. Now we want to prove that their intersection contains only the vector. So we assume . If we can successfully prove that , we will have successfully proven that .
- Since , and
- Since is a vector space,
- We can decompose as , where and
- Since and are both subspaces, they both contain the vector, so is also a way to decompose
- Since is a direct sum, has only one way to decompose, so , which proves the statement
Assume . According to 1.45, we only need to prove that the unique way to decompose is to prove that is a direct sum.
- Assume , where and
- means
- This means (because is the additive inverse of )
- So
- Therefore and , which proves the statement
Linear Algebra Done Right, Ch1.C
Selected Exercises FromFor each of the following subsets of , determine whether it is a subspace of .
- (a)
- (b)
- (c)
- (d)
Prove or give a counterexample: If is a nonempty subset of such that is closed under addition and under taking additive inverses (meaning whenever , then is a subspace of .
Prove or give a counterexample: If are subspaces of such that
then .
Hint: When trying to discover whether a conjecture in linear algebra is true or false, it is often useful to start by experimenting in .