Linear Algebra for Machine Learning

freeCodeCamp.org · Beginner ·🔢 Mathematical Foundations ·1y ago

Key Takeaways

This video course covers the mathematical foundations of linear algebra necessary for machine learning, including vector spaces, norms, and distance measures, with a focus on practical applications in AI and data science.

Full Transcript

this in-depth course provides a comprehensive exploration of all critical linear algebra Concepts necessary for machine learning you'll learn the mathematical foundations to excel in AI tdiv from lunar Tech developed this course she has created many popular machine learning courses machine learning is at the Forefront of the Innovation powering the most advanced and transformative systems for the companies like apple Tesla Netflix Amazon open Ai and many others it enables the creation of the intelligent systems that can predict Trends personalized user experience and automate complex tasks to develop these practical applications a deep understanding of the underlying mechanics is important this requires a solid grasp of mathematics behind the machine learning so all these technical details with a particular focus on linear algebra this all-encompassing course explores the linear algebra in an interactive and machine learning Focus manner welcome to the linear algebra for machine learning course you will acquire the critical principles needed to build optimize and analyze sophisticated machine learning models from designing customer algorithms to enhancing curent Technologies this course provides the mathematical foundations with vital interest for the those for pioneering advancements in machine learning for those dedicated to mastering the mathematical aspect and the technical details behind machine learning our extensive 26 plus hour course of fundamentals of machine learning within the mathematics boot camp as well as a separate course offers an in-depth exploration this extensive program includes certification and is tailored for individuals that are serious about advancing their career in the field of machine learning Andi engineering this crash course in mathematics will serve you as a great starting point by establishing a robust foundation in linear algebra you will be well prepared to excel as machine learning practitioner equipped with the mathematical knowledge that drives the Innovation and efficiency in this field so if you're ready I'm really excited and without further Ado let's get started welcome to the course on the fundamentals of linear algebra presented by Lun Tech Academy my name is D Vasan and today we are going to start with some basic concepts that are important for understanding linear algebra linear algebra is one of the most applicable areas of mathematics it is used by pure mathematicians that you will see in a universities doing research publishing research papers but also by the mathematically trained scientists of all disciplines this is really one of those areas in mathematics that you will see time and time again appearing in your professional life if you want to become a job ready data scientist or you want to do some handson machine learning deep learning and AI stuff but also linear algebra is used in cryptology it is used in cyber security and in many other areas of computer science and artificial intelligence so if you want to become this well-rounded professional you want to go beyond using libraries and you want to truly understand the uh mathematics and the technical side of these different machine learning algorithms from very basic ones like linear regression to most complex ones coming from Deep learning like architectures in neural network how the optimization algorithms work how the gradient descent works and all these other different methods and models then you are in the right place because you must know linear algebra such that you will understand these different concepts from very basic ones to most advanced ones in data science machine learning deep learning artificial intelligence data analytics but also in many other applied science disciplines so before starting this comprehensive course that will give you everything that you need to know about linear algebra first I'm going to tell you what we assume that you already know because linear algebra it comes from about third PA of Bachelors of different highly technical studies and here we are assuming that you already know certain Concepts so to ensure that this course stays really on the topic of linear algebra and that you understand all these Concepts really well for that we need to be able to know different topics so before we dive into this Concepts let's familiarize ourselves with the basic prerequisites and notation used throughout this course and you will really need to know this in order to understand these Concepts really well such that instead of memorizing you'll actually just hear me once or maybe twice and then every time you hear later on or you see it in the papers or in some algorithms you will recognize this is something that we already learned so some key prerequisites overview is here first of all to fully grasp the upcoming material you should be familiar with some basic concept like real numbers Vector spaces so you don't need to know this idea of vectors though you already most likely are familiar with this given that you know how to plot different lines you know the idea of exes and wise and how to plot these different graphs but here we are going to touch base on this every time when we come close to these Concepts I will refresh you your memory and we will go through this numbers the idea of norms and distance measures because when it comes to the vectors when it comes to the magnitude and all these different topics that we are going to discuss as part of linear algebra knowing the what Norm is and what is the definition of distance what is the length between two points when we plot it into two-dimensional space or three-dimensional space those are all very basic concept that usually use as part of a basic pre-algebra or just common algebra courses and lessons in order to truly understand what the new algebra is about to understand the direction of vectors the angle and then the dimensionality reduction how linear algebra is applied for instance in different algorithms in machine learning deep learning data science statistics you really need to understand this Cartesian coordinate system so this is not only important for linear algebra but I assume you already know it given that you have passed those other courses like calcul or usually they are covered as part of pre-algebra or algebra so the cartisian coordinate system I mean here understanding what is for instance the the common description of them for instance when you when we write like X and then y on the vertical axis and then we can we have here zero and then we can always plot this different plots you know we have a clear understanding what is this Y is equal to X line we understand how by knowing certain points we can plot different plots for instance that this is the Y is equal to X line that here it means that if we have here one then this is just one two this is two so we understand when we have the function of the line and we have a certain value at is our y coordinate or x coordinate then the corresponding coordinate can be found then you also need to know some basic things that I just didn't mention right now so for instance that the numbers here can be like 1 2 three up to Infinity so you understand this concepts of infinity and then here the same story then here we have minus one you know minus two uh and then this is then used later on and we will be pouch basing this one we will be describing our vectors and how we can visualize our vectors either two dimensional space like we have here because this is two dimensional so we have X and Y but we can also of course visualize it in three-dimensional Etc so this idea of basic coordinate system is really important usually covered as part of algebra if not pre-algebra then we have basic triog genetry which means that you need to have a clear understanding what sinus is what cosine is what tangent is and their reciprocals and here I mean that you know for instance what is cosine function what is s function you know that you have an understanding for instance that what is this line you know whether it's a sinus line or cosine line you have also an understanding what this Pi is one thing that I didn't mention but it it just goes around all these topics some basic things that you understand what is X what is y why we use them and this idea of variables and also you need to understand this idea of square or you know 90 degree angle and then Pythagoras Theorem here we have the same so what is this relationship between different sides of a triangle that is a very unique triangle and that has one of the angles as 90° and this idea of you know the sides how this relates to the sinus cosinus tangent cotangent and also how the Pythagorean Pythagorean theorem applies when we have triangular but it is is no longer with angle that is 90° what is the sum of all the angles of triangle so those are basic stuff that are com commonly covered as part of trigonometric lessons or part of General geometry then another prerequisite is this understanding of identities and equations in triog genometric lessons something part of which I already covered and this is goes around of basic having a basic un uh understanding of algebra and geometry those are super important to understand more Advanced Techniques from linear algebra then we have finally this idea of orthogonality perpendicularity in vectors so this also comes from geometry and from a trigonometric lessons so you understand that if we have for instance the two lines that don't have any intersections then we are talking about two orthogonal lines and otherwise for instance if we have and the two lines like this then we are talking about perpendicular vectors when you have two lines that are actually parallel so they don't have any intersection and you won't find any point that is common for the two so when it comes to this R so as part of real numbers and Vector spaces R represents the set of all real numbers so you can be dealing with for instance an integers like 1 2 three this can Al this will also cover all the negative numbers like -1 - 2 - 3 but also the floting numbers like 1. 223 and all the other numbers that you can think of those are the set of all real numbers so this is in one dimensional space right so you can see that I'm writing just one number you know two three and other numeric numbers then we have the idea of R2 R3 up to RN where now all these numbers they represent represent in this case the N it represents the N dimensional aidian space so when it comes to this idea of n dimensional numbers so for instance R2 here we just mean 2D plane so I'm pretty sure you are familiar with this idea of for instance xais and Y AIS here we are dealing with two dimensional plane so for every point that we can find here we can describe them by assigning them a value X so coordinate X and a coordinate y that's exactly what we mean by saying that the number can be represented in a 2d plane so here we are dealing with this two dimensional space this is our two dimensional Elan space and every number in here that is part of this R2 can be pictured here can be represented in this visualization so for instance if I have this number and let's assume that the value on the x-axis is two and we can see here that the corresponding Y is zero I can describe this number which I will call a I can describe this by writing down first the x coordinate which is two and then the y-coordinate which is zero so I'm then saying that a which is a point with x coordinate 2 and y coordinate Z it is part of my R2 and it's part of my two dimensional alian space when it comes to R3 similar thing we can do with that only in that case we need not just x axis and y AIS but we need to add our third dimension so here for instance when it comes to the r Tre then we need to do y AIS we need to have xaxis but also we need to have some Z axis so such that every time every point in the space we can then describe by x y and Zed coordinates so if we write it in terms of the vector something that we will see very soon as part of our first unit of this course we will then need to represent every number in this three-dimensional Alan Space by writing down first the x coordinate let's say one and then y coordinate let's say another one and then Z coordinate which is one or even better even easier let's use 0 0 0 which means that we are dealing with this initial number which is the center of this three-dimensional Alan space when it comes to the N dimensional or the higher dimensional spaces it's much harder to visualize therefore usually when it comes to visualizations we do usually we usually only visualize the onedimensional two dimensional and thre dimensional spaces above then it just no longer does make sense to visualize it but we definitely deal with them and they are part of Applied linear algebra so understanding this spaces is very important for analyzing vectors for their interactions and this holds not just for this two-dimensional and three-dimensional but really for multidimensional spaces let's now quickly Define this idea of Norm so the norm of a vector denoted by this V which you can see kind of like similar to the absolute value from pre-algebra you can see here that we have this double straight lines like from absolute value then we have the name of the vector or the variable name that we are assigning to our vector and then you might notice here on the top of this this Arrow this basically says that we are deing not with just a variable but really we are dealing with a vector this is really important because you can see that there makes a huge difference if we have for instance just V or V1 I have to say or just V those are really important and things that you need to keep in mind when it comes to Leading your algebra and trying to differentiate vectors from a point you will notice that when it comes to Norm we can represented it either by this notation or this usually it's a common notation in machine learning or in data science with this two bars and when we do this we automatically also know that we are dealing with aladine distance we call it also L2 norm and this is something very common and usually used as part of retrogression which is an application of linear algebra and it's used in regularization so we are regularizing our machine learning algorithms so when you get into machine learning you will see time and time again this notation so next time when you see this then you know automatically that you are dealing with L2 norm and L2 Norm which is also used a lot in machine learning it is referring to the usage of L2 Norm to uh in the retrogression and retrogression or L2 regularization is a very popular regularization techniques as part of machine learning so right now even you can see this intersection or linear algebra or this idea of norms in machine learning all right so now let's see why we call it actually L2 Norm or often referred as Eline distance so Eline distance you can see here which is also the in this case this V which describes the norm of the vector v is equ Al to square roof and then we have all these coordinates assuming that the vector comes from an N dimensional space so you can see here the RN the V Vector the idian distance or the norm of this vector v is equal to square roof and then V1 2 plus vs2 S Plus and all this in between numbers plus VN squ so here basically it means take square root of V1 2 V2 S Plus plus V3 2 blah blah blah plus VN s so basically take all the units that form this vector and then so are on this vector and use them Square them and then add them and then take the square root of that that's the distance or I have to say the norm of this Vector so why this is important this idea of norms and equity in distance beside of being used in machine learning and why is it used so Norms they provide a way to measure the size or the length of a vector in Vector spaces which means that when we want to measure a distance a similarity relationship between for instance vectors then it becomes much easier to use this idea an Elan distance is not only used in regularization techniques like L2 regularization or retrogression but it's also used in other machine learning or deep learning Al items as a way to measure the distance or the relationship or the similarity between two different entities those can be variables those can be two people that we want to compare in our algorithm or two entities um for instance the Norms or the Al and distance they are also used as part of K me algorithm something that you might have heard and if you follow later on the machine learning and the clustering section of machine learning you will see that Alan distance is used as part of C's algorithm that aims to Cluster observations into different groups so this also yet another highly applicable uh topic that you must know in order to understand different linear algebra top topics but also machine learning topics let's now talk about simple topic that we must know about and refresh our memory very quickly before moving forward to our next topic that is a prerequisite for this course so the cartisian coordinate system is just a fancy word of describing this idea of X and Y or XY Z when we just want to visualize them and showcase this numbers related to the space so we just learned the and I just quickly was talking about this idea of X and and Y and how we can visualize that in plain so the cial coordinate system is a framework for specifying points in a plane or a space using ordered list of numbers so we know for instance when we plot this then here we need to put X and Y in our two dimensional space R2 and we know that here in the middle we have zero and here we have 1 2 three four and the same here one two and then three four which means that everyone that is in the industry whether it's in mathematics in physics in data science or ml or AI we all universally agree on this system we know this is this ordered list of numbers and we know that if we have for instance a point here then for this point we know that the xaxis and Y AIS is definitely positive even if we know don't know the corresponding numbers and then once we have more General lines here so not General but specific lines then we even know the exact coordinates and values here and we definitely know that this number should be so the x coordinate should be between two and three so first we have the two and then tree and not the other way around so this ordered nature helps us to understand how we can put all these different numbers and organize them in our two dimensional space and we also know the corresponding y so we know that for instance our Y is not minus three because it's lying in here in this part of our coordinate system and not somewhere here where the y axis are negative and why do we know that because it's an ordered list of numbers that we can visualize in this 2D plane and here you also need to keep in mind and we need to remind ourselves about this idea of these four different parts that we got so we have our here the first part the second part the third part and then the four you know part of our coordinate system and here we we are dealing with a two dimensional plane but if we were to deal with the three-dimensional plane we no longer have just x-axis and y axis where X AIS were on the horizontal and y- axis on the vertical but we have our third line which is the Z so we have now three different dimensions so X Y and Z and we are basically extending our two-dimensional plane to three-dimensional so this system is fundamental for visualizing and working with vectors geometrically so then we can just use this two dimension uh plane in order to visualize this Vector for instance knowing what are all these points that appear on this Vector what is its direction where is it headed you know what is the beginning and then we can also find out all the so the relationship of these vectors with all the other vectors for instance if we have an other Vector here then we can use the coordinates of them and information about vectors to understand that we are dealing with two parallel vectors that don't have anything in common so no intersection points where to say if we have another Vector like this and we know that here we are dealing with perpendicular you know orthogonal vectors so this is why those this coordinates Cartesian coordinate system is important and it's not just important for linear algebra but just in general for mathematics and for data science and for AI and you will see this coordinate system time and time again in different visualizations even when you want to visualize the mean of your data or you want to visualize the probability distribution function describing your population from statistics or from data science you want to visualize for instance how your optimization is working or you want to visualize how your model is performing in terms of its evaluation Matrix for all these cases and for any visualizations this idea of the Cartesian coordinate system is going to become very handy let's now talk about this idea of angles and the idea of circles radian the pi as well as this degree sign so this comes usually from geometry or tonometry and this is very important when it comes to the vectors because when we have two different vectors then we want to understand their relationship do they form this less than 90° or so are we dealing with sharp corner sharp angle or with we are dealing with 90° angle so we are dealing with this type of vectors where we have you know 90° or we are dealing with um this type of vectors when the angle is 180° which is by the way uh something that we are referring as Pi and here is one thing that is important here is that it's not just Pi but it's Pi radians why because in mathematics we also have this idea of Pi which is usually a number that is 3.14 so we should not confuse this Pi with pi radians so the relationship between the two is something that we have also seen as part of our pre-algebra and algebra courses so if it's something that you want to just refresh your memory on this will be super helpful to check our very initial course on um all these Basics so pre-algebra so this number comes from per algebra and then this idea of P radians and just in general all this information about what is 180° what is this angle what is 360° and all the information that comes from triogen metry and geometry can be found in our corresponding course so the next topic is the unit circle unit circle is highly related to this idea of radians degrees cosine sign but also understanding the Cartesian coordinate system will help you to understand the unit circle so this also comes from theog gometry and geometry and it's basically a fancy way of saying we have x-axis we have y AIS we have here zero so our common Cartesian coordinate system only we are trying to focus on this part of the system where we have here one we have here one so on the x-axis we have one and then here minus one here minus one for y AIS and here y the Y is equal to 1 so we have here all these points and then we have the circle with the radius of one so here is this you know this is the radius and here we plot this circle and this will help us to understand this concepts of sinus cosinus you know the Theta is just variable that we use to describe the angle and for instance here we are dealing with 45° this angle is 90° this entire thing is 360° and half of it so this part only is 180° so those are all important part of understanding this idea of unit circle so you might have already guessed that unit circle refers to this idea that we have here one unit here one unit one unit one unit forming this entire circle so with the radius that is equal to one all right so this is something that is very easy and this comes from the geometry and pre and triog gometry uh you also need to understand this concept of the sinus and and cosinus and how sinus and cosinus are related to this what do we refer by the sinus and cosine you know what is this what are these points so 1 Z for instance we understand that here the x is equal to one and Y is equal to zero so here this point is simply 1 Z so this point and then we have 2 p radians so what is this idea of P so we know that a p Radian so P radians is simply the 180° which means that you also need to understand this concept of P2 which is simply the 90° so you can see here one thing that I forgot to mention you need to understand this concept the relationship between the pi and so Pi radians and radians and this unit circle you need to know that here the pi ided two is simply this angle and then the entire Pi is this angle and then this entire thing the entire angle with 360° is equal to 2 pi so 2 pi radians is simply this entire thing so those are very easy Concepts that come from geometry and trometry and if you want to refresh them then head towards those sores because this will help you to understand all this concept from scratch let's now continue our refreshment when it comes to so genometric identities and we just spoke about this unit circle we talked about the sinus cosinus it's really important to relate this back to bit more advanced topics coming from the same do domain and from the same area of mathematics and here we we need to know this concept before learning linear algebra few other things that um would be really great if you know but it's actually not a must to understand all these different topics it is the idea of Pythagorean identity so don't confuse this with Pythagoras Theorem this is the Pagan identity so this one that the square of the S of an angle plus the cosine squared is equal to one and all these different rules that go around the S and cosine and also the what is for instance the S 2 Theta which is equal to 2 s of theta and cosine of theta you know those are all different rules that would be handed to know and if you are so far I assume that you also know geometry and fundamentals to triogen ometry which means that you also know these trues but this might be just a great time to go ahead and quickly refresh your memory on these Concepts because those might become handy in your applied linear algebra and Applied Mathematics Journey but for now I would say this is not one of the most important things to know to learn this and to go through this course but just something to keep in mind so when it comes to the triog genometric equations uh this can become very handy later on when we want to prove something in linear algebra so to follow along it's actually a good idea to know for instance what is how you can solve this different equations and this will go back and refer to the unit circle that we just saw for instance if the sinus Theta is equal to 1 / 2 then you will need to quickly remember what is that angle for which the sinus is equal to 1 / 2 then you realize that is actually the angle where you take the p and remember that Pi is equal to 180° and that is the one corresponding to and then Pi / to 6 is simply 180 / to 6 so this is basically the 30 degree so those are things that you can do when you know for instance all these different sinus and cosinus so you have memorized for these different angles so what is the sinus and cosinus for 30° for 60° um let me actually remove this to make it easier so this type of problems is very easy to solve when we keep in mind and we memorize what are these different values for sinus and cosinus when it comes to different angles for instance for the angle equal to zero let me actually remove this and clean this part for better understanding so if we have for instance 0 degrees then we know that the sinus for this is zero and the cosine of this is one so we are basically dealing so if I plot a unit circle we are dealing with this number so remember that sinus and cosinus those refer to the Y and X on our unit circle so keep this one in mind so if the cosine Theta is then equal to 1 and the sinus so Y is equal to Z we are dealing automatically this number with this number and you can see that here the angle is also zero so here we are dealing with one and zero coordinate so this is our cosine of zero angle and this is then our sinus of zero angle so we automatically even from this graph can see very easy easily that the S of 0° is equal to 0 and the cosine is equal to 1 all right so let's quickly also refresh our memory on few other degrees so for the 30° which is simply the Pi / to 6 so this is 30° then the sinus or the Y AIS is equal to 1 / 2 and the cosine or the X x value x coordinate is equal to square root of 3 2 so we are dealing with this this corner or angle so 30° so even from here you can see that the coordinates make sense make sense then we have the pi for another famous value which is corresponding to the 45° it's simply this angle and for this angle the X AIS which is the coine so this number is equal to 1 / to 2 and then for the sinus the so the y coordinate is equal to 1 / 2 square root of 2 as you might have guessed because in this number the x-axis and y axis is equal to is the same so you can see that this distance and this distance is the same because we are dealing with this type of figure so here we have 45° here we have 45° so this values are the same and this is something that you would know knowing the pag Ian Pagan theorem so then you can go ahead and refresh your memory for the 60° so here I'm referring to the Pi / to three and then the 90° which is the very easy case this one obviously the x-axis is equal to zero so here you should have zero and the y axis is equal to one so here you should have one and so on all right so we went into quite detailed here but I think this is a very important topic knowing this idea of a trigonometric equations identities this idea of unit circle are super important because they are highly applicable to different fields in artificial intelligence data science machine learning and will definitely set you apart all right let's now talk about the law of signs and cosiness those are things that I won't be going on into too much details I just wanted to quickly showcase to you if you want to get the proof of those definitely check out our corresponding courses but for here I'm assuming that you already know so you know the law of signs which means that if you have this triangle you know you have this different sides so you have an angle a the corresponding side is a and then you have angle B corresponding side is B and then here C and the corresponding side is C then you know that a / to sinus of that angle is equal to B / to the sign of that angle and then is equal to C divided to the sign of that angle so basically take this value divide it to the sinus of this angle you know right in front of it is equal to taking this value and then dividing into the sinus of this angle so the proof of this low is outside so out of the scope of this course but knowing this will help you to understand different concepts and then the law of cosine is simply saying take the side of a Target angle so in our triangular we have here a we have here angle B and the C and if we go and look into this specific angle so angle C just randomly picking one of the three angles then the side right in front of that angle so the C c^ squ is equal to if we take this you know the other two sides forming that angle so A and B is equal to a s so this is just a constant a distance of this side a 2 + b 2 so this side squar minus 2 * a * B times the cosine of that angle this is what we are referring as the law of cosin quite easy we are not going to prove it again if you want to get the proofs make sure to check our other courses on the geometry and triog genetry we're almost done with the prerequisites just a quick refreshment we saw already the norm here is just a not EX exle what Norm is and on a specific two dimensional Vector when we have for instance that a vector is equal to three and four which means for the First Dimension let's say on xaxis we have three and then on Y axis is equal to four then the norm or the Alid distance so this is equal to we take the x value so three and then we Square it so V you can see here this is the case when n is equal to 2 this is simply equal to square Ro of v1^2 + v2^ 2 and as V1 is equal to 3 so this is our maybe I can make this just V1 and this is my V2 then the norm or the equan distance for this Vector so this thing is equal to V1 2 + v2^ 2 which is equal to 3^ 2 + 4 S and this value is square root of 25 and it's equal to 5 so let's now see the difference between aladine distance and the norm so you could see here the norm here we have just one vector like here and this Norm it has just two corresponding values into two dimensional space you see here we have just three and then four so this is V1 and V2 when it comes to the Alan distance this is kind of the generalization of this idea of Norm so the aladine distance between two points a and B in RN so in the N dimensional space is the norm of the vector connecting a to B so we see that the norm and the elidan distance are highly related to each other only we are talking about the norm when it comes to one vector but when we have this Vector a and the vector B this is simply the Alan distance so for the Aline distance we know already this idea of distance how we can measure it and you can see that this comes very similar to what we see here notation and here we are saying well we have this vector and then it has the two coordinates in N is equal to 2 in two dimensional space when it comes to the Alan distance Alan distance helps you understand what is this distance between two points in an N dimensional space so the aladan distance between two points let's say A and B in N dimensional space is the norm of the vector connecting a to B so for instance if we have a point a and we have a point B we are connecting this and this is the vector connecting these two points then the aladan distance is simply the norm of this Vector so this is the aladan distance so we can see that nor and the distance they are highly related to each other in the Alan distance we are using this idea of norm and specifically the norm two as I mentioned before so here you can see that the definition of aladine distance so the distance between A and B the two point is equal to square root of A1 - B1 2 + a and then here we have basically A2 - b 2^ 2 and then plus A3 - B 3 squ those are things that we cover as part of this dot dot dot and then plus up to the last point when we have a n minus BN 2 so here what we mean basically is that if we have two points here is a and here's B and this s vector and we know all these different points so A1 B1 A2 B2 A3 B3 blah blah blah and then here a n BN we know all these points lying here in this distance then we are taking them and using them to calculate the line distance so here for instance if we have point A and B so in this example let's do quick one specific example when we have a point a which has coordinates 1 and two so this is basically A1 A2 and then point B with points in it like B1 B2 you can notice that the da AB so the distance or the Eid in distance of these two points which is equal to the norm of this vector or here this is a and this is B and this is this Vector this is equal to Square < t of 4 - 1 so it takes the B1 so this is B1 and this is A1 takes the square and then says plus B2 minus H ^ 2 takes the square root of that and says this equal to 5 now you might be wondering but hey why do we do then instead of 1 - B1 2 we do B1 - A1 2 and the answer to this question lies in the uh properties that we learn as part of prealgebra because it doesn't matter when we take A1 - B1 squ or B1 - A1 squared because this squared ensures that it doesn't matter which one we take first and subtract the other now the proof of that is outside of the scope of this of course is this is part of pre-algebra but I just wanted to put this out there to ensure that you are seeing what we are seeing here because here it says A1 minus B1 but in this example we are taking instead depth B1 and we are subtracting A1 this is a common thing that we do in prealgebra and just in general in different cting distance or distance related cases so I just wanted to put this here to ensure that later on this is something that can be clear from the first view right and in here we will quickly refresh our memory on the Pythagorean theorem which basically says in the right angle triangle so if we have this type of triangle so here we have 90° this is a right angle triangle the square of the length of the the side opposite to the right angle so this side this we over refer C and this as B uh and then a those two are not very important but this is commonly referred by C so the the side opposite to the right angle then we know that the square of the C so c^ s is equal to a 2 + b^2 this is super important theorem and a fundamental principle for defining the Norms the distances in equity and spaces in and in many other applications so the angles play Cru Ro in understanding the direction of the vectors and you know how they can be measured in degrees or in radians we saw also the pi radian this idea of you know that the P radian is equal to 180° those are all very important when it comes to linear algebra and just in general application of mathematics in machine learning in Ai and other applications the relationships between this angle measurements and the triog genometric functions is foundational in solving different problems that are about these vectors and their orientations for instance this angle of s cosine you know what is this idea of tangent they are very important just to give you an idea the um uh Tang tangent is specifically used as part of the activation functions we call it tank activation function and knowing this tank will help you to understand the activation functions that I use as part of deep learning which are more advanced machine learning type of models and they are fundamentals in all these different new and Cutting Edge techniques large like large large language models Transformers encoder and decoder based algorithms Etc they're also important in this idea of computing dot products so very important and must know when it comes to linear algebra so this is just an simple example when it comes to this right angle triangle and Pythagorean theorem and how is applied I will skip this for now it's also important to understand this idea of orthogonality so the two vectors let's say A and B they are orthogonal to each other if their dotproduct is zero so later on as part of the vectors when we will talk about dot product we will see what we mean when we say that the dot product is equal to zero and here you can even see that if the a norm if the a vector so you see here and B Vector if those vectors if we multiply them to each other their dot product is equal to zero it means they are orthogonal so this angle that they form is equal to 90° orthogonality implies that the vectors from the from a right angle with each other they are in you know we we are dealing with that in R2 in R Tre so they are super important when it comes also to visualizing them correctly this concept is visually represented all this you know Vector a and then Vector B and they are perpendicular in the 2D uh coordinate system all right so when it comes to the applications of orthogonality orthogonality plays a crucial role in various aspect of linear algebra it's fundamental in defining Vector spaces subspaces in solving a systems of linear equation later on when we pass the vector ideas and we go on to the matrices solving linear systems so equations with many unknowns and then we use this idea of reductions or gausian reductions we will see how this idea of orthogonality can be important and how also it relates back to the norm of two vectors so it's fundamental in defining all these different identities and solving system of linear equations and also orthogonal vectors are used in finding the shortest distance from a point to the plane um something that is important when it comes to the optimizations and here you can see an example the vector a which is equal to 2 three and then Vector B which is equal to minus 3 and 2 you can see that when we multiply 2 by minus 3 so we obtain basically the dot product by the way this is something that we are going to cover also as part of this course but for now you can see that if we take this number we multiply with this so 2 * - 3 we take this number multiply with this so we take three and multiply with two you can see that this equal to minus 6 this is equal to 6 so - 6 + 6 is equal to zero so you can see that the dotproduct of these two vectors is simply equal to zero and this is what we are referring as orthogonality this means that these two vectors form a right angle where we see here this angle is equal to 90° why this prerequisites matter and why I meant those understanding this concept is very crucial they underpin this geometric interpretation of linear algebra they will help you to better understand these Concepts and not just to memorize them but really understand and later on when you go into your machine learning and AI journey and in your data science Journey seeing these Concepts will help you to better understand those different alori this optimization techniques what we mean when we say we want our optimization algorithm to move towards local minimum Global minimum but this idea of movement this idea of vectors later on will you will also understand this different concepts in deep learning how these models work how the neural networks work and those are essential Concepts that you need for solving different systems of linear equation a core part of this course they also help you in visualizing vectors spaces which are critical to understand this concept of linear algebra the applications of linear algebra when it comes to the real world applications so those are things that you can definitely must by following some of our other courses but for this course I assume that you are already familiar with this Concepts right so now we are ready to actually begin and with this prerequisites in mind you are prepared to start your linear arbra Journey we are going to learn everything in the most efficient way in such a way that you will learn the theory you are going to see many examples we are going to learn everything in detail but at the same time you're going to learn the must know Concepts and I'm not going to overwhelm you with this most difficult concept that you will not be seeing in your career I'm going to give you this bare minimum when it comes to really knowing and the must know for linear algebra such that you will be ready to apply linear algebra in your professional Journey whether you want to get into machine learning deep learning artificial intelligence data science knowing these different concepts in linear algebra you will be a pro in your field going to give you everything that you need the theory examples implementations everything in detail but at the same time you will be doing that in the most efficient and time-saving way so without further Ado let's get started let's Now quickly Define this idea of norm so the normal of a vector denoted by this uh uh V which you can see kind of like similar to the absolute value from pre-algebra you can see here that we have this double straight lines like from absolute value then we have the name of the vector or the variable name that we are assigning to our vector and then you might notice here on the top of this this Arrow this basically says that we are dealing not with just a variable but really we are dealing with a vector this is really important because you can see that there makes a huge difference if we have for instance just V or V1 I have to say or just V those are really important and things that you need to keep in mind when it comes to linear algebra and trying to differentiate vectors from a point you will notice that when it comes to Norm we can uh represented it either by this not ation or this usually it's a common um notation uh in machine learning or in data science um with this uh two bars and um when we do this we automatically also know L2 norm and this is something very common and uh usually used as part of um retrogression which is an application of um linear algebra uh and it's used in uh regularization so we are regularizing our machine learning algorithms so when you get into machine learning you will see time and time again this um notation so uh next time when you see this then you know automatically that you are dealing with L2 norm and L2 Norm which is also used a lot in machine learning it is referring to the usage of L2 Norm to uh in the uh regression and regression or L2 regularization is a very popular regularization techniques as part of machine learning so right now even you can see this uh intersection or linear algebra or um this uh idea of norms in machine learning the norm of this vector v is equal to square roof and then V1 S Plus V2 squ plus and all this in between numbers plus VN squ so here basically it means take square root of V1 squ then V2 squar plus V3 squ blah blah BL plus VN 2 so basically take all the units that form this vector and then so are on this vector and use them Square them and then add them and then take the square root of that that's the distance or I have to say the norm of this Vector we saw already the norm here is just a not example what Norm is in um on a specific two dimensional Vector when we have for instance that the vector is equal to three and four which means for the First Dimension let's say on xaxis we have three and then on Y axis is equal to four then the norm or the AL in distance so this is equal to we take the x value so three and then we Square it so V you can see here this is the case when n is equal to 2 this is simply equal to square root of V1 2 + v2^ 2 and as V1 is equal to 3 so this is our maybe I can make this just V1 and this is my V2 then the norm or the in distance for this Vector so this thing is equal to V1 2 + V2 s which is equal to 3^ 2 + 4^ 2 and this value is square root of 25 and it's equal to five so let's now see the difference between aladine distance and the norm so you you could see here the norm here we have just one vector like here and this Norm it has just two corresponding values into two dimensional space you see here we have just three and then four so this is V1 and V2 when it comes to the Alan distance this is kind of the generalization of this idea of Norm so the Alan distance between two points A and B in RN so in the N dimensional space is the norm of the the vector connecting a to B so we see that the norm and the elidan distance are highly related to each other only we are talking about the norm when it comes to one vector but when we have this Vector a and the vector B this is simply the Alan distance so for the Aline distance we know already this idea of distance how we can measure it and you can see that this comes very similar to what we see here notation and here we are saying well we have this vector and then it has this two coordinates in N is equal to two in two dimensional space when it comes to the AQ in distance Eline distance helps you understand what is this distance between two points in an N dimensional space so the aladan distance between two points let's say A and B in n dimens space is the norm of the vector connecting a to B so for instance if we have a point a and we have a point B we are connecting this and this is the vector connecting these two points then the aladan distance is simply the norm of this Vector so this is the aladine distance so we can see that the norm and the distance they are highly related to each other in the Alan distance where using this idea of norm and specifically the norm two as I mentioned before so here you can see that the definition of alodine distance so the distance between A and B the two point is equal to square root of A1 minus B1 2qu plus a and then here we have basically A2 minus b 2 2ar and then plus A3 minus B3 2 those are things that we cover as part of this dot dot dot and then plus up to the last point when we have a n minus bn^ 2 so here what we mean basically is that if we have two points here is a and here is B and this s vector and we know all these different points so A1 B1 A2 B2 A3 B3 blah blah blah and then here a n BN we know all these points lie in here in this distance then we are taking them and using them to calculate the Lan distance so here for instance if we have um point A and B so in this example let's do a quick one specific example when we have a point a which has coordinates 1 and two so this is basically A1 A2 and then point B with u points in it like B1 B2 you can notice that the da AB so the distance or the equid distance of these two points which which is equal to the norm of this um vector or here this is a and this is B and this is this Vector this is equal to square root of 4 - 1 so it takes the B1 so this is B1 and this is A1 takes the square and then says plus B2 - A2 2 takes the square root of that and says this equal to 5 now you might be wondering but hey why do we do then instead of 1 - B1 2 we do B1 - A1 2 and the answer to this question lies in the um uh properties that we learn as part of pre-algebra because it doesn't matter when we take uh A1 - B1 squ or B1 - A1 squ because this squared ensures that it doesn't matter which one we take first and subtract the other now the proof of that is outside of the scope of this um course is this is part of pre-algebra but I just wanted to put this out there to ensure that uh you are uh seeing what we are seeing here because here it sa

