Skip to main content

Vectors as lists of numbers

Put an arrow’s tail at the origin and the coordinates of its tip pin it down. Learn to move between arrows and lists of numbers, to work with vectors in three and more dimensions where no picture exists, and to read a row of data as a vector.
M02.1.2L1 Core25 minIn review

Before this lesson

M02.1.1 Vectors as arrows

After this lesson you can

  • Write the coordinates of an arrow as tip minus tail, and draw the arrow that a pair of coordinates describes.
  • State when two lists of numbers are the same vector, and explain why the order of the entries matters.
  • Compute the length of a vector that has two, three or more coordinates.
  • Write a row of a data table as a vector and say what its dimension is.

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 computer cannot store an arrow. It can only store numbers. How many numbers does it take to pin an arrow down exactly? And what happens when the list of numbers grows longer than any arrow you could ever draw?

From the last lesson

1. When do two arrows represent the same vector?

Show answer

When they have the same length and the same direction. On a grid, that is exactly when they have the same run and the same rise.

2. An arrow goes from \((1, 1)\) to \((5, 4)\). What are its run, its rise and its length?

Show answer

Run \(= 5 - 1 = 4\), rise \(= 4 - 1 = 3\), and length \(= \sqrt{4^2 + 3^2} = 5\).

Intuition

Lesson M02.1.1 ended with a useful fact. Every vector of the plane has exactly one arrow whose tail is at the origin, and the tip of that arrow is the point (run, rise). So to store a vector, store the two numbers that say where that tip is. They are called the coordinates of the vector.

Two panels. The left panel, titled The arrow, shows a coordinate plane with a blue arrow labelled v from the origin to the point (4, 3). A dashed green line along the horizontal axis is labelled 4 across and a dashed green vertical line up to the tip is labelled 3 up. Notes read tail at the origin and tip at (4, 3). The right panel, titled The list of numbers, shows v equals a column of two numbers in square brackets, 4 above 3, with the word across beside the 4 and the word up beside the 3. Between the panels one arrow points right, labelled read the tip, and another points left, labelled draw the arrow. Underneath is written: in a sentence, v equals (4, 3).
M02.1.2-F1

The same vector, twice. On the left it is an arrow; on the right it is a list of two numbers. Reading the tip turns the arrow into the list, and drawing from the origin turns the list back into the arrow.

The translation works in both directions and loses nothing. Give me an arrow and I can tell you its two numbers. Give me two numbers and I can draw the arrow. That is why the two pictures of a vector, “an arrow” and “a list of numbers”, are used as if they were one.

The list has one great advantage over the arrow. It does not have to stop at two numbers.

Build it up

Step 1. From an arrow to numbers. Put the tail at the origin and read the tip. The vector in the figure is written \(\vect{v} = (4, 3)\) in a sentence. In a displayed equation it is written as a column:

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

The first coordinate says how far to go across, and the second says how far to go up.

Step 2. From numbers to an arrow. Take the list \((-2, 3)\). Start at the origin, go 2 to the left and 3 up, and mark the point. The arrow from the origin to that point is the vector. Order matters: \((3, -2)\) means 3 to the right and 2 down, which is a different arrow.

Step 3. Any tail will do: tip minus tail. An arrow does not have to start at the origin. For an arrow from \(P = (-1, 2)\) to \(Q = (3, -1)\), subtract the tail from the tip, one coordinate at a time:

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

These are the run and the rise of lesson M02.1.1 under their grown-up name. Since sliding an arrow does not change them, every arrow of the same vector gives the same coordinates.

Step 4. A third number. A drone can also climb. To describe a move in space we need a third axis, pointing up, and a third coordinate. The vector \(\vect{w} = (2, 6, 3)\) means: 2 along the \(x\) axis, 6 along the \(y\) axis and 3 up.

Two panels, each showing a box drawn in three-dimensional space with axes labelled x, y and z, and a blue arrow running from the origin at one corner of the box to the opposite corner. In the left panel, titled 2 along x, 6 along y, 3 up, a green path follows three edges of the box, labelled 2, 6 and 3, and the tip of the arrow is labelled (2, 6, 3). In the right panel, titled Pythagoras, twice, a purple line crosses the floor of the box from the origin to the point under the tip and is labelled floor: the square root of 2 squared plus 6 squared equals the square root of 40. A green vertical edge of height 3 rises from there to the tip, and the blue arrow is labelled the square root of 40 plus 3 squared equals 7. Small squares mark the two right angles.
M02.1.2-F2

