Skip to main content

Arrows: a first look at vectors

The move from one point to another is a list of changes, drawn as an arrow that may start anywhere. Write it as a bold letter and a column, find its length, see a point as the arrow from the origin, and add two moves by adding their changes.
M01.2.4L0 Foundation25 minIn review

Before this lesson

M01.2.3 Distance, from the plane to many dimensions

After this lesson you can

  • Write the move from a point P to a point Q as the list of changes Q − P and draw it as an arrow.
  • Explain why one arrow can start at any point, and why the arrow from the origin to a point has that point’s coordinates.
  • Find the length of an arrow from its two changes.
  • Combine two moves by adding their changes, and check the result on a drawing.

In review. The maths and code on this page are checked by automated tests on every change, but an independent reader has not signed it off yet. Spot a mistake or a confusing step? Tell us.

The question

A treasure map says: from the old well, walk 3 paces east and then 4 paces north. It never says where the well is, and it does not need to, because the instruction makes sense from any starting point. Machine learning is full of instructions like this. In lesson ML01.5.2 a line through the course’s data improves by moving its slope and intercept from \((0, 0)\) to \((1.175, 0.4)\) in one step. What kind of object is a move, as opposed to a place? How do we write one down, measure it, and combine two of them?

From the last lesson

1. What is the distance from \((2, 1)\) to \((5, 5)\)?

Show answer

The changes are 3 and 4, so the distance is \({\sqrt{9 + 16}}\), which is 5.

2. Why does it not matter which point you subtract from which?

Show answer

Each change is squared, and a number and its negative have the same square.

Intuition

From \({P = (1, 2)}\) to \({Q = (4, 6)}\) the changes are 3 across and 4 up. So far we used them to measure a distance. Now keep the two changes together as one object, the move \((3, 4)\), and draw it as an arrow from \(P\) to \(Q\). The arrow starts at its tail, \(P\), and ends at its tip, \(Q\).

The arrow is the move, and a move does not care where it starts. From \({(2, -4)}\) the same instruction, 3 across and 4 up, ends at \((5, 0)\). The arrow is drawn in a different place, but it is the same arrow: same changes, same length, same direction.

Two panels on numbered grids. Left panel, titled The move from P to Q: a thick green arrow runs from the blue point P = (1, 2) to the sky-blue point Q = (4, 6), labelled v = (3, 4), length 5. Dashed green lines under it show its two changes, 3 across and 4 up. Right panel, titled The same arrow, any start: three identical green arrows, each 3 across and 4 up and each labelled v, start at (minus 4, minus 4), at the origin and at (2, minus 4). The one from the origin ends at the point (3, 4), with a note: from the origin, the tip is the point (3, 4).
M01.2.4-F1

Left: the move from \(P\) to \(Q\) is the list of changes \((3, 4)\), drawn as an arrow. Right: the same arrow can start anywhere. Started at the origin, its tip is the point \((3, 4)\).

An object that is fixed by its list of changes, and nothing else, is a vector. This lesson is a first look: what a vector is, how to write it, how long it is, and what happens when one move follows another.

Build it up

Step 1. A move is a subtraction. The changes from \(P\) to \(Q\) are end minus start, one coordinate at a time (M01.2.1). We write the whole list as \({Q - P}\):

\[ Q - P = (4 - 1,\; 6 - 2) = (3,\; 4). \]

For an arrow, the rule reads tip minus tail.

Step 2. The same arrow from any start. Start at the point \({(-2, 0)}\) and make the move \((3, 4)\): add each change to the matching coordinate.

\[ (-2 + 3,\; 0 + 4) = (1,\; 4). \]

A point plus a move is a point: the tip of the arrow.

Step 3. Its length. The length of an arrow is the distance from its tail to its tip. Its changes are 3 and 4 wherever it starts, so by M01.2.3 its length is always

\[ \sqrt{3^2 + 4^2} = 5 . \]

Step 4. Its direction. The two changes together fix which way the arrow points: 3 across for every 4 up. An angle could say the same thing, and lesson M01.5.2 measures it. In this course the two changes are enough.

Step 5. A point is an arrow from the origin. The move from the origin \({O = (0, 0)}\) to \({P = (1, 2)}\) is \({(1 - 0,\; 2 - 0)}\), which is \((1, 2)\): the same two numbers as the point. So every point can be read as an arrow from the origin. The arrow from \(P\) to \(Q\) then closes the triangle made by the arrows to \(P\) and to \(Q\).

