Skip to main content

Coordinates depend on the basis

The numbers that name a vector are a recipe written for one particular grid. Learn to read the same arrow on a second grid, find its new coordinates by solving two small equations, and see why no single list of numbers is the vector itself.
M02.9.1L1 Core25 minIn review

Before this lesson

M02.2 Linear combinations, span and basis M02.6 Linear systems and elimination

After this lesson you can

  • Explain why the coordinates of a vector are weights on a chosen basis, so that one arrow has different coordinates in different bases.
  • Read the coordinates of a vector off a slanted grid by sliding along its grid lines.
  • Find the coordinates of a vector in a new basis of the plane by solving two equations in two unknowns.
  • Show that taking coordinates respects adding and scaling.

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 camera records a photo as one brightness number for each pixel. A JPEG file holds the same photo as a quite different list of numbers, many of them small enough to throw away. The picture has not changed. What changed is the set of building blocks that the numbers count. So what does a list such as \((1, 5)\) really say about a vector, and how do you rewrite it for a different set of building blocks?

Intuition

The pair \((1, 5)\) is a set of instructions: take 1 step of \(\ihat\), then 5 steps of \(\jhat\). The numbers are the weights in a linear combination, \(1\,\ihat + 5\,\jhat\), and the arrow you end up with is the vector.

Nothing forces us to step along \(\ihat\) and \(\jhat\). Lesson M02.2.4 tried it once: counted in steps of \((1, -1)\) and \((1, 2)\), the point \((5, 1)\) had the coordinates \((3, 2)\). This module turns that one example into a method. Take a fresh pair of building blocks,

\[ \vect{b}_1 = (1, 2), \qquad \vect{b}_2 = (-1, 1). \]

They do not lie along one line, so they form a basis of the plane (lesson M02.2.4): every arrow can be reached by stepping along them, in exactly one way. Their whole-number combinations draw a slanted grid. Lay that grid under the same arrow and count again.

Two panels showing the same black arrow v from the origin to the point 1 across and 5 up. Left panel, titled Standard grid: (1, 5), has a blue square grid with short blue arrows i-hat and j-hat, and a blue dashed route of 1 step of i-hat then 5 steps of j-hat that ends at the tip of v. Right panel, titled New grid: (2, 1), has an orange slanted grid with orange arrows b1 pointing up and to the right and b2 pointing up and to the left, and an orange dashed route of 2 steps of b1 then 1 step of b2 that ends at the same tip. Underneath, an equation reads v equals 1 i-hat plus 5 j-hat equals 2 b1 plus 1 b2.
M02.9.1-F1

One arrow, two addresses. On the standard grid the arrow \(\vect{v}\) is \((1, 5)\). On the grid of \(\vect{b}_1\) and \(\vect{b}_2\) the same arrow is \((2, 1)\): two steps of \(\vect{b}_1\), then one of \(\vect{b}_2\).

The arrow did not move between the two panels. Only its description changed. Coordinates are not the vector. They are a recipe for the vector, written for one particular basis. Throughout this module, blue marks the standard basis and everything counted on it, and orange marks the new basis and everything counted on that.

Build it up

Step 1. Standard coordinates are weights. Writing \(\vect{v} = (1, 5)\) is short for \(\vect{v} = 1\,\ihat + 5\,\jhat\). The basis is so familiar that we stop mentioning it.

Step 2. A second basis draws a second grid. Call the new basis \(B\): the list \(\vect{b}_1, \vect{b}_2\), in that order. One family of its grid lines runs along \(\vect{b}_1\), the other along \(\vect{b}_2\), and each cell is a copy of the parallelogram the two arrows span.

Step 3. New coordinates are the new weights. The coordinates of \(\vect{v}\) in the basis \(B\) are the two numbers \(c_1, c_2\) with \(\vect{v} = c_1\vect{b}_1 + c_2\vect{b}_2\). We write them as \([\vect{v}]_B = (c_1, c_2)\). The figure shows \([\vect{v}]_B = (2, 1)\).