A vector in space. Left: its three coordinates are a route along the edges of a box. Right: the length comes from Pythagoras’ theorem used twice, first across the floor and then up the wall.

Step 5. As many numbers as you like. Nothing stops us writing a list of four numbers, or four hundred. Such a list can no longer be drawn as an arrow, but it is still a perfectly good list. An estate agent might describe a house by its floor area in square metres, its bedrooms, its bathrooms and its age in years:

\[ \vect{h} = (120,\; 3,\; 2,\; 25) . \]

That is a vector with four coordinates. A small grey photograph of 28 by 28 pixels, with one brightness number for each pixel, is a vector with \(28 \times 28 = 784\) coordinates. This is how data reaches a machine-learning model: as vectors. Lesson M02.1.4 is all about it.

The formal statement

NoteDefinition: vector in \(\R^n\)

Let \(n\) be a whole number, at least 1. A vector in \(\R^n\) is an ordered list of \(n\) real numbers,

\[ \vect{v} = (v_1, v_2, \dots, v_n) . \]

The numbers \(v_1, \dots, v_n\) are its coordinates (also called its components or entries), and \(n\) is its dimension. \(\R^n\) is the set of all such lists. Two vectors are equal when they have the same number of coordinates and the same coordinates in the same order.

So \(\R^2\) is the set of all pairs of numbers and \(\R^3\) the set of all triples. The coordinate \(v_i\) is an ordinary number, so it is written in italics, not bold. In maths the first coordinate is \(v_1\). In Python it is v[0].

Result 1: arrows and pairs of numbers match one to one. Give the arrow from \(P\) to \(Q\) the coordinates \((q_1 - p_1,\; q_2 - p_2)\). Lesson M02.1.1 proved two things about this pair. Two arrows are the same vector exactly when they give the same pair (its Result 3). And every pair \((a, b)\) belongs to some arrow, the one from the origin to the point \((a, b)\) (its Result 4). So each vector of the plane has one pair of coordinates and each pair of coordinates has one vector. “Same coordinates in the same order” means the same as “same length and same direction”. The vectors of the plane are \(\R^2\), and in the same way the vectors of space are \(\R^3\).

Result 2: the length of a vector in space. For \(\vect{v} = (v_1, v_2, v_3)\),

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

Why. Put the tail at the origin \(O\), so the tip is the point \(T = (v_1, v_2, v_3)\). Let \(A = (v_1, v_2, 0)\) be the point on the floor directly under the tip. Two right-angled triangles do the work, as in the figure.

On the floor, walk from \(O\) to \((v_1, 0, 0)\) and then to \(A\). The two legs have lengths \(\abs{v_1}\) and \(\abs{v_2}\) and meet at a right angle, so by Pythagoras’ theorem

\[ (\text{distance } O \text{ to } A)^2 = v_1^2 + v_2^2 . \]

Now look at the triangle \(O\), \(A\), \(T\). The side from \(A\) to \(T\) is vertical, with length \(\abs{v_3}\), and the side from \(O\) to \(A\) lies flat on the floor, so they meet at a right angle. The arrow from \(O\) to \(T\) is the side opposite that angle. Pythagoras’ theorem again gives

\[ \begin{aligned} \norm{\vect{v}}^2 &= (\text{distance } O \text{ to } A)^2 + v_3^2 \\ &= v_1^2 + v_2^2 + v_3^2 . \end{aligned} \]

Take the square root.

NoteDefinition: length in \(\R^n\)

The length of \(\vect{v} = (v_1, \dots, v_n)\) is

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

For \(n = 2\) this is Result 1 of lesson M02.1.1, and for \(n = 3\) it is Result 2 above: in both cases it is the length of the arrow. For \(n = 4\) and beyond there is no arrow to measure, so the formula is taken as the meaning of length. Module M02.3 studies it under the name norm.