A numbered grid with three arrows. A blue arrow runs from the origin to the point labelled P = (1, 2), and a sky-blue arrow runs from the origin to the point labelled Q = (4, 6). A thick green arrow from the tip of the first to the tip of the second, from P to Q, is labelled Q minus P = (3, 4). The three arrows form a triangle.
M01.2.4-F2

Each point is the tip of an arrow from the origin. The arrow from \(P\) to \(Q\) is the difference of their coordinates, \({Q - P = (3, 4)}\).

The formal statement

NoteDefinition: vector

A vector in the plane is a pair of changes \((v_1, v_2)\), called its components: \(v_1\) across and \(v_2\) up. It is drawn as an arrow from any point \((p_1, p_2)\), its tail, to the point \({(p_1 + v_1,\; p_2 + v_2)}\), its tip. The vector from a point \(P\) to a point \(Q\) is

\[ Q - P = (q_1 - p_1,\; q_2 - p_2). \]

Notation. A vector is written as a bold lower-case letter, \(\vect{v}\). By hand, where bold is hard, people write an arrow over the letter. In running text its components go in round brackets, \({\vect{v} = (3, 4)}\). In a displayed equation they are stacked in a column, first component on top:

\[ \vect{v} = \begin{bmatrix} 3 \\ 4 \end{bmatrix}. \]

Both say the same thing: 3 across, then 4 up.

Its length. The length of \(\vect{v}\) is written \(\norm{\vect{v}}\). Draw \(\vect{v}\) from any tail \(P\). Its tip is the point \(Q\) with coordinates \({q_1 = p_1 + v_1}\) and \({q_2 = p_2 + v_2}\), so the changes from \(P\) to \(Q\) are

\[ \begin{aligned} q_1 - p_1 &= (p_1 + v_1) - p_1 = v_1, \\ q_2 - p_2 &= (p_2 + v_2) - p_2 = v_2, \end{aligned} \]

so the distance formula of M01.2.3 gives

\[ \norm{\vect{v}} = \sqrt{v_1^2 + v_2^2} . \]

The tail \(P\) has dropped out, so every copy of the arrow has the same length.

A point as a vector. The vector from the origin to \({P = (p_1, p_2)}\) is \({(p_1 - 0,\; p_2 - 0)}\), which is \((p_1, p_2)\). It is called the position vector of \(P\).

One move after another. Suppose a move \(\vect{v}\) takes \(P\) to \(Q\), and a second move \(\vect{u}\) takes \(Q\) on to a point \(R\). The total move from \(P\) to \(R\) has first component

\[ \begin{aligned} r_1 - p_1 &= (r_1 - q_1) + (q_1 - p_1) \\ &= u_1 + v_1 . \end{aligned} \]

The first line only adds and takes away \(q_1\), which changes nothing. The second component works in the same way, so the total move is

\[ \vect{v} + \vect{u} = (v_1 + u_1,\; v_2 + u_2) . \]

Moves add by adding their components, and their arrows go tip to tail.

That is as far as this first look goes. Stretching an arrow by a number, the rules that adding obeys, and vectors with many components are the subject of M02.1, which starts again from the beginning.

Go deeper: why two points can be subtracted but not added

Subtracting two points gives a move, and a move does not depend on where the origin is. Slide the origin one unit to the right: every x-coordinate drops by 1, so \(P\) becomes \((0, 2)\) and \(Q\) becomes \((3, 6)\). The move \({Q - P}\) is still \((3, 4)\).

Adding two points has no such meaning. Before the slide, \({P + Q}\) would be \((5, 8)\), which in the new coordinates is the place \((4, 8)\). After the slide the same sum gives \({(0 + 3,\; 2 + 6)}\), which is \((3, 8)\), a different place. The answer depends on an arbitrary choice, so it names no place at all. An average such as the midpoint is safe: before the slide it is \((2.5, 4)\), which is \((1.5, 4)\) in the new coordinates, and after the slide the formula gives \((1.5, 4)\) too.

Worked example

One move after another. Start at \({P = (1, 2)}\).

The first move. \({\vect{v} = Q - P = (3, 4)}\) takes \(P\) to \({Q = (4, 6)}\), and its length is 5.