Step 4. Read them by sliding along the grid. From the tip of the arrow, slide along the \(\vect{b}_2\) grid line until you meet the line through \(\vect{b}_1\). How far along that line you land, counted in copies of \(\vect{b}_1\), is \(c_1\). Sliding the other way gives \(c_2\).

Step 5. Coordinates can be negative or fractions. A negative coordinate means stepping against a basis vector. A fraction means part of a step.

Two panels on the same orange slanted grid with basis arrows b1 and b2. Left panel, titled A negative coordinate: a black arrow w ends at the point 2 across and 1 up. An orange dashed route goes one step along b1 and then one step against b2, and the label reads w in basis B equals (1, minus 1). Right panel, titled Fractional coordinates: a short black arrow u points straight up to height one and a half. The route goes half a step along b1 and then half a step along b2, and the label reads u in basis B equals (one half, one half).
M02.9.1-F2

The arrow \(\vect{w} = (2, 1)\) needs one step of \(\vect{b}_1\) and one step against \(\vect{b}_2\), so \([\vect{w}]_B = (1, -1)\). The arrow \(\vect{u} = (0, 1.5)\) needs half a step of each.

Step 6. One direction is easy, the other is a puzzle. Given new coordinates, finding the arrow is plain arithmetic: \(2\,\vect{b}_1 + 1\,\vect{b}_2 = (2, 4) + (-1, 1) = (1, 5)\). Given the arrow, finding its new coordinates means asking which weights work. That is a small linear system, the kind module M02.6 taught you to solve.

The formal statement

NoteDefinition: coordinates in a basis

Let \(B\) be a basis \(\vect{b}_1, \dots, \vect{b}_n\) of \(\R^n\), listed in a fixed order. The coordinates of \(\vect{v}\) in \(B\) are the numbers \(c_1, \dots, c_n\) for which

\[ \vect{v} = c_1\vect{b}_1 + \cdots + c_n\vect{b}_n . \]

The list \([\vect{v}]_B = (c_1, \dots, c_n)\) is the coordinate vector of \(\vect{v}\) in \(B\).

The definition says “the numbers”, and that needs two facts. Such numbers exist, because a basis spans the space. They are the only ones, because a basis is independent: lesson M02.2.4 proved that two different recipes for one vector would give a non-trivial combination equal to \(\vect{0}\).

The ordinary coordinates are the special case where \(B\) is the standard basis, since \((x, y) = x\,\ihat + y\,\jhat\).

Finding the coordinates in the plane. Let \(\vect{b}_1 = (p, r)\), \(\vect{b}_2 = (q, s)\) and \(\vect{v} = (x, y)\). The equation \(c_1\vect{b}_1 + c_2\vect{b}_2 = \vect{v}\), read one coordinate at a time, is two equations:

\[ \begin{aligned} p\,c_1 + q\,c_2 &= x, \\ r\,c_1 + s\,c_2 &= y. \end{aligned} \]

To remove \(c_2\), multiply the first equation by \(s\) and the second by \(q\), then subtract the second from the first:

\[ (ps - qr)\,c_1 = s\,x - q\,y . \]

To remove \(c_1\), multiply the first equation by \(r\) and the second by \(p\), then subtract the first from the second:

\[ (ps - qr)\,c_2 = p\,y - r\,x . \]

Dividing both by \({ps - qr}\) gives

\[ \cparam{c_1} = \frac{s\,\cdata{x} - q\,\cdata{y}}{ps - qr}, \qquad \cparam{c_2} = \frac{p\,\cdata{y} - r\,\cdata{x}}{ps - qr}. \]

The new coordinates come out of the standard ones. The number \({ps - qr}\) is the determinant of module M02.8: apart from its sign, the area of one cell of the new grid. It is zero exactly when \(\vect{b}_1\) and \(\vect{b}_2\) lie along one line, and then they are not a basis and there is nothing to divide by.