The zero vector. In \(\R^n\) the zero vector is the list of \(n\) zeros, \(\vect{0} = (0, 0, \dots, 0)\). Its length is \(\sqrt{0 + \dots + 0} = 0\). There is one zero vector for each \(n\): the lists \((0, 0)\) and \((0, 0, 0)\) are different objects, even though both are written \(\vect{0}\).

Go deeper: is a point the same thing as a vector?

Both are lists of numbers, so on paper they look identical. The difference is in how the list is read. A point is a place. A vector is a move. The list \((4, 3)\) can be read as “the place 4 across and 3 up” or as “the move 4 across and 3 up”, and the arrow from the origin connects the two readings: making the move from the origin lands you at the place.

There is a real difference underneath. Choose a new origin and the coordinates of every place change. The coordinates of a move from \(P\) to \(Q\) do not, because they are \(Q\) minus \(P\) and both points shift by the same amounts. That is Result 2 of lesson M02.1.1. In practice we switch between the two readings freely, and when a picture holds many vectors we often draw only the dots at their tips.

Worked example

(a) Find the coordinates and the length of the arrow from \(P = (-1, 2)\) to \(Q = (3, -1)\).

Two panels. On the left, a coordinate plane with a blue arrow from the point P at (minus 1, 2) to the point Q at (3, minus 1). A dashed green horizontal line from P is labelled 3 minus minus 1 equals 4, and a dashed green vertical line down to Q is labelled minus 1 minus 2 equals minus 3. A dashed blue arrow from the origin to (4, minus 3) is labelled the same vector, from the origin. On the right, four boxes are stacked: tip Q equals (3, minus 1); tail P equals (minus 1, 2); then a green arrow labelled tip minus tail leading to a yellow box, v equals (4, minus 3); then a green arrow labelled Pythagoras leading to a box, length equals the square root of 16 plus 9 equals 5.
M02.1.2-F3

From two points to a vector, then to its length. The dashed arrow is the same vector with its tail at the origin, where its tip shows the coordinates \((4, -3)\).

Tip minus tail: \(\vect{v} = \big(3 - (-1),\; -1 - 2\big) = (4, -3)\). The length is \(\norm{\vect{v}} = \sqrt{4^2 + (-3)^2} = \sqrt{16 + 9} = \sqrt{25} = 5\).

(b) The vector \((-2, 3)\) is drawn with its tail at \((4, 1)\). Where is its tip? Call the tip \((q_1, q_2)\). Tip minus tail must give the vector, so \(q_1 - 4 = -2\) and \(q_2 - 1 = 3\). Hence \(q_1 = 2\) and \(q_2 = 4\): the tip is at \((2, 4)\).

(c) Find the length of \(\vect{w} = (2, 6, 3)\). By Result 2, \(\norm{\vect{w}} = \sqrt{2^2 + 6^2 + 3^2} = \sqrt{4 + 36 + 9} = \sqrt{49} = 7\). The figure in the last section shows the two steps: \(\sqrt{40}\) across the floor, then \(\sqrt{40 + 9} = 7\).

(d) Find the length of \((1, 1, 1, 1)\). There is no arrow to look at, but the definition still works: \(\sqrt{1 + 1 + 1 + 1} = \sqrt{4} = 2\).

(e) Which of these are equal: \((2, 6, 3)\), \((6, 2, 3)\) and \((2, 6, 3, 0)\)? None. The first two hold the same numbers in a different order. The third has four coordinates, so it lives in \(\R^4\) and cannot equal a vector in \(\R^3\).

Code

From scratch, a vector is a tuple, and both functions work for any number of coordinates.

import math

def coordinates(tail, tip):
    """Tip minus tail, one coordinate at a time."""
    return tuple(q - p for p, q in zip(tail, tip))

def length(v):
    return math.sqrt(sum(x ** 2 for x in v))

v = coordinates((-1, 2), (3, -1))
w = (2, 6, 3)
print(v, length(v))
print(w, length(w))
print(length((1, 1, 1, 1)))
print((2, 6, 3) == (6, 2, 3), (2, 6, 3) == (2, 6, 3, 0))
(4, -3) 5.0
(2, 6, 3) 7.0
2.0
False False

The answers match parts (a), (c), (d) and (e). In NumPy a vector is a one-dimensional array.