Original Description

This in-depth course provides a comprehensive exploration of all critical linear algebra concepts necessary for machine learning. You will learn the mathematical foundations to excel in AI. Course created by @LunarTech_ai. More AI courses here: https://lunartech.ai/ ❤️ Try interactive Python courses we love, right in your browser: https://scrimba.com/freeCodeCamp-Python (Made possible by a grant from our friends at Scrimba) Timestamps 00:00:00 - Introduction 00:02:09 - Essential Trigonometry and Geometry Concepts 00:10:52 - Real Numbers and Vector Spaces 00:15:05 - Norms, Refreshment from Trigonometry 00:19:52 - The Cartesian Coordinates System 00:24:37 - Angles and Their Measurement 00:38:00 - Norm of a Vector 00:44:08 - The Pythagorean Theorem 00:52:00 - Norm of a Vector 00:56:00 - Euclidean Distance Between Two Points 01:11:33 - Foundations of Vectors 01:12:50 - Scalars and Vectors, Definitions 01:42:28 - Zero Vectors and Unit Vectors 01:49:39 - Sparsity in Vectors 01:52:39 - Vectors in High Dimensions 01:55:14 - Applications of Vectors, Word Count Vectors 02:03:22 - Applications of Vectors, Representing Customer Purchases 02:39:22 - Advanced Vectors Concepts and Operations 02:40:40 - Scalar Multiplication Definition and Examples 03:04:27 - Linear Combinations and Unit Vectors 03:51:37 - Span of Vectors 04:31:42 - Linear Independence 05:03:34 - Linear Systems and Matrices, Coefficient Labeling 05:20:24 - Matrices, Definitions, Notations 05:50:24 - Special Types of Matrices, Zero Matrix 06:25:25 - Algebraic Laws for Matrices 07:21:56 - Determinant Definition and Operations 08:12:47 - Vector Spaces, Projections 08:20:05 - Vector Spaces Example, Practical Application 09:14:33 - Vector Projection Example 09:29:35 - Understanding Orthogonality and Normalization 10:06:29 - Special Matrices and Their Properties 10:21:07 - Orthogonal Matrix Examples 🎉 Thanks to our Champion and Sponsor supporters: 👾 Drake Milly 👾 Ulises Moralez 👾 Goddard Tan 👾 David MG 👾 Mat
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from freeCodeCamp.org · freeCodeCamp.org · 0 of 60