Taking coordinates respects adding and scaling. Suppose \([\vect{u}]_B = (a_1, a_2)\) and \([\vect{v}]_B = (c_1, c_2)\). Then

\[ \begin{aligned} &\vect{u} + \vect{v} \\ &\quad= (a_1\vect{b}_1 + a_2\vect{b}_2) + (c_1\vect{b}_1 + c_2\vect{b}_2) \\ &\quad= (a_1 + c_1)\,\vect{b}_1 + (a_2 + c_2)\,\vect{b}_2 . \end{aligned} \]

That is a recipe for \(\vect{u} + \vect{v}\) in the basis \(B\), and recipes are unique, so \({[\vect{u} + \vect{v}]_B} = [\vect{u}]_B + [\vect{v}]_B\). In the same way, \(k\vect{v} = (kc_1)\vect{b}_1 + (kc_2)\vect{b}_2\), so \([k\vect{v}]_B = k\,[\vect{v}]_B\). These are the two rules of a linear map (lesson M02.4.1). So passing from a vector to its coordinates is a linear map, and the next lesson finds its matrix.

Worked example

Find the coordinates of \(\vect{v} = (1, 5)\) in the basis \(\vect{b}_1 = (1, 2)\), \(\vect{b}_2 = (-1, 1)\).

A flow diagram of seven boxes. The top box holds the vector equation c1 times (1, 2) plus c2 times (minus 1, 1) equals (1, 5). Two arrows labelled first coordinates and second coordinates lead down to two orange boxes: c1 minus c2 equals 1, and 2 c1 plus c2 equals 5. A green arrow labelled add leads to a third orange box, 3 c1 equals 6. A green arrow labelled divide by 3, then 2 minus c2 equals 1, leads down to a box c1 equals 2, c2 equals 1. From there an arrow leads left to a yellow box, v in basis B equals (2, 1), labelled the new coordinates, and on to a green box, 2 times (1, 2) plus 1 times (minus 1, 1), labelled check: it is (1, 5).
M02.9.1-F3

The whole calculation. One vector equation becomes two ordinary equations, adding them removes \(c_2\), and the answer is checked by rebuilding the arrow.

We need \(c_1(1, 2) + c_2(-1, 1) = (1, 5)\). The first coordinates give \(c_1 - c_2 = 1\). The second coordinates give \(2c_1 + c_2 = 5\).

Add the two equations. The \(c_2\) terms cancel:

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

Put \(c_1 = 2\) into the first equation: \(2 - c_2 = 1\), so \(c_2 = 1\). Therefore \([\vect{v}]_B = (2, 1)\).

Check by rebuilding the arrow: \(2\,(1, 2) + 1\,(-1, 1) = {(2 - 1,\; 4 + 1)} = (1, 5)\).

The same answer from the formulas. Here \(p = 1\), \(r = 2\), \(q = -1\), \(s = 1\), so \({ps - qr} = {1 \cdot 1} - {(-1) \cdot 2} = 3\). Then

\[ \begin{aligned} c_1 &= \frac{1 \cdot 1 - (-1) \cdot 5}{3} = \frac{6}{3} = 2, \\[4pt] c_2 &= \frac{1 \cdot 5 - 2 \cdot 1}{3} = \frac{3}{3} = 1 . \end{aligned} \]

A second vector. For \(\vect{w} = (2, 1)\) the formulas give \(c_1 = \frac{1 \cdot 2 - (-1) \cdot 1}{3} = 1\) and \(c_2 = \frac{1 \cdot 1 - 2 \cdot 2}{3} = -1\), so \([\vect{w}]_B = (1, -1)\), as in the figure above.

