4. Maths Vector Length

Vector Length

The first thing we will look at is how to work out the length of a vector.

Vector Length 1

Take a look at the diagram and try to grasp that we can describe how every vector there relates to the others, and then we can work out the actual length (magnitude) of a vector once we have its components.

Figure 1 – The Triangle On The Left

First go to the image on the left. You will see a triangle with vectors a, b and c.

The arrows matter here. A vector is not just a length; it has a direction as well. If you travel along a vector in the same direction as its arrow it is positive, and if you travel against the arrow you use the negative of that vector.

This is where the original version of this tutorial got its terminology a bit tangled up: equations such as a = -b – c describe the relationship between the vectors, not the numerical length of a.

Following the arrows in the diagram, the closed triangle gives us:

a + b + c = 0

Which means we can rearrange it as:

a = -b – c
b = -c – a
c = -a – b

If we reverse a vector, we simply change its sign. So:

-a = b + c

Same geometry, same vectors, we are just walking around the triangle in a different direction.

Figure 2 – The Square On The Right

Vector Length 2

The same rule applies on a bigger shape. If you follow a path around the shape and return to where you started, the vectors in that closed path add up to zero. You can then rearrange that equation to express one vector in terms of the others.

Keep in mind that no matter what shape you have, the important bit is the direction of each vector. Follow the arrows, use a negative sign when you travel against one, and the vector arithmetic falls into place.

LENGTH OF A VECTOR PART 2

In this part, we are going to look at the vector between two points. This is where we can start getting an actual numerical length.

Vector Length 3

Take point A and point C. The vector from A to C is normally written with an arrow above AC, but since my keyboard is not exactly overflowing with vector notation, I will just write AC here.

Vector Length 4

The arrow above it represents the vector. The vertical bars represent its length, so |AC| means “the magnitude of vector AC”.

To get the vector itself, subtract the starting point from the ending point:

AC = C – A

And once we have the X and Y components of AC, we can use Pythagoras to get |AC|.

LENGTH OF A VECTOR PART 3

Here we are going to be actually calculating the length of the vector using numbers.

Vector Length 5

A is going to be located at (1, 1)

B is going to be located at (1, 0)

C is going to be located at (2, 0.5)

Now the vector AC comes to:

AC = [cX – aX, cY – aY]

Therefore:

AC = [2 – 1, 0.5 – 1]

AC = [1, -0.5]

Now to work out the length/distance:

|AC| = sqrt(x^2 + y^2)

And vectors don’t actually have a measuring system built into them like cm, m or km. The unit comes from whatever your coordinate system represents.

So:

|AC| = sqrt(1^2 + (-0.5)^2)

|AC| = sqrt(1 + 0.25)

|AC| = sqrt(1.25) ~= 1.118 units

And that is the actual length of the vector. The first part was vector addition/direction; this part is vector magnitude. Similar-looking diagrams, very different jobs!

Questions or corrections? If something doesn’t work or you spot something I’ve got wrong, leave a comment below. These tutorials have been around a long time, so useful corrections are always welcome!

  • March 25, 2010
  • 1