The second move. \({\vect{u} = (1, -2)}\) takes \(Q\) on to

\[ R = (4 + 1,\; 6 - 2) = (5,\; 4), \]

and its length is \({\sqrt{5} \approx 2.2361}\), from the squares 1 and 4.

The total move. Add the components:

\[ \begin{bmatrix} 3 \\ 4 \end{bmatrix} + \begin{bmatrix} 1 \\ -2 \end{bmatrix} = \begin{bmatrix} 3 + 1 \\ 4 - 2 \end{bmatrix} = \begin{bmatrix} 4 \\ 2 \end{bmatrix}. \]

Check on the drawing. The arrow from \(P\) straight to \(R\) is

\[ R - P = (5 - 1,\; 4 - 2) = (4,\; 2), \]

the same. Its length is \({\sqrt{20} \approx 4.4721}\), from the squares 16 and 4.

A numbered grid with three points: blue P = (1, 2), sky-blue Q = (4, 6) and R = (5, 4). A green arrow v = (3, 4) runs from P to Q and a second green arrow u = (1, minus 2) runs from Q to R, tip to tail. A thick vermillion arrow runs straight from P to R, labelled v + u = (4, 2). The working (3, 4) + (1, minus 2) = (4, 2) is written beside the picture.
M01.2.4-F3

Two moves, tip to tail, and the single move that does the same: \({\vect{v} + \vect{u} = (4, 2)}\).

Notice that the total arrow is shorter than the two moves together: about 4.4721, against \({5 + 2.2361}\), which is 7.2361. The components add; the lengths do not.

Code

From scratch first: a vector is a list of changes, built by a loop over the coordinates.

import math

P = (1, 2)
Q = (4, 6)

v = []
for k in range(len(P)):          # one coordinate at a time
    v.append(Q[k] - P[k])        # tip minus tail
print("v = Q - P =", v)

total = 0
for change in v:
    total = total + change ** 2
print("length of v:", math.sqrt(total))

start = (-2, 0)                  # the same arrow from another tail
tip = (start[0] + v[0], start[1] + v[1])
print("from", start, "the arrow ends at", tip)

u = [1, -2]                      # a second move
both = []
for k in range(2):
    both.append(v[k] + u[k])     # moves add component by component
print("v then u:", both)
v = Q - P = [3, 4]
length of v: 5.0
from (-2, 0) the arrow ends at (1, 4)
v then u: [4, 2]

With NumPy, a preview of P02, arrays subtract and add component by component, and numpy.linalg.norm gives the length.

import numpy as np

P = np.array([1, 2])
Q = np.array([4, 6])
v = Q - P
u = np.array([1, -2])
print(v, np.linalg.norm(v))          # the arrow and its length
print(v + u, P + v + u)              # the total move, and where it ends
[3 4] 5.0
[4 2] [5 4]

Machine learning moves its numbers in exactly this way. In ML01.5.2, gradient descent on the course’s data changes the slope \(w\) and the intercept \(b\) of a line in steps. Each step is an arrow in a plane whose axes are \(w\) and \(b\), and two steps add up to the total move.

# (w, b) at the start and after one and two steps of gradient descent, as computed in ML01.5.2
start = np.array([0.0, 0.0])
first = np.array([1.175, 0.4])
second = np.array([1.36875, 0.46625])

step_1 = first - start
step_2 = second - first
print("steps:", step_1, step_2)
print("their sum:", step_1 + step_2, " total move:", second - start)
print("lengths:", round(np.linalg.norm(step_1), 4), round(np.linalg.norm(step_2), 4))
steps: [1.175 0.4  ] [0.19375 0.06625]
their sum: [1.36875 0.46625]  total move: [1.36875 0.46625]
lengths: 1.2412 0.2048

The second step is about a sixth as long as the first. Lesson ML01.5.2 explains why the steps shrink as the line nears the best one, \((1.4, 0.5)\).

A plane whose horizontal axis is the slope w and whose vertical axis is the intercept b. A long green arrow, step 1, runs from an orange dot at (0, 0) to an orange dot at (1.175, 0.4), and a short green arrow, step 2, runs on to (1.36875, 0.46625). An ink star marks the best line, (1.4, 0.5), just beyond the second dot.
M01.2.4-F5

Two steps of gradient descent drawn as arrows in the plane of the parameters \(w\) and \(b\). Each is a vector: a list of changes, one per parameter.

