How to Calculate a Vector's Magnitude (The Easy Way)
How to Calculate a Vector's Magnitude (The Easy Way) Alright, so in our last video and post , we established that a simple list of numbers, like [3, 4] , is actually a vector with a magnitude (length) and a direction. It’s the fundamental building block of machine learning. So, how do we actually figure out its length? The good news is, we already know how to do it. Watch the video below for a quick visual explanation, then read on for the code and details. The Intuition: It’s Just a Triangle Let's go back to our vector v = [3, 4] . Visually, it’s an arrow pointing from the origin to the point (3, 4). If we draw a line down from that point to the x-axis, we create a simple right-angled triangle. The base is 3 units, the height is 4 units. The vector is the hypotenuse. We can find the length of the hypotenuse using the Pythagorean Theorem, which you probably remember from school a² + b² = c² So, the magni...