import numpy as np

w = np.array([2, 6, 3])
print("first coordinate:", w[0], " number of coordinates:", len(w), " length:", np.linalg.norm(w))

h = np.array([120, 3, 2, 25])  # the house: area, bedrooms, bathrooms, age
print("shape:", h.shape, " ndim:", h.ndim)
first coordinate: 2  number of coordinates: 3  length: 7.0
shape: (4,)  ndim: 1

Read that output slowly, because three words collide in it. w[0] is the coordinate that maths calls \(w_1\). len(w) is 3, the number of coordinates, while the length \(\norm{\vect{w}}\) is 7 and comes from np.linalg.norm. And h.ndim is 1 although \(\vect{h}\) is a vector in \(\R^4\). The pitfalls below untangle the last two.

Explore

This module’s interactive, the vector playground, lives in lesson M02.1.3. Drag the tip of an arrow there and watch its two coordinates change as you move.

Pitfalls

Two panels, each showing a blue arrow from the point (4, 1) to the point (2, 4) on a coordinate plane. The left panel, marked with a cross and titled Reading the tip alone, also shows a vermillion arrow from the origin to (2, 4), with the note: (2, 4) is this arrow instead. It is longer than the blue arrow and leans the other way. The right panel, marked with a tick and titled Tip minus tail, shows dashed green lines for the run, labelled 2 minus 4 equals minus 2, and the rise, labelled 4 minus 1 equals 3, and a dashed green arrow from the origin to (minus 2, 3), parallel to the blue arrow and of equal length, with the note the same vector.
M02.1.2-F4

Wrong beside right. The tip of this arrow is at \((2, 4)\), but the vector is not \((2, 4)\). Its coordinates are tip minus tail, \((-2, 3)\).

“The coordinates of an arrow are the coordinates of its tip.”

Only when the tail is at the origin. The arrow from \((4, 1)\) to \((2, 4)\) has coordinates \((2 - 4,\; 4 - 1) = (-2, 3)\). The list \((2, 4)\) is a different vector, longer and leaning the other way. When in doubt, subtract: tip minus tail.

“\((2, 3)\) and \((3, 2)\) hold the same numbers, so they are the same vector.”

A vector is an ordered list. \((2, 3)\) goes 2 across and 3 up; \((3, 2)\) goes 3 across and 2 up. In data the mistake is costlier: a house stored as (bedrooms, area) and one stored as (area, bedrooms) cannot be compared until one of them is reordered.

“len(v) gives the length of the vector.”

The word length has two meanings. In Python, len(v) counts the entries of a list. In geometry, the length \(\norm{\vect{v}}\) is how long the arrow is. For \(\vect{w} = (2, 6, 3)\) the first is 3 and the second is 7. Use np.linalg.norm for the second.

“A vector in \(\R^4\) is a four-dimensional array.”

The word dimension has two meanings as well. The dimension of a vector is how many coordinates it has. NumPy’s ndim counts something else: how many indices are needed to pick out one number. A vector needs one index, so its ndim is 1 however long it is. Mixing the two up is behind many “shape mismatch” errors in machine-learning code.

Check yourself

Recall

1. What do the two coordinates of a vector of the plane say?

Show answer

How far to go across and how far to go up. With the tail at the origin, they are the coordinates of the tip.

2. How do you find the coordinates of the arrow from \(P\) to \(Q\)?

Show answer

Tip minus tail, one coordinate at a time: \((q_1 - p_1,\; q_2 - p_2)\).

3. When are two vectors in \(\R^n\) equal?

Show answer

When they have the same number of coordinates and the same coordinates in the same order.

4. What is the length of \(\vect{v} = (v_1, v_2, v_3)\)?

Show answer

\(\norm{\vect{v}} = \sqrt{v_1^2 + v_2^2 + v_3^2}\), from Pythagoras’ theorem used twice.

5. What is \(\R^n\), and what is the dimension of the house vector \((120, 3, 2, 25)\)?

Show answer

\(\R^n\) is the set of all ordered lists of \(n\) real numbers. The house vector has four coordinates, so its dimension is 4 and it lives in \(\R^4\).

Exercises

1. ★ Find the coordinates and the length of the arrow from \((2, 5)\) to \((-1, 1)\).