Explore

M01.2-X1

Point and arrow explorer

Drag the points \(P\) and \(Q\), or move their sliders. The right triangle between them shows the two changes, and the distance, the midpoint and the arrow \({Q - P}\) update as numbers. Then use the Slide both buttons: the arrow moves, but its components and its length stay the same. Press Swap P and Q: the arrow turns round and both components change sign, but the distance does not.

The move from P = (1, 2) to Q = (4, 6) drawn as a green arrow with its two changes, 3 across and 4 up, and length 5, beside three copies of the same arrow starting at different points, one of them at the origin.

Pitfalls

Two panels on numbered grids, each with the blue point P = (1, 2) and the sky-blue point Q = (4, 6). The left panel is marked with a cross and titled P minus Q: wrong. A purple arrow (minus 3, minus 4) starts at P and points away from Q, ending at a hollow purple dot at (minus 2, minus 2). The right panel is marked with a tick and titled Q minus P: right. A green arrow (3, 4) starts at P and ends exactly on Q.
M01.2.4-F4

Wrong beside right. \({P - Q = (-3, -4)}\) drawn from \(P\) points away from \(Q\). Tip minus tail, \({Q - P = (3, 4)}\), lands on \(Q\).

“The arrow from \(P\) to \(Q\) is \({P - Q}\).”

It is tip minus tail, \({Q - P = (3, 4)}\). The vector \({P - Q = (-3, -4)}\) is the arrow from \(Q\) back to \(P\). Drawn from \(P\), it ends at \({(-2, -2)}\), nowhere near \(Q\).

“A vector is just a point.”

A point is a place. A vector is a move, the same move from every starting point. The two share their numbers only when the arrow starts at the origin, which is why the same pair \((3, 4)\) can name both.

“When moves add, their lengths add.”

The components add; the lengths do not. The moves \((3, 4)\) and \({(1, -2)}\) have lengths 5 and \({\sqrt{5} \approx 2.2361}\), but their total \((4, 2)\) has length \({\sqrt{20} \approx 4.4721}\). Lengths add only when the arrows point the same way. A detour is never shorter than the straight path, the triangle inequality of M02.3.

“One number, 4 divided by 3, gives the direction.”

The arrows \((3, 4)\) and \({(-3, -4)}\) give the same ratio, yet they point in opposite directions. It takes both changes, with their signs, to fix a direction. When M01.5.2 turns the two changes into an angle, it uses a function, atan2, that looks at both signs for exactly this reason.

Check yourself

Recall

1. What are the components of the arrow from \({P = (2, 5)}\) to \({Q = (6, 2)}\)?

Show answer

Tip minus tail:

\[ \begin{aligned} Q - P &= (6 - 2,\; 2 - 5) \\ &= (4,\; -3). \end{aligned} \]

2. How long is that arrow?

Show answer

\[ \sqrt{4^2 + (-3)^2} = \sqrt{25} = 5 . \]

3. The arrow \((3, 4)\) starts at \({(-1, 1)}\). Where is its tip?

Show answer

Add the changes to the tail:

\[ (-1 + 3,\; 1 + 4) = (2,\; 5). \]

4. The arrow from the origin has components \({(-2, 7)}\). Which point does it end at?

Show answer

The point \({(-2, 7)}\): an arrow from the origin ends at the point with the same numbers.

5. Move \((2, 1)\), then move \({(-3, 4)}\). Which single move does the same?

Show answer

Add the components:

\[ (2 - 3,\; 1 + 4) = (-1,\; 5). \]

Exercises

1. ★ Find the components and the length of the arrow from \({A = (-1, 4)}\) to \({B = (2, 0)}\), and the components of the arrow from \(B\) back to \(A\).

Show solution

Tip minus tail:

\[ \begin{aligned} B - A &= (2 - (-1),\; 0 - 4) \\ &= (3,\; -4). \end{aligned} \]

Its length is \({\sqrt{9 + 16}}\), which is 5. The arrow from \(B\) to \(A\) is \({A - B = (-3, 4)}\): the same length, the opposite direction.

2. ★★ A robot makes three moves: \((2, 3)\), then \({(4, -1)}\), then \({(-1, -2)}\). Which single move takes it from its start to its finish, and how far apart are the two? How long is the path the robot actually drove, to four decimal places?

