Applied Linear Algebra
Navigate slides with PageDown/ArrowDown and PageUp/ArrowUp.
Navigate slides with PageDown/ArrowDown and PageUp/ArrowUp.
This lesson is focused on the following learning outcomes:
In this lesson we are going to define the concept of a basis and see how vectors can be represented by coordinates in such a bases.
We are also going to study how to transform a representation from one basis to another. But first the notions of
Linear Combination, Linear Independence and Linear Dependence
v=c1v1+c2v2⋯+cnvn
Let V be a vector space. A subset U⊂V is said to be linear independent if
For all finite subsets {v1,v2,…,vn}⊂V
c1v1+c2v2⋯+cnvn=0⇒c1=c2=⋯=cn=0 We saw earlier that this implied uniqueness of coordinates!!
Let V be a vector space. A subset U⊂V is said to be linear dependent if it is not independent
That is there exist a finite set of vectors v1,v2,…,vn
and scalars c1,c2,…,cn not all 0 such that
c1v1,c2v2,…,cnvn=0
Which means that one of the vectors can be written as a linear combination of the others. Say that ck=0 then
vk=ckc1v1+ckc2v2+⋯+ckck−1vk−1+⋯+ckck+1vk+1+⋯+ckcnvn
The span of the set U, span(U) is defined as the intersection of all subspaces of V that contain U
Or equivalently the more operational statement.
span(U)= the set of all finite linear combinations from the set U
This set span(U) is itself a subspace of the vector space V.
Try to convince yourselves that this is correct.
Let V be a vector space. Then the set B⊂V is a basis of V if
This definition calls for some examples
The term Hamel basis is useful to know when reading mathematical literature. It is used to distinguish the usual concept of a basis in a vector space from the concept of a Schauder basis, which is used in topological vector spaces.
The term Schauder basis is a more specialized concept that additionally involves the topology of the vector space and allows infinite convergent expansions. It will not be discussed in this course.
Let P be the vector space of all real polynomials of one variable.
That this is a vector space is easy to check.
Then the claim is that the set B={t0,t1,t2,t3,t4…} is a basis
First notice that the set B is not finite.
Consider the vector space Rn. The set B={e1=(1,0,0…0),e2=(0,1,0,…,0),…,en=(0,0,…,1)} is a basis. Notice it is finite
c1e1+c2+⋯+cnen=0
(c1,c2,…,cn)=0⇒c1=c2=⋯=cn=0
Fo any x=(x1,x2,…,xn)∈Rn
x=x1e1+x2e2⋯+xnen
This is called the standard basis
We are now ready to define the dimension of a vector space
At this point two theorems should be observed
We have seen one example of an infinite dimensional vector space but as stated earlier we will concentrate on the vector space Rn, which is as we saw is finite dimensional.
In this case we have further theorems
We saw an example of theorem 2 in an earlier exercise
Now that we have established that several basis can be used on the same space, how do we calculate the coordinates of a vector in one basis if we have the coordinates in another basis?
Say we have two different basis in Rn e1,e2…,enf1,f2…,fn
And we know the coordinates of some vector v in the first basis. That is
v=c1e1+c2e2⋯+cnen How can we calculate the coordinates di in
v=d1f1+d2f2⋯+dnfn
We have the known coordinates cj
v=j=1∑ncjej
But any of the basis vectors ej can be expressed as a linear combination in the basis fi. That is
ej=i=1∑naijfi
Which implies
v=j=1∑ncjej=j=1∑ncji=1∑naijfi=i=1∑n(j=1∑naijcj)fi=i=1∑ndifi
Where the i'th coordinate di in the basis fi is
di=j=1∑naijcj
Now this seems overwhelming! But let us look at it in steps
First of all the calculation is simple.
But what are the numbers aij
So let us carefully take an example we have seen before in R2
Consider two bases of R2:
e1=(1,0),e2=(0,1)f1=(1,1),f2=(−1,1) And a vector
v=c1e1+c2e2
We know that the coordinates in the new basis f1,f2 are calculated by
di=j=1∑2aijcj
And that for fixed j the a1j,a2j are the coordinates of the vector ej in the basis fi
Or formulated in words:
The new coordinate for v in the basis fi is calculated by
Calculating the sum of the old coordinates times every coordinate of that index i of the old basis in the target basis summed up.
So, we need the initial basis expressed in the target basis (1,0)(0,1)=a(1,1)+b(−1,1)=c(1,1)+d(−1,1)
a−b=1,a+b=0c−d=0,c+d=1 producing a=21,b=−21,c=21,d=21 That is a11=21,a21=−21,a12=21,a22=21
So to move from representation in initial coordinates ci in basis ei to a representation in new coordinates di in basis fi we have di=j=1∑2aijcj that is d1=a11c1+a12c2=21c1+21c2d2=a21c1+a22c2=−21c1+21c2
We have to get used to this so in R3 consider the basis
e1=(1,0,0),e2=(0,1,0),e3=(0,0,1)f1=(1,1,1),f2=(1,−1,1),f3=(1,1,−1)
First of all is the set fi linearly independent?
You can show this easily and since there are three of them it is a basis of the three-dimensional vector space R3
If a vector v has coordinates (c1,c2,c3) in the ei basis what are the coordinates in the fi basis?
So we have to express the initial basis vectors in the target basis
(1,0,0)=a11(1,1,1)+a21(1,−1,1)+a31(1,1,−1)(0,1,0)=a12(1,1,1)+a22(1,−1,1)+a32(1,1,−1)(0,0,1)=a13(1,1,1)+a23(1,−1,1)+a33(1,1,−1)
These are three linear systems of three equations in three unknowns. Let us write them down explicitly
100=a11+a21+a31=a11−a21+a31=a11+a21−a31010=a12+a22+a32=a12−a22+a32=a12+a22−a32001=a13+a23+a33=a13−a23+a33=a13+a23−a33
Which can be solved to a11=0,a21=21,a31=21a12=21,a22=−21,a32=0a13=21,a23=0,a33=−21 That is
(1,0,0)=0(1,1,1)+21(1,−1,1)+21(1,1,−1)(0,1,0)=21(1,1,1)−21(1,−1,1)+0(1,1,−1)(0,0,1)=21(1,1,1)+0(1,−1,1)−21(1,1,−1)
So following the rule we deduce d1=0c1+21c2+21c3=21(c2+c3)d2=21c1−21c2+0c3=21(c1−c2)d3=21c1+0c2−21c3=21(c1−c3)
This general calculational procedure can be organized into a special scheme which involves matrices.
Matrices are simply data organized in two-dimensional arrays.
If we organize the coefficients aij into a table and the coordinates into a column d1d2⋮dn=a11a21⋮an1a12a22⋮an2……⋱…a1na2n⋮annc1c2⋮cn
And we introduce a special operation called matrix multiplication we will see that this replicates the previous calculation
First of all we observe that the columns in the matrix are the coordinates of the initial basis in the target basis. a1k,a2k,…,ank are the coordinates of ek in the target basis fi
The way to conduct this operation in accordance with the sum formula is easiest shown by hand
Let us pick up the example in R3 The expansion of the old basis ei in the new basis fi was
(1,0,0)=0(1,1,1)+21(1,−1,1)+21(1,1,−1)(0,1,0)=21(1,1,1)−21(1,−1,1)+0(1,1,−1)(0,0,1)=21(1,1,1)+0(1,−1,1)−21(1,1,−1)
We construct the coordinate change matrix by making the the expansion coefficients columns like
d1d2d3=0212121−210210−21c1c2c3
And using the matrix multiplication we obtain d1=21(c2+c3),d2=21(c1−c2),d3=21(c1−c3)
We have now seen how to convert coordinates from one arbitrary basis to another arbitrary basis.
But it should be recognized that converting from some arbitrary basis to the standard basis is much simpler!
Why because we immediately know the coordinates of the initial basis in the standard basis.
This has an impact on practical calculations.
Consider some initial basis
f1,f2,…,fn
and let the target basis be the standard basis.
e1=(1,0,0,…,0),e2=(0,1,0,…,0),…,en=(0,0,0,…,1)
Let's assume we know the coordinates cj in the basis fj and want coordinates di in the standard basis ei.
Then we can immediately write the coefficients aij
a1k,a2k,…ank, are the coordinates of the k'th basis vector in the target basis which is the standard basis which in turn is simply the vector components of the k'th initial basis vector
Change from (1,1),(−1,1) to (1,0) to (0,1) then we have
(1,1)=1(1,0)+1(0,1)(−1,1)=−1(1,0)+1(0,1)
And as we discussed before the new coordinates (d1,d2) are calculated by the old coordinates by
d1d2=1c1+−1c2=c1−c2=1c1+1c2=c1+c2
Or put in matrix form
[d1d2]=[11−11][c1c2]
which implies new coefficients are d1=c1−c2,d2=c1+c2
A very important fact is if we use the transformation in the other direction we should get back the same coordinates.
In matrix formulation the transformation from basis (1,0),(0,1) to (1,1),(−1,1) is
[d1d2]=[21−212121][c1c2]
And in matrix formulation the transformation from basis (1,1),(−1,1) to (1,0),(0,1) is [c1c2]=[11−11][d1d2] This must imply that [11−11][21−212121]=[1001] Which is the case indeed.
This is a very important property of basis transformations, and it is called invertibility.
The transformation from one basis to another is invertible, and the inverse transformation is the transformation in the other direction.
So, given a matrix A that maps coordinates the inverse matrix A−1 maps the other way, which is not surprising.
This can be exploited in general coordinate changes between any two bases.
Consider the vector space Rn with bases
b1,b2,…bnf1,f2,…fn
And remember we have the standard basis e1,e2,…en Let's say we are given coordinates in basis bi and we want to change to coordinates in basis fi
It was very easy to construct the basis change matrix Bb→e from a general basis bi to the standard basis, and likewise from Ff→e from fi to the standard basis.
So, we have now simply construct
Ff→e−1Bb→e
First we transform from the bi coordinates to the standard coordinates and the transform from standard coordinates to fi coordinates by the inverse of Ff→e.
This of course forces us to calculate the inverse of a matrix but that can easily be done in calculational tools.
At this juncture we state some facts about coordinate transformation matrices.
Where Id is the identity matrix which has one's on the diagonal and zeros elsewhere. As this example of a 3x3 matrix indicates
Id=100010001 So if the matrix A transforms from one set of coordinates to another the inverse transforms the other way.
The matrix has an inverse if the determinant is non-zero
The determinant has a general formula
det(A)=σ∈Sn∑sgn(σ)a1,σ(1)a2,σ(2)⋯an,σ(n)
where
Sn is the set of all permutations of {(1,2,…,n)}
sign(σ) is the sign of the permutation +1 or −1
This is a very unpractical formula but is can be calculated in other ways. But for now we will use numpy to calculate it.
An intuitive understanding of the determinant is that the determinant gives the signed volume of the parallelepiped spanned by the column vectors
A very relevant use of the determinant is when we want to examine a set of vectors for linear independence.
We will exemplify in R3, but the technique generalized immediately.
Consider the set of vectors under test for linear independence b1b2b3=(1,−1,1)=(1,1,0)=(1,−1,−1)
The condition for linear independence is stated by
c1b1+c2b2+c3b3=0⇒c1=c2=c3=0
This is equivalently stated in matrix formulation as 1−111101−1−1c1c2c3=000
And if we are to be sure that the only solution is c1=c2=c3=0 the matrix has to be invertible. And then the determinant must be non-zero
We can calculate this in numpy
A_1=np.array([1,-1,1])
A_2=np.array([1,1,0])
A_3=np.array([1,-1,-1])
A=np.column_stack((A_1,A_2,A_3))
print(np.linalg.det(A))
# -4