← Previous Next →
1 React: Production Server Setup Part 2 - Live Coding with Jesse
React: Production Server Setup Part 2 - Live Coding with Jesse
freeCodeCamp.org
2 cookies vs localStorage vs sessionStorage - Beau teaches JavaScript
cookies vs localStorage vs sessionStorage - Beau teaches JavaScript
freeCodeCamp.org
3 Browser history tutorial - Beau teaches JavaScript
Browser history tutorial - Beau teaches JavaScript
freeCodeCamp.org
4 Graph Data Structure Intro (inc. adjacency list, adjacency matrix, incidence matrix)
Graph Data Structure Intro (inc. adjacency list, adjacency matrix, incidence matrix)
freeCodeCamp.org
5 React: Parameterized Routing with Next.js - Live Coding with Jesse
React: Parameterized Routing with Next.js - Live Coding with Jesse
freeCodeCamp.org
6 React: Dealing with jQuery Issues - Live Coding with Jesse
React: Dealing with jQuery Issues - Live Coding with Jesse
freeCodeCamp.org
7 setInterval and setTimeout: timing events - Beau teaches JavaScript
setInterval and setTimeout: timing events - Beau teaches JavaScript
freeCodeCamp.org
8 Browser and Device Testing - Live Coding with Jesse
Browser and Device Testing - Live Coding with Jesse
freeCodeCamp.org
9 Last Minute Updates - Live Coding with Jesse
Last Minute Updates - Live Coding with Jesse
freeCodeCamp.org
10 Post Launch Updates - Live Coding with Jesse
Post Launch Updates - Live Coding with Jesse
freeCodeCamp.org
11 React: Setting Up Google Analytics - Live Coding with Jesse
React: Setting Up Google Analytics - Live Coding with Jesse
freeCodeCamp.org
12 React: Masonry Layout - Live Coding with Jesse
React: Masonry Layout - Live Coding with Jesse
freeCodeCamp.org
13 Load Balancing Digital Ocean Droplets - Live Coding with Jesse
Load Balancing Digital Ocean Droplets - Live Coding with Jesse
freeCodeCamp.org
14 try, catch, finally, throw - error handling in JavaScript
try, catch, finally, throw - error handling in JavaScript
freeCodeCamp.org
15 Load Balancing: SSL Passthrough Setup - Live Coding with Jesse
Load Balancing: SSL Passthrough Setup - Live Coding with Jesse
freeCodeCamp.org
16 Graphs: breadth-first search - Beau teaches JavaScript
Graphs: breadth-first search - Beau teaches JavaScript
freeCodeCamp.org
17 React: Masonry Layout Part 2 - Live Coding with Jesse
React: Masonry Layout Part 2 - Live Coding with Jesse
freeCodeCamp.org
18 React: WordPress API Live Search - Live Coding with Jesse
React: WordPress API Live Search - Live Coding with Jesse
freeCodeCamp.org
19 Creating WordPress Custom Post Types - Live Coding With Jesse
Creating WordPress Custom Post Types - Live Coding With Jesse
freeCodeCamp.org
20 Dates - Beau teaches JavaScript
Dates - Beau teaches JavaScript
freeCodeCamp.org
21 Miscellaneous Front End Updates - Live Coding with Jesse
Miscellaneous Front End Updates - Live Coding with Jesse
freeCodeCamp.org
22 Merging a Pull Request from GitHub - Live Coding with Jesse
Merging a Pull Request from GitHub - Live Coding with Jesse
freeCodeCamp.org
23 React + Prettier + Standard JS - Live Coding with Jesse
React + Prettier + Standard JS - Live Coding with Jesse
freeCodeCamp.org
24 React: Sortable Responsive Table - Live Coding with Jesse
React: Sortable Responsive Table - Live Coding with Jesse
freeCodeCamp.org
25 Geolocation Sorting by Distance - Live Coding with Jesse
Geolocation Sorting by Distance - Live Coding with Jesse
freeCodeCamp.org
26 Tradeoff Matrix - Agile Software Development
Tradeoff Matrix - Agile Software Development
freeCodeCamp.org
27 The Definition of Ready - Agile Software Development
The Definition of Ready - Agile Software Development
freeCodeCamp.org
28 Getting first React job without experience - Ask Preethi
Getting first React job without experience - Ask Preethi
freeCodeCamp.org
29 React: Google Analytics Click Tracking - Live Coding with Jesse
React: Google Analytics Click Tracking - Live Coding with Jesse
freeCodeCamp.org
30 Submitting a PR to an Open Source Project - Live Coding with Jesse
Submitting a PR to an Open Source Project - Live Coding with Jesse
freeCodeCamp.org
31 Should I go back to school to get CS degree? - Ask Preethi
Should I go back to school to get CS degree? - Ask Preethi
freeCodeCamp.org
32 Hero Section CSS Changes - Live Coding with Jesse
Hero Section CSS Changes - Live Coding with Jesse
freeCodeCamp.org
33 Working Agreement - Agile Software Development
Working Agreement - Agile Software Development
freeCodeCamp.org
34 A day at Pennybox with Co-Founder Reji Eapen
A day at Pennybox with Co-Founder Reji Eapen
freeCodeCamp.org
35 React: Sorting and Filtering Data - Live Coding with Jesse
React: Sorting and Filtering Data - Live Coding with Jesse
freeCodeCamp.org
36 React: Sorting and Filtering Data Part 2 - Live Coding with Jesse
React: Sorting and Filtering Data Part 2 - Live Coding with Jesse
freeCodeCamp.org
37 React: Building a New UI - Live Coding with Jesse
React: Building a New UI - Live Coding with Jesse
freeCodeCamp.org
38 Definition of Done - Agile Software Development
Definition of Done - Agile Software Development
freeCodeCamp.org
39 Getting started with jQuery (tutorial) - Beau teaches JavaScript
Getting started with jQuery (tutorial) - Beau teaches JavaScript
freeCodeCamp.org
40 Making a React Blog with WordPress Content - Live Coding with Jesse
Making a React Blog with WordPress Content - Live Coding with Jesse
freeCodeCamp.org
41 React, NextJS, CSS - Live Coding with Jesse
React, NextJS, CSS - Live Coding with Jesse
freeCodeCamp.org
42 jQuery events - Beau teaches JavaScript
jQuery events - Beau teaches JavaScript
freeCodeCamp.org
43 React/NextJS Routing and WordPress API Custom Types - Live Coding with Jesse
React/NextJS Routing and WordPress API Custom Types - Live Coding with Jesse
freeCodeCamp.org
44 React: Working with API Data - Live Coding with Jesse
React: Working with API Data - Live Coding with Jesse
freeCodeCamp.org
45 React: Refactoring Components - Live Streaming with Jesse
React: Refactoring Components - Live Streaming with Jesse
freeCodeCamp.org
46 jQuery effects - Beau teaches JavaScript
jQuery effects - Beau teaches JavaScript
freeCodeCamp.org
47 More React Refactoring - Live Coding with Jesse
More React Refactoring - Live Coding with Jesse
freeCodeCamp.org
48 animate in jQuery - Beau teaches JavaScript
animate in jQuery - Beau teaches JavaScript
freeCodeCamp.org
49 "Finishing" My React Site - Live Coding with Jesse
"Finishing" My React Site - Live Coding with Jesse
freeCodeCamp.org
50 Starting a New React Project (P2D1) - Live Coding with Jesse
Starting a New React Project (P2D1) - Live Coding with Jesse
freeCodeCamp.org
51 React Project 2 Day 2: Learning Material UI - Live Coding with Jesse
React Project 2 Day 2: Learning Material UI - Live Coding with Jesse
freeCodeCamp.org
52 The Agile Manifesto - Agile Software Development
The Agile Manifesto - Agile Software Development
freeCodeCamp.org
53 jQuery: get and set with http, text, val, and attr - Beau teaches JavaScript
jQuery: get and set with http, text, val, and attr - Beau teaches JavaScript
freeCodeCamp.org
54 React Project 2 Day 3 - Live Coding with Jesse
React Project 2 Day 3 - Live Coding with Jesse
freeCodeCamp.org
55 The INVEST approach to product backlog items
The INVEST approach to product backlog items
freeCodeCamp.org
56 React Project 2 Day 4 - Live Coding with Jesse
React Project 2 Day 4 - Live Coding with Jesse
freeCodeCamp.org
57 Chickens and Pigs - Agile Software Development
Chickens and Pigs - Agile Software Development
freeCodeCamp.org
58 React Project 2 Day 5 - Live Coding with Jesse
React Project 2 Day 5 - Live Coding with Jesse
freeCodeCamp.org
59 jQuery: add and remove DOM elements - Beau teaches JavaScript
jQuery: add and remove DOM elements - Beau teaches JavaScript
freeCodeCamp.org
60 React Project 2 Day 6 - Live Coding with Jesse
React Project 2 Day 6 - Live Coding with Jesse
freeCodeCamp.org

