Support Vector Machines — Lecture series — Magnitude of a vector

David Sasu
2 min readMar 18, 2021

In the previous post I spoke about the concept of a vector. Where I stated that a vector is a term that is used to describe any mathematical object that has a magnitude and a direction.

In this post, I am going to talk a little bit more about the concept of the magnitude of a vector. As I said in the previous post, some of you may be already familiar with these concepts, but others aren’t and this should benefit them too, so please bear with me :)

Learning objective:

Understand how to obtain the magnitude of a given vector.

The main question:

Supposing that you know the direction of a given vector but you have no knowledge of the magnitude of the vector, how do you obtain the magnitude?

Consider the image drawn in Fig. 1 below:

Fig 1

How would you obtain the magnitude of the vector in Fig. 1 above?

Well, you would observe that the vector forms a right-angle with regards to the direction that it is pointed in. This can be seen in Fig. 2 below:

Fig. 2

Given the scenario in Fig 2, we can now easily calculate for the magnitude of the vector using the Pythagoras theorem.

The Pythagoras theorem states that if you have a right-angled triangle, the sum of the square of the base of the triangle(a²) and the square of the height of the triangle(b²) is equal to the square of the hypotenuse of the triangle(c²).

Pythagoras theorem: a² + b² = c²

Since the magnitude of the vector is the hypotenuse of the right-angled triangle in Fig. 2, it is equal to the square root of the sum of 5² (which is the square of the base of the triangle) and 4²(which is the square of the height of the triangle). The magnitude is 6.4.

Since we now know all we need to know about the magnitude of a vector for Support Vector Machines, in next post we will take a closer look at the direction of the vector.

I hope at this point you are realising that machine learning algorithms are nothing more than very simple ideas strung together to produce something beautiful and incredibly useful in the real world.

--

--