Adding survives. The sum \(\vect{v} + \vect{w} = (3, 6)\) should have coordinates \((2, 1) + (1, -1) = (3, 0)\). It does: \(3\,\vect{b}_1 + 0\,\vect{b}_2 = (3, 6)\).

An old example, by the formulas. Lesson M02.2.4 found that \((5, 1)\) has the coordinates \((3, 2)\) in the basis \((1, -1), (1, 2)\). There \(p = 1\), \(r = -1\), \(q = 1\), \(s = 2\), so \({ps - qr} = {1 \cdot 2} - {1 \cdot (-1)} = 3\), and the formulas agree: \(c_1 = \frac{2 \cdot 5 - 1 \cdot 1}{3} = 3\) and \(c_2 = \frac{1 \cdot 1 - (-1) \cdot 5}{3} = 2\).

Code

First from scratch: the two formulas, nothing else.

def coordinates(b1, b2, v):
    """The weights (c1, c2) with c1*b1 + c2*b2 == v, from the two formulas."""
    (p, r), (q, s), (x, y) = b1, b2, v
    cell = p * s - q * r              # zero exactly when b1, b2 are parallel
    if cell == 0:
        raise ValueError("b1 and b2 lie along one line: not a basis")
    return ((s * x - q * y) / cell, (p * y - r * x) / cell)

b1, b2 = (1, 2), (-1, 1)
vectors = [("v", (1, 5)), ("w", (2, 1)), ("u", (0, 1.5)), ("v + w", (3, 6))]
for name, vec in vectors:
    print(f"{name:5} = {vec}  has coordinates {coordinates(b1, b2, vec)} in B")
v     = (1, 5)  has coordinates (2.0, 1.0) in B
w     = (2, 1)  has coordinates (1.0, -1.0) in B
u     = (0, 1.5)  has coordinates (0.5, 0.5) in B
v + w = (3, 6)  has coordinates (3.0, 0.0) in B

Now the library version. Put the basis vectors side by side as the columns of an array and ask NumPy to solve the system.

import numpy as np

B = np.column_stack([b1, b2])         # columns are b1 and b2
v = np.array([1.0, 5.0])
c = np.linalg.solve(B, v)             # solves  c[0]*b1 + c[1]*b2 = v
print("coordinates of v in B:", c)
print("rebuilt from them:    ", c[0] * B[:, 0] + c[1] * B[:, 1])
coordinates of v in B: [2. 1.]
rebuilt from them:     [1. 5.]

np.linalg.solve does by elimination what the worked example did by hand. The hidden cell after it checks, on a hundred random vectors, that coordinates add and scale as the formal section proved.

Explore

This module’s interactive, the two-grid viewer, lives in the next lesson. There you can drag the arrow and the two basis vectors and watch both sets of coordinates change.

Pitfalls

Two panels on the same orange slanted grid with the black arrow v. Left panel, marked with a cross and titled Dropping perpendiculars: dashed vermillion lines run from the tip of v at right angles to the lines through b1 and b2, meeting them at 2.2 and at 2. A dotted route that follows those two numbers ends at a hollow dot above and to the left of the tip of v, labelled (2.2, 2) lands here. Right panel, marked with a tick and titled Sliding along the grid: dashed green lines run from the tip of v parallel to the grid lines and meet the two lines at 2 and at 1, with the note (2, 1) leads back to v.
M02.9.1-F4

Wrong beside right. On a slanted grid, dropping perpendiculars gives numbers that do not rebuild the arrow. Sliding along the grid lines gives the coordinates.

“To read a coordinate, drop a perpendicular onto the axis.”

That works on the standard grid only because its axes are perpendicular. On the grid of \(\vect{b}_1, \vect{b}_2\) the perpendiculars from \(\vect{v}\) land at \(2.2\) and \(2\), and \(2.2\,\vect{b}_1 + 2\,\vect{b}_2 = (0.2, 6.4)\), which is not \(\vect{v}\). Slide parallel to the other basis vector instead. The shortcut is safe only when the basis vectors are perpendicular to each other, and module M02.10 shows why it works then.