Show solution

Tip minus tail: \((-1 - 2,\; 1 - 5) = (-3, -4)\). Length \(= \sqrt{(-3)^2 + (-4)^2} = \sqrt{9 + 16} = 5\).

2. ★★ (a) The vector \((3, -2)\) is drawn with its tip at \((1, 1)\). Where is its tail? (b) Find the length of \((4, 4, 7)\).

Show solution

(a) Call the tail \((p_1, p_2)\). Tip minus tail gives the vector, so \(1 - p_1 = 3\) and \(1 - p_2 = -2\). Hence \(p_1 = -2\) and \(p_2 = 3\): the tail is at \((-2, 3)\).

(b) \(\sqrt{4^2 + 4^2 + 7^2} = \sqrt{16 + 16 + 49} = \sqrt{81} = 9\).

3. ★★★ (a) Show that the vector in \(\R^n\) whose coordinates are all 1 has length \(\sqrt{n}\). (b) Find every number \(t\) for which the vector \((t, 2t, 2t)\) has length 6.

Show solution

(a) By the definition of length, \(\sqrt{1^2 + 1^2 + \dots + 1^2}\) with \(n\) terms under the root, which is \(\sqrt{n}\). For \(n = 4\) this is the 2 of part (d) of the worked example.

(b) The length is \(\sqrt{t^2 + (2t)^2 + (2t)^2} = \sqrt{t^2 + 4t^2 + 4t^2} = \sqrt{9t^2} = 3\abs{t}\). Setting \(3\abs{t} = 6\) gives \(\abs{t} = 2\), so \(t = 2\) or \(t = -2\). The two vectors are \((2, 4, 4)\) and \((-2, -4, -4)\).

Summary card

A vector is an ordered list of numbers: with the tail at the origin, the list is where the tip is.

The anchor figure again: on the left a blue arrow from the origin to the point (4, 3), with 4 across and 3 up marked; on the right the same vector written as a column with 4 above 3, and arrows between the panels labelled read the tip and draw the arrow.
M02.1.2-F1

An arrow and its list.

  • Coordinates of an arrow. Tip minus tail: \((q_1 - p_1,\; q_2 - p_2)\).
  • \(\R^n\). All ordered lists of \(n\) real numbers. Equal means same entries in the same order.
  • Length. \(\norm{\vect{v}} = \sqrt{v_1^2 + v_2^2 + \dots + v_n^2}\).
  • Zero vector. \(\vect{0} = (0, \dots, 0)\), one for each \(n\).
  • In code. \(v_1\) is v[0]; len(v) counts entries; np.linalg.norm(v) is the length.

Sources and next steps

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

  • Sheldon Axler, Linear Algebra Done Right, 4th edition (open access), Section 1A. Definition 1.8: two lists are equal when they have the same length and the same elements in the same order. Definition 1.11: the set of all lists of length \(n\), and the word coordinate. It also remarks that for \(n \ge 4\) the space cannot be visualised, yet its elements are as rigorously defined as those of the plane.
  • Stephen Boyd and Lieven Vandenberghe, Introduction to Applied Linear Algebra: Vectors, Matrices, and Least Squares (free PDF), Section 1.1. A vector as an ordered finite list of numbers; entries, size or dimension; equality entry by entry; the warning that maths indexes from 1 while many programming languages index from 0; and the feature vector as an example.
  • Grant Sanderson, Vectors, what even are they?, 3Blue1Brown, Linear Algebra, chapter 1. Coordinates as instructions for getting from the tail, at the origin, to the tip, written as a column in square brackets.
  • OpenStax, Calculus Volume 3, Section 2.2, Vectors in Three Dimensions (open access). Theorem 2.2, the distance between two points in space, and the magnitude of a vector in space, \(\sqrt{x^2 + y^2 + z^2}\).
  • NumPy reference, numpy.ndarray.ndim and numpy.linalg.norm. ndim is the number of array dimensions, and norm with its default arguments returns the 2-norm of a one-dimensional array.

Next. M02.1.3 Adding and scaling vectors introduces the two operations that make lists of numbers into something more than lists.

This lesson unlocks

M02.1.3 Adding and scaling vectors

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