Show solution

Add the components, one coordinate at a time:

\[ \begin{aligned} 2 + 4 + (-1) &= 5, \\ 3 + (-1) + (-2) &= 0 . \end{aligned} \]

The single move is \((5, 0)\), so the finish is 5 from the start. The path is the sum of the three lengths, \({\sqrt{13} + \sqrt{17} + \sqrt{5}}\). Keep each length to five places, so that rounding does not show in the fourth place of the total:

\[ \begin{aligned} \sqrt{13} &\approx 3.60555, \\ \sqrt{17} &\approx 4.12311, \\ \sqrt{5} &\approx 2.23607, \end{aligned} \]

which add up to about 9.9647. Adding the lengths rounded to four places, \({3.6056 + 4.1231 + 2.2361}\), gives 9.9648 instead: the three small rounding errors add up.

The robot drove almost twice as far as it ended up from its start.

3. ★★★ The arrow from \(P\) to \(Q\) is the same as the arrow from \(R\) to \(S\). Show that the arrow from \(P\) to \(R\) is then the same as the arrow from \(Q\) to \(S\), and draw the four points.

Show solution

Same arrow means same components, so for the first coordinates

\[ q_1 - p_1 = s_1 - r_1 . \]

Add \({r_1 - q_1}\) to both sides. On the left the two \(q_1\) terms cancel:

\[ \begin{aligned} &(q_1 - p_1) + (r_1 - q_1) \\ &\quad = r_1 - p_1 . \end{aligned} \]

On the right the two \(r_1\) terms cancel:

\[ \begin{aligned} &(s_1 - r_1) + (r_1 - q_1) \\ &\quad = s_1 - q_1 . \end{aligned} \]

So \({r_1 - p_1 = s_1 - q_1}\). The second coordinates work the same way, so the arrow from \(P\) to \(R\) equals the arrow from \(Q\) to \(S\). Unless all four points lie on one line, they are the corners of a parallelogram \(P, Q, S, R\), whose opposite sides are equal arrows. For example, \({P = (1, 2)}\), \({Q = (4, 6)}\), \({R = (2, 0)}\) and \({S = (5, 4)}\) give

\[ \begin{aligned} Q - P &= S - R = (3,\; 4), \\ R - P &= S - Q = (1,\; -2). \end{aligned} \]

Summary card

A vector is a move: a list of changes, drawn as an arrow that may start anywhere.

The anchor figure again: the green arrow v = (3, 4) from P = (1, 2) to Q = (4, 6) with its changes and length 5, and three copies of it starting at different points.
M01.2.4-F1

Same changes, same arrow, any start.

  • From \(P\) to \(Q\): \({\vect{v} = Q - P}\), tip minus tail.
  • Length: \({\norm{\vect{v}} = \sqrt{v_1^2 + v_2^2}}\), wherever the arrow starts.
  • A point: the arrow from the origin has the point’s coordinates.
  • Moves add: component by component, tip to tail. Lengths do not add.

Sources and next steps

Sources. Each was opened and checked against this lesson on 12 November 2026.

  • OpenStax, Calculus Volume 3, Section 2.1, “Vectors in the Plane”. Equivalent vectors have the same magnitude and direction; a vector with its initial point at the origin is a standard-position vector; the component form subtracts the initial point from the terminal point; the magnitude is \({\sqrt{x^2 + y^2}}\); and the triangle method places the initial point of the second vector at the terminal point of the first.
  • Grant Sanderson, Vectors, what even are they?, 3Blue1Brown, Linear Algebra, chapter 1. The coordinates of a vector as walking instructions, first along the x-axis and then parallel to the y-axis, and addition as one step followed by another.
  • Marc Peter Deisenroth, A. Aldo Faisal and Cheng Soon Ong, Mathematics for Machine Learning, Chapter 2, introduction: geometric vectors as directed segments that can be added, written in school with an arrow over the letter and in the book as a bold letter.
  • NumPy, numpy.linalg.norm: the 2-norm of a vector, its length.

Next. M02.1 Vectors as arrows and as data starts vectors again from the beginning, with scaling, the rules of addition and many components. Within this course, M01.3 turns pairs of numbers into graphs of functions.

This lesson unlocks

M01.3.1 A function is a machine M02.1.1 Vectors as arrows

Your progress is saved in this browser only. No account, no tracking.
Back to top