“The vector is its list of numbers.”

The numbers mean nothing until you say which basis they count. The pair \((2, 1)\) names the arrow \((2, 1)\) on the standard grid and the arrow \((1, 5)\) on the grid of \(B\). This matters throughout machine learning: the features of a data set are coordinates in a basis that somebody chose, and methods such as principal component analysis start by choosing a better one.

“In the basis \(B\), the vector \(\vect{b}_1\) still has coordinates \((1, 2)\).”

\((1, 2)\) is its standard address. In its own basis, \(\vect{b}_1 = 1\,\vect{b}_1 + 0\,\vect{b}_2\), so \([\vect{b}_1]_B = (1, 0)\), and likewise \([\vect{b}_2]_B = (0, 1)\). Every basis looks like the standard basis to itself.

Check yourself

Recall

1. What do the coordinates of a vector in a basis \(B\) tell you?

Show answer

The weights of the one linear combination of the basis vectors that equals the vector: \([\vect{v}]_B = (c_1, c_2)\) means \(\vect{v} = c_1\vect{b}_1 + c_2\vect{b}_2\).

2. Why does every vector have exactly one set of coordinates in a basis?

Show answer

A basis spans the space, so at least one recipe exists. A basis is independent, so two different recipes for one vector are impossible.

3. On a slanted grid, how do you read the \(\vect{b}_1\) coordinate of an arrow from the picture?

Show answer

Slide from the tip parallel to \(\vect{b}_2\) until you meet the line through \(\vect{b}_1\), then count how many copies of \(\vect{b}_1\) reach that point. Do not drop a perpendicular.

4. What are the coordinates of \(\vect{b}_2\) in the basis \(\vect{b}_1, \vect{b}_2\)?

Show answer

\((0, 1)\), because \(\vect{b}_2 = 0\,\vect{b}_1 + 1\,\vect{b}_2\).

5. Which direction needs a system of equations: from new coordinates to the arrow, or from the arrow to new coordinates?

Show answer

From the arrow to its new coordinates. The other direction is just computing \(c_1\vect{b}_1 + c_2\vect{b}_2\).

Exercises

1. ★ Find the coordinates of \((3, 3)\) in the basis \(\vect{b}_1 = (1, 2)\), \(\vect{b}_2 = (-1, 1)\), and check your answer.

Show solution

The equations are \(c_1 - c_2 = 3\) and \(2c_1 + c_2 = 3\). Adding them gives \(3c_1 = 6\), so \(c_1 = 2\), and then \(2 - c_2 = 3\) gives \(c_2 = -1\). The coordinates are \((2, -1)\). Check: \(2\,(1, 2) - 1\,(-1, 1) = {(2 + 1,\; 4 - 1)} = (3, 3)\).

2. ★★ A vector has \([\vect{x}]_B = (-1, 2)\) in the same basis \(B\). (a) What is \(\vect{x}\) in standard coordinates? (b) What are its coordinates if the basis vectors are listed in the other order, \(\vect{b}_2, \vect{b}_1\)? (c) What are they in the basis \(2\vect{b}_1, \vect{b}_2\)?

Show solution

(a) \(\vect{x} = -1\,(1, 2) + 2\,(-1, 1) = {(-1 - 2,\; -2 + 2)} = (-3, 0)\).

(b) The recipe is the same, \(\vect{x} = 2\,\vect{b}_2 + (-1)\,\vect{b}_1\), but the weights are now listed in the new order: \((2, -1)\). This is why a basis is an ordered list.

(c) Write \(-1\,\vect{b}_1\) as \(-\tfrac12\,(2\vect{b}_1)\). Then \(\vect{x} = -\tfrac12\,(2\vect{b}_1) + 2\,\vect{b}_2\), so the coordinates are \((-\tfrac12, 2)\). Doubling a basis vector halves the coordinate that counts it.

