Vector and Matrix Spaces
Fields
Before we talk about vector spaces I want to talk about a similar concept you have already been using a lot called fields. Fields are written using upper-case hollow letters such as . Seems familar? A field is a set of elements for which the basic arithmetic operations are defined:
- Addition and subtraction
- Multiplication and division.
In relation to vectors these fields are just used to indicate the dimensionality of a vector. For example the field indicates that the vector is a 3-dimensional vector with real numbers such as .
Vector Spaces
On the other hand a vector space or also called linear space is a set of elements for which addition and scalar multiplication is defined. The elements of a vector space are then called vectors, which we have already gotten to know. Vector spaces are usually written using italicized upper-case letters such as . More specifally the elements of a vector space must have the following properties where is the null vector:
- Additive inverse: .
- Additive identity: .
- Addition is commutative: .
- Addition is associative: .
- Scalar multiplication identity: .
- Scalar multiplication is distributive over vector addition: .
For our "normal" vectors where the elements are real numbers we already know this is the case. Therefore the set of all vectors with our defintions of vector addition and scalar multiplication is a vector space, the so called real vector space. However, with proper defintions of these operations this idea can be extended to create a vector space where the elements of the vectors are complex numbers or functions.
An equivalent definition of a vector space can be given, which is much more concise but uses lots of fancy words from abstract algebra. The first four axioms (related to vector addition) say that a vector space is an abelian/commutative group under addition, and the remaining axioms (related to the scalar multiplication) say that this operation defines a ring homomorphism from the field F into the endomorphism ring of this group. Even more concisely, a vector space is a module over a field.
Subspaces and Ambient Spaces
We often don't actually care about vector spaces, but much more about subspaces. A subspace is a subset of a vector space that is itself is a vector space. The ambient space is the vector space that contains the subspace. Think of it this way. We can have a 3-dimensional ambient space, so a room. In this room we can then add a wall, or a plane which is a 2-dimensional subspace. This plane is then a vector space itself, but it is contained in the 3-dimensional ambient space.
Lets look at some examples of subspaces. Think of a vector in 2-dimensional space. Now we can obtain a set of vectors that are all multiples of the vector . If we then think of all the points we can reach we get a infinetly long line through the origin. This line is a 1-dimensional subspace of the 2-dimensional ambient space. We can then then take another vector and do the same thing. This will give us another line through the origin and another 1-dimensional subspace. If we now combine these two vectors as a linear combination we get a plane through the origin. This plane is a 2-dimensional subspace of the 2-dimensional ambient space. So it covers the whole space. We also often then say that and span the subspace.
So we can formally define a subspace of a vector space as a subset of that satisfies the following properties:
So if we take any two vectors from the subspace and multiply them with any scalar we get a vector that is also in the subspace (closure under addition and scalar multiplication). Additionaly the subspace must contain the null vector . This is because the null vector is always in the subspace. If we take any vector or linear combination of vectors in the subspace and multiply it with 0 we get the null vector.
Think of this question before you read on. The answer is no. Two vectors can only span a plane if they are linearly independent. This means that they are not multiples of each other. If they are multiples of each other they are linearly dependent and they only span a line.
0-Dimensional Subspace
We saw above that in an ambient space of dimension we can have subspaces of dimension and . However, we can also have subspaces of dimension . This 0-dimensional subspace can be created by taking the null vector . No matter how many times we multiply it with a scalar it will always stay the null vector and just a point at the origin. This is a 0-dimensional subspace.
This means that in an -dimensional vector space we can create subspaces. One for each dimension from to .
Therefore all vector spaces have at least two subspaces, the 0-dimensional subspace and the vector space itself.
Span
The span of a set of vectors is the set of all possible linear combinations of the vectors. This is quiet clearly related to subspaces as subspaces are the set of all possible linear combinations of a set of vectors. The span of a set of vectors is a subspace of the vector space. This is why it is often said that a subspaces is spanned by a set of vectors.
- , a 0-dimensional subspace in a 2-dimensional ambient space.
- , a 2-dimensional subspace (plane) in a 2-dimensional ambient space.
- , a 2-dimensional subspace in a 3-dimensional ambient space.
Basis
We have already seen above that some vectors don't actually increase the dimensionality of the subspace they are in. This has to do with them being a linear combination of the other vectors. So if we have a specific subspace we might want to find the minimal set of vectors that spans this subspace. This is called a basis. More formally a basis of some subspace is a set of vectors that are linearly independent and span the subspace. The most common example of a basis is the standard basis that spans the real vector space. The standard basis is the set of vectors where is the vector with a 1 at the -th position and 0 elsewhere.
A subspace can have many different bases, but all bases have the same number of vectors. This number is called the dimension of the subspace. So any linearly independent set of 2 vectors with 2 components will span a 2-dimensional subspace in a 2-dimensional ambient space.
Some basis for the 2-dimensional real vector space :
Orthogonal and Orthonormal Basis
Certain bases are better then others as they make calculations easier and have nice properties.
One of these categrories are orthogonal bases. An orthogonal basis is a basis where all the vectors are orthogonal to each other. This means that the inner/dot product of any two vectors in the basis is zero. However, this does require that that the vector space is a inner product space, which is a vector space with an inner product defined on it.
Another category are orthonormal bases. An orthonormal basis is a basis where all the vectors are orthogonal to each other and have a length of 1. This means that the inner/dot product of any two vectors in the basis is zero and the inner/dot product of a vector with itself is 1 because the length of a vector is the square root of the inner product of the vector with itself. An example of an orthonormal basis is the standard basis of the real vector space.
Change of Basis
Coordinate Vectors
We know vectors are identified by their magnitude and direction. Most often it also easist to think of a vector in its standard position, an arrow pointing from the origin to somewhere in space. In the standard position the point the vector is pointing to in the cartesian coordinate system is the point that matches the vectors components. This sequence of coordinates is called the coordinate vector of the vector. More formally the coordinate vector of a vector with respect to a basis is the set of scalars such that for any vector from the vector space spanned by the basis . In the standard position the vector space is spanned by the standard basis vectors which is why the coordinates are just the components of the vector and the coordinate vector is the vector itself. However, we have seen that a vector space can be spanned many different bases, so the coordinate vector of a vector can change depending on the basis.
We have the vector in . We then have the standard basis . The coordinate vector of with respect to the standard basis is then:
Now if we have the basis the coordinate vector of with respect to the basis is:
Matrix Spaces
In some cases it is useful to think of a matrix as a collection of vectors.
Column Space
A matrix can be thought of as a collection of column vector. So a matrix with columns can be thought of as column vectors concatenated together. If we then take the span of these column vectors we get a subspace of the vector space. This subspace is called the column space of a matrix. The number of rows in the matrix is the dimensionality of the ambient space. The largest number of linearly independent column vectors is the dimension of the column space, this corresponds to the rank of the matrix. If all the column vectors are linearly independent then the column vectors also form a basis of the column space. The column space of the matrix is denoted as .
Lets look at the following matrices:
Determining the ambient spaces is easy as we just need to count the number of rows, i.e the components of the vectors. The column spaces are then the span of the column vectors.
To find the dimension of the column space we can use the rank of the matrix. The rank of matrix is because the third column vector is two times the first column vector plus the second column vector. The rank of matrix is , i.e it is full rank.
Therefore the column space of matrix is a 2-dimensional subspace in a 5-dimensional ambient space and the column space of matrix is a 4-dimensional subspace in a 4-dimensional ambient space.
Column Space of AA^T
Interestingly the column space of the matrix is the same as the column space of the matrix .
Firstly if is a then is a matrix. So we can see that the ambient spaces are the same, but the number of column vectors is different. The ambient spaces being the same is a however a good precondition for the column spaces being the same.
If we then look at what the matrix multiplication for actually is, we can see that it is just a linear combination of the column vectors of . This means that the column space of is the same as the column space of . Because a vector space is defined by all the possible linear combinations of the vectors that span it. Thus a linear combination of the column vectors of can not leave the column space of so it must be at least a subset of the vector space. But because we also know that the rank of is the same as the rank of due to the rank-nullity theorem we know that the column spaces have the same dimensionality and therefore must be the same. However, the basis of the column space of is different from the basis of the column space of because the vectors are different and the number of vectors is different. Therefore we can say the following:
If we look at the matrix multiplication we can see the linear combination of the column vectors of in the matrix .
Membership of a Vector in the Column Space
If we have a vector and we want to know if it is in the column space of a matrix we are actually asking the question of whether the vector can be written as a linear combination of the column vectors of . This is the same as asking if the vector is in the span of the column vectors of . This turns into our favorite equation to solve:
Where is the vector containing the linear weights of the linear combination. If we can find a solution for then the vector is in the column space of . This equation can be solved using gaussian elimination. If the vector is not in the column space of then the equation has no solution. This can be interpreted as if the say the matrix has a column space that is a plane in and the vector is a vector that is not in the plane. Then the vector is not in the column space of .
Therefore the vector is in the column space of the matrix.
Augment-rank Algorithm
There is also another way to determine if a vector is in the column space of a matrix. This is the augment-rank algorithm. The idea is very simple and relies on the fact that the rank of a matrix is equivalent to the dimensionality of the spanned space. If we concatonate the matrix with the vector and then calculate the rank of the augmented matrix. If the rank of the augmented matrix is the same as the rank of the matrix then the vector is in the column space of the matrix because the vector can be written as a linear combination of the column vectors of . If the rank increases then the vector is not in the column space of the matrix and has added a new dimension to the spanned space.
To calculate the rank of the augmented matrix we can use gaussian elimination to bring the matrix into row-echelon form. The rank of the matrix is then the number of non-zero rows in the row-echelon form.
Row Space
Just like a matrix can be thought of as a collection of column vectors it can also be thought of as a collection of row vectors. If we then take the span of these row vectors we get a subspace of the vector space. This subspace is called the row space of a matrix. The number of columns in the matrix is the dimensionality of the ambient space. The largest number of linearly independent row vectors is the dimension of the row space, this corresponds to the rank of the matrix. The row space of the matrix is denoted as .
Therefore by taking the transpose of the matrix we can interchange the row space and the column space. This means that the row space of the matrix is the same as the column space of the matrix and vice versa.
From the above it is quiet easily to see that if a matrix is symmetric then the row space is the same as the column space. This is because the matrix is the same as its transpose. Also if the matrix is full rank then the row space is the same as the column space. This is because the two spaces then have the same dimensionality and therefore must be the same.
Row Space of A^TA
Just like for the column space of the row space of is the same as the row space of because we can show that the matrix is a linear combination of the row vectors of . So we can say the following:
And because the matrices and are symmetric we can also say that the column spaces are the same as the row spaces:
However this does not mean that . This is only the case if the matrix is symmetric and full rank.
Null Space of a Matrix
Not interested in trivial case where .
Left Null Space
null space of the transpose of the matrix. is the same as .
Orthogonal Subspaces and Complements
Spaces of Functions
We can also define a space of functions. This is a vector space where the elements are functions. The functions must satisfy the properties of a vector space.
For example C[a,b] is the space of continuous functions on the interval [a,b]. This is a vector space because the sum of two continuous functions is continuous and the multiplication of a continuous function with a scalar is continuous.
Can also be extended to C^k[a,b] where the functions are k-times differentiable.
P_m is the space of polynomials of degree m. This is a vector space because the sum of two polynomials is a polynomial and the multiplication of a polynomial with a scalar is a polynomial.
Normalized Vector Spaces
Vector Spaces with Dot Products
from this you can then also define orthogonality and therefore also orthonormal bases.