Introduction to Linear Algebra in Machine Learning
This lecture introduces linear algebra concepts tailored specifically for machine learning understanding, emphasizing intuition and graphical visualization.
Understanding Vectors
- Vectors have magnitude and direction and are often anchored at the origin in machine learning.
- Example: a 2D vector represented as a column matrix [x; y]. For a deeper dive, see Comprehensive Overview of Matrices and Determinants in Mathematics.
- Computer science vectors can also represent data points (e.g., student details).
Vector Addition and Scalar Multiplication
Vector Addition
- Adding vectors involves summing respective components (e.g., (3,4) + (2,-1) = (5,3)).
- Geometrically, this translates into sequential movements along axes.
Scalar Multiplication
- Multiplying a vector by a scalar scales its magnitude without changing direction.
- Negative scalars reverse direction.
- Example: scaling vector (2, -1) by 2 results in (4, -2).
Unit Vectors and Vector Decomposition
- Unit vectors along axes, denoted i (x-axis) and j (y-axis), are used to express any vector as a linear combination: v = ai + bj.
- This foundational operation enables accessing any point in 2D space.
Span: Where Vectors Reach
- The span of vectors is the set of all possible linear combinations of those vectors.
- Two non-parallel vectors span the entire 2D plane.
- Example: vectors i1 and j1, different from standard unit vectors, can still span 2D space if not parallel.
3D Space and Vector Span
- Two vectors in 3D span a 2D plane, not the entire space.
- A third vector, if not lying within the plane spanned by the first two, allows spanning the entire 3D space.
- Vectors parallel or lying in the same plane limit the span accordingly.
Linear Independence and Dependence
- Vectors are linearly independent if no vector can be expressed as a linear combination of others.
- Linear dependence implies redundancy , one vector can be written as a combination of others.
- Examples demonstrate independence/dependence in 2D and 3D space.
Basis Vectors
- A basis is a set of linearly independent vectors that spans the entire space.
- In 2D, two independent vectors form a basis; in 3D, three vectors are needed.
- Bases are not unique; any suitable set of linearly independent vectors spanning the space qualifies.
Relevance to Machine Learning
- Concepts of span and basis underpin linear transformations used in ML for dimensionality reduction or expansion.
- Understanding these helps grasp how models transform input data vectors. For a foundational perspective on predictive models and optimization, see Introduction to Linear Predictors and Stochastic Gradient Descent.
Summary
This lecture provides a geometric and intuitive understanding of essential linear algebra topics: vectors, linear combinations, span, linear independence, and basis vectors, all critical for comprehending machine learning algorithms and transformations. For further context on optimization problems that sometimes relate to basis and span, consider Understanding Linear Programming Problems in Decision Making.
[Music] hi welcome to the course foundations for machine learning and we'll be covering
the mathematical foundations for machine learning in this module particularly this lecture starts with the linear
algebra and we'll be looking at linear algebra mostly from a machine learning standpoint what exactly in linear
algebra should we learn and should we understand deeply so that we can understand MS at a deep level so that is
the objective of this part of the course so within linear algebra we'll be looking at mainly intuition especially
graphical intuition so can you visualize the operations happening in linear algebra from a visual point of view and
how are these operations relevant to machine learning so these this will be our Focus rather than teaching the
entire depth of linear algebra so let's start with the very basic idea within linear algebra that of a vector
uh in physics we Define Vector as something that has a magnitude and something that has Direction and this
this Vector can basically move around it need not be having its tail at origin right if you have a XY coordinate system
the vector can start from pretty much anywhere it can extend till somewhere and it has a direction
magnitude in computer science we have another type of Vector in which we can store certain list of numbers so the
list of numbers could be about let's say details of a student who is uh having a student ID 347 age 20 and body weight um
70 kilogram something like this and if a collection of these numbers are existing like this as a list of numbers
essentially this is a threedimensional vector so this is a this is a representation of the
vector and in linear algebra especially for the purposes where we are discussing about machine learning the vector is
almost always rooted at the origin so if we have a coordinate system uh we will not be drawing so when you when you say
rooted at the origin I I really hope you understand what I mean it's uh fairly trivial so we won't be looking at
vectors like this uh so this has a certain magnitude and certain direction but rather the same magnitude same
direction we'll be looking at a vector that looks more like this so the same Vector but it's rooted at origin and
this is the XY coordinate plane so we'll be looking at vectors like this and you will understand why we are talking about
this in in a in in in a short time so typically in a two dimensional plane
XY plane a vector has two Dimensions right it has X Dimension and Y Dimension this part is fairly trivial uh
you may feel like skipping it but please stay with me I I really want to uh take you to the point where we are talking
about Transformations through this so uh here instead of denoting this Vector like
this like a row we won't be using this notation we'll be using rather this I think this
notation 3 comma 4 for example this is more used for a for a point so if there was a point here at 3A 4 that can be
denoted by by this but a vector that is pointing from origin to the point 3A 4 is denoted by this this column Vector
three and four so uh this is the very basic stuff now one of the Corner Stone of linear
algebra is linear transformation of these vectors so that is ultimately where the name linear itself comes
because most of the operations that we do is is changing this Vector in a linear
fashion don't worry if you are not able to visualize what this linear thing is where is this line linear uh concept how
can I visualize don't worry about that but but just understand this for a moment we have a full in-depth session
coming on uh the linear transformation itself why is it linear why is it nonlinear Etc but essentially when we do
a vector addition this is what we do right so we have a vector named X another Vector named y so let's say that
the vector X is three comma 3 and four so x coordinate of X direction of the vector is three y direction pointing is
four and then uh there is another Vector called y I should have used a better notation probably A and B should have
been better instead of X and Y but whatever does not matter so y has X direction as two and Y direction as
minus one now what are we essentially doing when we are adding these two vectors so if we if we are adding x +
y we are what we are doing is firstly a vector X is jumping three steps to the X Direction three steps right right 1 2
three jumping three steps here and then jumping four steps up so that is Vector X similarly Vector Y is jumping two
steps right and then jumping one step in the down Direction so X+ Y is nothing but these
jumps accumulated right so we can write X+ y in the following way so take three steps right that will be this
guy then take four steps up that will be this then take two steps right that will be this and then take minus one steps up
which is also one step down that will be this so this is how we we Traverse the four directions that this Vector is
showing us the both of these vectors are showing us so this is also same as so these four
steps we can add up the steps towards the right and just say that uh we are totally traveling five steps to the
right and then we can also say we can add up this guy up and down to say that we are traveling 4 plus minus one three
steps to up Direction so five steps right and three steps up so this is the basic logic behind why why can we simply
add inate the x coordinates together and Y coordinates together so x if x is 3A 3 and 4 and Y is 2 2 and
minus 1 x + y is simply 3 + 2 and uh 4 + - 1 so this is 5 comma sorry not 5 comma
53 uh and that is same as adding the right and up Direction movement sequentially now that that's what is
shown here now let's think about Vector multiplication so vector addition is
simply the finally in which direction have we moved as a result of adding these two vectors and the resultant
vectors also actually situated as at origin because the original two vectors were at origin now where is the
resultant Vector it's at five and three right five and three over here and then I can copy paste this
Vector so this is the resultant Vector of these two vectors right uh maybe I can use a
different color so now this is X+ y now Vector
multiplication is here what we are talking about is scalar multiplication of vector so it's like a scaling
operation so if we have a vector uh called Y 2 2 and minus one this y can be scaled
and when we scale the vector does not change its direction it only changes its magnitude so uh I'll show
you the vector multiplication by scaling So currently this this Vector is uh the vector y scale two times so because uh
the x coordinate has become four y coordinate has become min-2 direction is unchanged but magnitude the length has
doubled so this is a scale of uh this Vector scale by a scaler two if we scale by minus one the vector would point in
this in the opposite direction but the same magnitude so ultimately what the scaling
does is it either squishes the vector or it elongates the vector along the line that passes through the origin in this
particular case that passes through the origin but oriented along the direction of the original Vector so this is the
line along which scaling happens it can happen in the negative Direction it can happen in the same Direction it can
squish the vector or it can elongate the vector now squishing how will squishing happen squishing will happen if we are
multiplying by 01 or minus5 if it is minus5 we are squishing and flipping the direction if it is 0.5 we are not
flipping we are just squishing so this is the scalar multiplication of vector this is also a
transformation and of course this is a linear transformation the vector uh Vector is just getting
scaled so now think about XY coordinates in along X direction we have um a unit Vector which we usually denote as I and
uh x coordinate is nothing but the unit Vector I scaled by a factor so when we say x coordinate 3 what are we trying to
say we are trying to say that uh we have we have a vector that is pointing from origin to the till this location three
which is also same as 3 I if we have a if you have a vector that is oriented along this x-axis uh two
that can also be written as 2 I so 2 I is this guy what about this Vector this will be
minus1 J right so we know that this Vector plus this Vector added gives you the
resultant Vector y so here y can be written as of course 2 and minus one but this is actually the sum of two
other vectors this Vector Y which is a random Vector that we selected can be represented as the sum of two scaled
vectors which are the two scaled vectors two scaled vectors I and J so we'll be adding this using the sum of i+
J right but uh we are not simply adding I and J we are scaling and adding the so I is scal by 2 J is scal by minus
one so it's 2 I minus J so that is this Vector y so this scaling plus addition is a is a most fundamental operation
that we'll be performing throughout linear algebra so please play pay close close attention whenever we talk about a
vector so whenever we talk about any random Vector in XY plane you can think of it as um something that results from
the scaling and addition of the unit vectors I and J because unit Vector I and J using unit Vector I and J we can
pretty much access any point in the XY space so uh all we need to do is like we we scale unit Vector I we scale the unit
Vector J and we add them sometimes let's say if the if the vector that we are looking at is this
guy uh this we know that this is nothing but 04 right this this vector and
04 is also the result of scaling plus addition of I and J so I + J but I is this time scaled by zero so I is
completely squished to nothing and J is scaled by a factor of four so any Vector any Vector irrespective of its position
in the XY plane can be written or represented as the uh scaling plus summation of the vectors unit vectors I
and J so this is very important just just just keep note of this now you might have heard of this
term called basis if you have not heard no problem at all so I and J are called basis vectors of the XY coordinate
system the reason why it's called as basis vectors is because if you have I and J with you with that with just using
I and J and with just scaling the I and J and adding them you can access pretty much any vector or any point in the XY
coordinate system so if you if you were to randomly so if I randomly pick a point here if I'm talking about this
Vector this is also this this looks like let's say four and five right this is roughly what it looks like this is also
expressed in terms of I and J these two vectors so I can add them after scaling so I is scaled by four times J is scaled
by five times so any random Vector if it if the vector is right here at the origin itself the scaling factor is zero
then it will be 0 I plus 0 J null Vector if the vector is along the x axis like this then it will be uh I scale by 3
times J scale by 0 if the vector is over here itself then it will be I scale by 0er times and J scale by two times so
any Vector any Vector is a uh scaling plus addition of the basis vectors which are I and
J now I have a very interesting question maybe you have thought of this maybe you are thinking about this for the first
time can we get the same Vector y So So currently we are getting this Vector y by scaling and adding the the basis
vectors I and J can we create the same Vector y which is 2 and minus one right a vector that
is pointing in this direction can we create the same vector by scaling and adding two other vectors two other
vectors meaning we won't be using I and J can we use some other vectors can we scale them and add them to get this 2
and minus one that's the question this is actually quite possible uh let me just show you an example right
so initially our I and J are these blue vectors so I is unit Vector in X Direction positive X Direction uh J is
the positive Vector unit Vector in the y direction and Y is nothing but 2 I um 2 I + - 1 J because this is the direction
of Y but now let's say I Define two other unit vectors which is i1 and J1 so i1 is pointing in this direction the
this pink guy and J1 is pointing in this direction we can represent this Y in terms of i1 and J1 so if we were to
write uh Y in terms of i1 and J1 we can write now see that um Y is nothing but
i1 uh plus minus 2 * J1 because this has to be scaled negative -2 times because J1 is by default pointing in this
direction it has to flip so J1 has to flip not only that it has to elongate two times so it should be i1 + 2 * J1
this will be y vector and then if we were to write this in the format of this column uh Vector it will look like 1
2 so see uh previously we were writing the vector y as 2 - 1 but this is assuming the bases are I and J but here
the bases are i1 comma J1 so depending on the basis we can uh I
mean normally we assume that the basis basis is normal unit vectors I and J but the depending on the basis we can
represent the same Vector using two other numbers so here we defined uh i1 and J1 and now i1 and J1 can add scale
and add together to form basically any random Vector so we just found we just randomly used i1 and J1 and found that
it can represent the vector y so in the previous case if I and J were the bases we were representing the
vector y using um 2 comma minus one right so this was I and J as the bases but if i1 and J1 are
the bases then the same Vector Y is represented as 1 minus 2 so this is i1 J1 being the
basis so this is fascinating so uh now you can probably start to think of the idea that okay now now you might be
getting a better better idea any any two random vectors you could have selected on the XY plane and as long as they are
not parallel to each other you can scale them and add them to access any point in the XY plane if you don't understand or
visual if you can't visualize what that means I will show you in a moment so there is a term called span
which is good for you to know span is nothing but where all can we reach if we had two
vectors let's say in XY plane if I had two vectors with just these two vectors where can where all can I reach in this
XY plane if I had I and J you we can reach pretty much anywhere in the XY plane if I had i1 and J1 which I showed
you before I can reach anywhere in the X XY plane because using i1 and J1 I can scale them and add them which is a
linear combination we can get any other Vector in the XY 2D space this is also true for most pairs
of vectors that we select randomly on 2D plane if we select any random two vectors it
need not even be unit vectors it can be so here for example um let me go up let us say my i1 was something like
this right i1 was this sorry J1 was this and i1 was this now how can we construct the Y
Vector using this i1 uh this i1 and J1 the Y Vector is nothing but uh we have to um scale this
by so this is currently at minus 3 uh this tip is at minus three minus three in the from the uh
previous basis right minus 3 based on I and J this is at Min -4 so this Vector has to scale by 1/3
sorry uh 2/3 because uh to get the same X length as uh so this this red Vector has a length along X direction of two
and length along y direction of uh minus1 so this Vector has to scale by a factor of
2x3 in the negative Direction so this has to flip and this has to scale by 2x3 so minus 2x3 sorry - 2x3
J1 plus what should happen to i1 i1 should simply reduce in size i1 should simply become 1/4 of what it is
right now so i1 by 4 or 1X 4 * i1 so now the vector Y is represented in terms of i1 and J1 as
1x4 and - 2x3 this is the new i1 uh new uh you know representation of Y Vector using
the new J1 and new I so this can be done irrespective of what i1 and J1 we
pick so the span of all of these vectors are the entire 2D plane we can scale them add them so this is called as the
linear combination scaling and adding scaling meaning multiplying by a scalar adding to combine them to to Vector uh
for performing the vector addition so this is linear combination so that we can get any Vector in the 2D plane so
the entire 2D plane is the span of these vector these two vectors but a special case is if these two vectors were
parallel to each other their linear combination will also be parallel to those two vectors so for example let's
say I had XY plane if uh my i1 was like this and if my I2 was like this sorry J1
was like this so let's say this was i1 and this was J1 then however we multi and add this the resultant Vector will
always be along this this line it can never access this region of the XY plane it can never access this region of the X
XY plane it can only access this line which lies on the XY plane which is parallel to the to both of these vectors
so in the special case where let's say and or let's say if my i1 was this and J1 was this then I can only access this
line in the XY plane I cannot access any other points so in that case the span is just along that that 1D line so span
will not the span won't be the entire XY 2D space so this is the idea behind span and if two vectors can access the entire
space like i1 J1 or i j then they are called basis vectors
so now the span the formal definition of span is set of all possible vectors that can be obtained by the linear
combination of a given pair of vectors so that is called as the span so um if you use I i1 and J1 if you use I and J
if you use any two random vectors that are not parallel to each other parallel or antiparallel it should neither be
parallel nor be anti parallel as long as that's the case which is the case with most of the 2D Vector most of the
vectors in the 2D plane you can you can access or you can create any Vector that belongs to the 2D plane so the entire 2D
space itself is the span of most of the 2D vectors most of the pair of 2D vectors However if those two that that
pair of 2D vectors when they line up the span is simply the the line which is going along that those two vectors so
it's a 1D line so the span is having one dimension normally most of the 2D vectors the span is the entire 2D 2D
space um you will not be able to connect yet how is this how is this span uh directly related to machine learning
where is the span even coming in the machine learning you will learn that in cases where we often uh do trans linear
transformations to reduce the dimensionality of certain vectors or sometimes we'll try we'll increase the
dimensionality so you will see that uh when we reached the linear transformation part but we already did a
linear transformation but this was probably the most simple linear transformation that we can come
across now I have a question based on the 3D space imagine you have two vectors in the 3D space not constricted
to XY plane what is the span of those two vectors imagine that they are not parallel nonp parallel two vectors in 3D
space do you think it will be the entire 3D space can you construct the entire 3D space just using two vectors no just
using two vectors you can only construct a 2d plane so two non-parallel vectors um they simply construct they
simply span a 2d plane just like how you saw on the XY plane the I and J vectors which were non-p
parallel they could span the entire 2D space it was a plane the i1 and J1 which was also nonp parallel they could also
span the entire 2D space XY plane similarly two random vectors in 3D space will also span a 2d plane the plane
won't be XY because the vectors may be oriented along some Z axis also so the plane itself won't be the the pure XY
plane it can be any random plane any random slice in the 3D space the two vectors using the two vectors we can
never construct a full 3d space uh the vectors I and J themselves are the example using I and J we can
never construct 3D space we can only construct a 2d plane similarly if these vectors had a z component and if we were
only having two vectors just 3D space sorry just 2D space we can get uh we can get 2D flat sheet but what if we had a
third we add a third Vector if we add add a third Vector in the 3D
space can that Vector span help can that Vector along with the previous two vectors span the entire 3D space yes
what is the perfect example for that the perfect example for that is uh this one i1 J1 sorry i j k k is the third
dimension now similar to how we defined i1 and J1 we can also Define uh i1 J1 and K1
which if these three are non-p parallel it can span the entire 3D space for spanning the entire 3D space
it's not enough that the vectors are non-p parallel you actually need vectors that are not within the span of each
other so I'll just show you what I mean by that so consider the 3D space XY Z axis and you take any random plane
within the XYZ plane XYZ space uh take two vectors first so let's say this is Vector
a and this is Vector B and imagine that the way I have drawn it is that those two vectors are lying on the
plane now we know that these two vectors since they are non not parallel to each other they can access any point within
the 2D plane in which it's part of just like how the unit vectors I and J can span the entire XY plane similar to that
these two vectors they are not unit vectors but they are not not parallel and they are lying on a particular 2D
plane this is not XY plane but it is some 2D plane and these two vectors can span that entire plane so now imagine
that you have a third Vector maybe this this guy uh the way I have drawn it uh it's not I'm not drawing it
perpendicular to the plane I'm drawing it literally parallel to the plane within the plane
um so these three vectors are not parallel to each other so just before showing you this diagram I mentioned
that if the three vectors are not parallel to each other it can span the entire 3D space that is technically not
fully correct because see this Vector these three are not parallel to each other but the third Vector is actually
within the span of the first two vectors meaning using the first two vectors we can make the third Vector actually let
me draw the third Vector such that it has the same Tail as the first two vectors so like this so here the third
Vector is redundant because third Vector we can already Express in terms of the first two vectors so if a b c are the
vectors um C is kind of dependent on a a and b already or we can also say that if C and A are already available B is
redundant or we can say that if C and B are available a is redundant so having having another Vector which is lying in
the same 2D plane even though it is not parallel to the previous two vectors it's not useful in terms of spanning the
3D space to actually span the 3D space you need some other Vector which is not already within the span of a and b so C
has to kind of project outside the plane so um if I if I draw it so that you you can appreciate it so maybe something
like this let's say here imagine that the way I have drawn C is that c is extending outside
the plane now A B and C they are not parallel to each other C is not within the span of a and b because you cannot
express C in terms of a and b c is not in this plane C is uh extending outside of the plane now using a b and c you can
span the entire 3D space so this is uh now A B and C you can see that it it can form the basis of the entire XYZ 3D
space similar to how any non-parallel vectors in XY plane can span the entire XY plane here these three non-parallel
ABC vectors where C is not within the span of a and b or uh you can also say that b is not in the span of a and C or
a is not in the span of B and C uh it's it's equally applicable then they can these three can span the entire 3D space
so uh this is a very important thing thing that you have to understand intuitively
so that is what what I have written here but I wanted to show a picture so if the third Vector is on the span of the
previous two then the span of the three vectors remain on the 2D plane itself when I say 2D plane do I mean XY plane
no I just I simply mean the 2D plane in which the first two vectors were spanning uh but how often do you think
if you randomly select three vectors they will all lie in the same 2D plane very unlikely so if you randomly choose
some random three vectors in the 3D space very very highly likely that they will
they can all three of them can combine span the entire 3D space unless in the low probability event these three random
vectors happen to be in the same plane if that is the case then you can only access the 2D plane which it is part of
now in the even more rarest of the possibility if they are all uh in the same line if they are in pointing in the
same direction in the same plane then it's is its span is just one line so then its span will be 1D so most likely
the any three random vectors in 3D space can span the entire 3D space with a very very low possibility if the vectors are
uh in the same plane the span will be 2D now even with an even lower possibility if the vectors that you randomly pick
happen to be aligning with each other then its span will be just a 1 D line so this is how you can think of the span
you may have heard of this term in several mathematical um context uh people asking
you to calculate the span or identify the basis um so you you don't have to be
worried about the math component of it too much the only reason why we are talking about span here in the machine
learning context is you will often see um vectors transformed from a from a lower Dimension to a higher Dimension
and sometimes transform back from a higher Dimension to lower Dimension so there you can ident if you can just
realize that the kind of operations that is happening there is something where you are you're accessing the third
dimension span um or or you are accessing you're you're reducing the dimensionality so that you don't have
three three dimensions anymore you just have two Dimensions so these operations which we can perform on these
mathematical vectors you can also perform in the vectors which I showed you in the beginning of this lecture
which are like the lists uh in the context of machine learning so in large language models it is very often done uh
even in convolutional neural networks you can see such operations happening so this is the idea behind span and this is
why you should have a basic intuition about this to help you in machine learning so you may have heard of this
term called linearly independent vectors or linearly dependent vectors so linearly dependent simply means a vector
that is that can be expressed as a linear combination of other vectors so we saw that using the unit vectors I and
J you can express any Vector as a sum of linear as the sum of scaled I and J vectors right so you scale I you scale J
and you sum them so this is scaling first and then linearly combining them so now in XY plane any
Vector uh is linearly dependent on I and J in XY plane any Vector as you saw before was dependent linearly on i1 and
J1 i1 and J1 were non-p parallel vectors in XY plane so the linear dependency simply means uh if a third Vector can be
expressed in already in the form of the first two vectors then the third Vector is linearly dependent on the first two
vectors uh that was true in the 3D space example as well so here in the example that we considered the vector C the
original version of the vector C was actually laying lying within the plane so this here C is within the plane so C
can be easily expressed in terms of u b and a so here maybe we can say that c is um let's say um B plus so the Y
component of C is same as I mean the component along this direction of C is same as the component you know uh you
can take a projection of B in this direction and then uh there will be so B has a let me just show you once again B
has this component and this component so the Y component of b so I'm calling this as y randomly but that component of b is
same as the length of c and but B also got a component in this direction which can be cancelled by by scaling the a in
the negative Direction so scale down the a maybe to half its size and multiply by minus one so um you can always represent
if a third Vector is within the span of the previous two then it is linearly dependent on the previous two so that is
what we call as linear dependency but um if if considering a new Vector adds a new dimension one more additional
Dimension to the span then they are linearly independent so let's start with a 2d space so that uh the example is
very clear to you so in this 2D space if I'm only considering a vector a single Vector like let's say this guy
what is the span of this Vector the span of this Vector is it 2D or 1D the span of this Vector is 1D because this Vector
however you scale it can only access a single line but now suddenly let me introduce one more Vector like this now
what is the span of these two vectors combined now the span of these two vectors combined is uh 2D space the
entire XY space but instead of this Vector if I had added another second Vector that look like this these two
vectors are not spanning the entire 2D space these two vectors can still access only the the x-axis the line along the
x-axis and that is because these two vectors are kind of uh they are not parallel they are anti- parallel but
they are along the same line so what this means is the second Vector is linearly dependent on the first Vector
so you can basically scale down the first Vector a little bit and flip it in the direction to make the second Vector
however ever if the second Vector was something like this then you cannot express the second Vector just in terms
of the first vector or even if it was something like this how do you express this Vector just in terms of this Vector
you cannot you need one more Vector to do that so now the the action of addition of this second vector vector 2
uh along with Vector one added one more Dimension to the combined span of those two vectors and uh this is why we can
say that Vector 1 and Vector 2 are linearly independent so so what is the analog for this if we consider the 3D
space so now let's let me show the 3D space first let I'll delete the all these vectors start with a clean
slate so okay so let me start with just one vector so imagine that this is my first
Vector lying on that plane what is the span of this one vector the span of this Vector is 1D like a 1D line because it
can only access points along a line which is which is oriented along the direction of this Vector so the span is
1D now if I add an additional Vector let's say the additional Vector looks like this what is the span of these two
vectors combined the span is still one why because the first vector and second Vector are along the same line so they
are not linearly indep dependent of each other they are linearly dependent now let's say I add a third Vector something
like this which is within the plane it's not extending outside the plane it is it is within the plane the third Vector now
because of the addition of the third Vector the span of all these three vectors combined or span of one and
three or the span of two and three is that entire 2D plane so now the dimension the the span has increased by
one more Dimension which means one and three are linearly independent now let we add one more Vector a fourth Vector
something like this imagine that this fourth Vector is also within the within the 2D plane is this increasing the the
span that these four vectors can together access no it is still the 2D plane because all these four vectors are
still with lying within the 2D plane so the span is still the whatever that XY sorry whatever that 2D plane is now let
me add one more Vector a fifth Vector like this so This fifth Vector is extending out of the 2D plane so this
addition of this fif fifth Vector actually increased the span of these collection of vectors so previously it
was two now the span has become the entire 3D space so now the vectors 1 2 3 4 5 can access the entire 3D space but
you don't need all these five vectors to access the 3D space Vector two was redundant because it was parallel to
Vector 1 so I'm removing two Vector uh 4 was redundant because Vector 4 was within the 2D plane in which vector 1 2
3 was already present so I'm removing Vector 4 so now we are left with Vector 1 Vector 3 and Vector 5 now these three
vectors can access the entire 3D space so these three vectors are linearly independent of each other so I hope you
truly understand what this linear independency means it's a fairly simple concept but geometrically if you
understand it will make it much more easy to deal with the math part of it otherwise the math part of it will be
boring you will not really enjoy learning that so now let's come back back to the idea of basis this will be
the last concept that we are we'll be touching up on in this lecture basis is nothing but a set of linearly
independent vectors that can span the space so if it's a 2d space if it's a XY plane what is uh what are the bases uh I
the the unit Vector I and unit Vector J can form the bases of that space any two random vectors actually can form uh
basis of the XY uh space because because any two random vectors will most likely will not be oriented along the same line
the the in the rare possibility that the two vectors that you happen to randomly choose if they are along the same line
then for sure um they are not forming the bases but a vector one and two here so let me just draw here right so here
you have three vectors Vector one and two can form the bases of XY plane but Vector one and Vector 3 cannot form the
bases because three is inde three is linearly dependent on one similarly in 3D space uh let's go back to 3D space if
uh and let me first delete all these vectors so that you can see it clearly okay so in the 3D space if I have a
vector like this and another Vector like this is this forming the basis for the entire 3D space no because two vectors
cannot access the entire points in the 3D space it can only access all the points along that 2D plane so now let's
say I add one more Vector so this is Vector one vector 2 and Vector three and if the vector 3
is within the same plane that is Spann by one and two Vector 3 cannot be part of the bases I mean Vector one and 1 two
and three cannot be part of the spa the bases for the 3D space because Vector 1 2 3 are in the same plane they are not
spanning the 3D space but if Vector 3 happen to um extend out of the plane something like this now Vector 1 2 and 3
can be the bases of the 3D space these are these Vector 1 2 and 3 the unit vectors I JK no not at all these are
some random three vectors uh but vectors unit vectors i j k are also spanning the 3D space so they are also the bases
these three random vectors that I have drawn here which are not JK they are also spanning the entire 3D space so
they are also the bases so there are so many bases for uh you can anything can be any combination of these three
vectors can can be the basis for the 3D space so long as they are linearly independent of each other so that is the
idea of basis so I hope through this lecture you got a um geometric interpretation of what the basis means
and what span means it's fairly simple concept but often presented to students in a very complicated way but I hope you
appreciate the Simplicity of it and in the next lectures we can uh we can learn more intuitions about linear
Transformations so thank you so much
Vectors in machine learning represent data points or features with both magnitude and direction, often anchored at the origin. They are typically expressed as column matrices, such as [x; y] in 2D, which helps in modeling input data and transformations applied by ML algorithms.
Vector addition involves adding corresponding components of vectors, such as (3,4) + (2,-1) = (5,3), representing sequential movements along axes. Scalar multiplication scales a vector's magnitude by a number, possibly reversing direction if the scalar is negative. These operations are key for constructing new vectors and transforming data in machine learning.
The span of vectors is the set of all linear combinations they can produce, covering a portion or all of the space. In 2D, two non-parallel vectors span the entire plane; in 3D, two vectors only span a plane, requiring a third independent vector to span the full space. This concept helps understand dimensionality and feature spaces in ML.
Vectors are linearly independent if none can be created by combining others, indicating no redundancy. This independence is essential for forming a basis—a minimal set of vectors spanning the entire space—which ensures efficient data representation and transformation in machine learning models.
Basis vectors are a set of linearly independent vectors that span the whole space. In 2D, two basis vectors suffice; in 3D, three are needed. They provide the foundational directions for representing any vector and help interpret how ML algorithms perform linear transformations like dimensionality reduction or expansion.
Grasping span and basis helps you see how algorithms transform data vectors through linear combinations and changes in coordinate systems. This insight clarifies operations like feature extraction, data projection, and dimensionality reduction, which are fundamental for building and optimizing effective machine learning models.
Heads up!
This summary and transcript were automatically generated using AI with the Free YouTube Transcript Summary Tool by LunaNotes.
Generate a summary for freeRelated Summaries
Understanding Linear Transformations and Matrix Multiplication in Machine Learning
This lecture demystifies matrix multiplication by explaining it as a geometric linear transformation, pivotal for machine learning foundations. It covers key properties of linear transformations, visual examples, and how basis vector transformations define the action of matrices on vectors, culminating in practical matrix representations of rotations, shears, and squishing transformations.
Understanding Linear Classifiers in Image Classification
Explore the role of linear classifiers in image classification and their effectiveness.
Understanding Elementary Row Operations in Matrix Analysis
This lecture introduces the concept of elementary row operations in matrix analysis, explaining their significance in solving linear systems. It covers binary operations, groups, fields, and provides examples of how to apply these operations to transform matrices into identity matrices.
Introduction to Linear Predictors and Stochastic Gradient Descent
This lecture covers the fundamentals of linear predictors in machine learning, including feature extraction, weight vectors, and loss functions for classification and regression. It also explains optimization techniques like gradient descent and stochastic gradient descent, highlighting their practical implementation and differences.
Understanding Linear Motion: Position, Velocity, and Acceleration Explained
This video introduces the fundamentals of linear motion in kinematics, covering key concepts such as position, displacement, velocity, and acceleration. Learn how to calculate and graph these quantities using real-world examples like a car on a straight road.
Most Viewed Summaries
Kolonyalismo at Imperyalismo: Ang Kasaysayan ng Pagsakop sa Pilipinas
Tuklasin ang kasaysayan ng kolonyalismo at imperyalismo sa Pilipinas sa pamamagitan ni Ferdinand Magellan.
A Comprehensive Guide to Using Stable Diffusion Forge UI
Explore the Stable Diffusion Forge UI, customizable settings, models, and more to enhance your image generation experience.
Pamamaraan at Patakarang Kolonyal ng mga Espanyol sa Pilipinas
Tuklasin ang mga pamamaraan at patakaran ng mga Espanyol sa Pilipinas, at ang epekto nito sa mga Pilipino.
Mastering Inpainting with Stable Diffusion: Fix Mistakes and Enhance Your Images
Learn to fix mistakes and enhance images with Stable Diffusion's inpainting features effectively.
Pamaraan at Patakarang Kolonyal ng mga Espanyol sa Pilipinas
Tuklasin ang mga pamamaraan at patakarang kolonyal ng mga Espanyol sa Pilipinas at ang mga epekto nito sa mga Pilipino.