3. ★★★ Let \(\vect{b}_1, \vect{b}_2\) be any basis of the plane and let \([\vect{v}]_B = (c_1, c_2)\). Show that \(\vect{b}_1 + \vect{b}_2,\ \vect{b}_2\) is also a basis, and that the coordinates of \(\vect{v}\) in it are \({(c_1,\; c_2 - c_1)}\).

Show solution

It is a basis. Two vectors form a basis of the plane when they are independent. Suppose \(\alpha{(\vect{b}_1 + \vect{b}_2)} + \beta\,\vect{b}_2 = \vect{0}\). Regrouping, \(\alpha\,\vect{b}_1 + {(\alpha + \beta)}\,\vect{b}_2 = \vect{0}\). Because \(\vect{b}_1, \vect{b}_2\) are independent, \(\alpha = 0\) and \(\alpha + \beta = 0\), so \(\beta = 0\) too. Only the trivial combination gives zero.

The coordinates. Start from the old recipe and regroup:

\[ \begin{aligned} \vect{v} &= c_1\vect{b}_1 + c_2\vect{b}_2 \\ &= c_1(\vect{b}_1 + \vect{b}_2) + (c_2 - c_1)\,\vect{b}_2 . \end{aligned} \]

The right-hand side is a recipe in the new basis, and recipes are unique, so the coordinates are \({(c_1,\; c_2 - c_1)}\). With this lesson’s numbers, \((2, 1)\) becomes \((2, -1)\), and indeed \(2\,(0, 3) - 1\,(-1, 1) = (1, 5)\).

Summary card

Coordinates are a recipe for a vector, written for one basis.

The anchor figure again: the same black arrow on a blue standard grid, where it is (1, 5), and on an orange slanted grid of b1 and b2, where it is (2, 1).
M02.9.1-F1

One arrow, two addresses.

  • Definition. \([\vect{v}]_B = (c_1, c_2)\) means \(\vect{v} = c_1\vect{b}_1 + c_2\vect{b}_2\).
  • Finding them. Solve \(c_1\vect{b}_1 + c_2\vect{b}_2 = \vect{v}\): two equations, two unknowns.
  • In the plane. With \(\vect{b}_1 = (p, r)\), \(\vect{b}_2 = (q, s)\): \(c_1 = \dfrac{sx - qy}{ps - qr}\), \(c_2 = \dfrac{py - rx}{ps - qr}\).
  • Linear. \({[\vect{u} + \vect{v}]_B} = [\vect{u}]_B + [\vect{v}]_B\) and \([k\vect{v}]_B = k\,[\vect{v}]_B\).

Sources and next steps

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

  • Dan Margalit and Joseph Rabinoff, Interactive Linear Algebra, Section 2.8, Bases as Coordinate Systems (open textbook, Georgia Tech). It states that a vector is a combination of basis vectors in exactly one way, defines the \(B\)-coordinates and the notation \([\vect{x}]_B\) used here, and finds them by solving the vector equation.
  • Grant Sanderson, Change of basis, 3Blue1Brown, Linear Algebra, chapter 13. The source of the two-grids picture: a second person whose basis vectors are \((2, 1)\) and \((-1, 1)\) describes the same vectors with different numbers.
  • Gilbert Strang, Change of basis; image compression, MIT OpenCourseWare 18.06SC, lecture 31. The lecture summary describes JPEG compression as a change from the pixel basis to a basis of cosines on blocks of 8 by 8 pixels, after which many coefficients are small enough to drop.
  • NumPy reference, numpy.linalg.solve. Solves a full-rank square system \(ax = b\), and raises LinAlgError if \(a\) is singular.

Next. M02.9.2 The change-of-basis matrix packs the two equations into one matrix, so that converting a vector, or a million of them, is a single multiplication.

This lesson unlocks

M02.9.2 The change-of-basis matrix

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