This video course provides a comprehensive introduction to linear algebra for machine learning, covering key concepts such as vector spaces, norms, and distance measures, with a focus on practical applications in AI and data science.

Key Takeaways
  1. Calculate the norm of a vector
  2. Calculate the Euclidean distance between two points
  3. Define the norm of a vector
  4. Solve system of linear equations using matrices and Gaussian reductions
  5. Find the shortest distance from a point to a plane using orthogonal vectors
💡 Linear algebra is a crucial foundation for machine learning, and understanding concepts such as vector spaces, norms, and distance measures is essential for building practical applications in AI and data science.

Related AI Lessons

Chapters (33)

Introduction
2:09 Essential Trigonometry and Geometry Concepts
10:52 Real Numbers and Vector Spaces
15:05 Norms, Refreshment from Trigonometry
19:52 The Cartesian Coordinates System
24:37 Angles and Their Measurement
38:00 Norm of a Vector
44:08 The Pythagorean Theorem
52:00 Norm of a Vector
56:00 Euclidean Distance Between Two Points
1:11:33 Foundations of Vectors
1:12:50 Scalars and Vectors, Definitions
1:42:28 Zero Vectors and Unit Vectors
1:49:39 Sparsity in Vectors
1:52:39 Vectors in High Dimensions
1:55:14 Applications of Vectors, Word Count Vectors
2:03:22 Applications of Vectors, Representing Customer Purchases
2:39:22 Advanced Vectors Concepts and Operations
2:40:40 Scalar Multiplication Definition and Examples
3:04:27 Linear Combinations and Unit Vectors
3:51:37 Span of Vectors
4:31:42 Linear Independence
5:03:34 Linear Systems and Matrices, Coefficient Labeling
5:20:24 Matrices, Definitions, Notations
5:50:24 Special Types of Matrices, Zero Matrix
6:25:25 Algebraic Laws for Matrices
7:21:56 Determinant Definition and Operations
8:12:47 Vector Spaces, Projections
8:20:05 Vector Spaces Example, Practical Application
9:14:33 Vector Projection Example
9:29:35 Understanding Orthogonality and Normalization
10:06:29 Special Matrices and Their Properties
10:21:07 Orthogonal Matrix Examples
Up next
How to Open OSM Files (OpenStreetMap Data)
File Extension Geeks
Watch →