Tuples, Indices, and Coordinates

A tuple is an ordered collection.

For example:

(2,5)(2, 5)

is not the same as:

(5,2)(5, 2)

The values are the same. The order is different. For a tuple, that matters.

Why Order Matters

The pair (2,5)(2, 5) can mean:

2 units horizontally
5 units vertically

If we switch the order to (5,2)(5, 2), we get a different point.

This is why we need tuples before vectors. A vector is not merely a bag of numbers. The positions of the numbers carry meaning.

MATH-C01-T05-001Exercise: Order check

Enter 1 if (2,5)(2, 5) and (5,2)(5, 2) are different tuples.

Compute it first, then check your number.

HintCompare positions

Is the first coordinate the same in both tuples?

SolutionDifferent order

Enter 1. In (2,5)(2, 5), the first value is 2. In (5,2)(5, 2), the first value is 5.

Indices

An index tells us which item we are talking about.

If

x=(4,7,9)x = (4, 7, 9)

then we might write:

x1=4,x2=7,x3=9x_1 = 4,\quad x_2 = 7,\quad x_3 = 9

This is one-based mathematical indexing.

The subscript does not multiply. It names position. The symbol x2x_2 means "the second component of xx", not "xx times 2."

MATH-C01-T05-002Exercise: Read the index

If x=(4,7,9)x = (4, 7, 9) using mathematical indexing, what is x2x_2?

Compute it first, then check your number.

HintCount mathematically

In this notation, the first item is x1x_1.

SolutionSecond component

The second item is 7, so x2=7x_2 = 7. In this mathematical notation, the first component is x1x_1, so x2x_2 means the second component.

Python Indexing

In Python, indexing usually starts at zero:

x = [4, 7, 9]
print(x[0])  # 4
print(x[1])  # 7
print(x[2])  # 9

This is not a contradiction. It is a convention.

Mathematics often writes the first item as x1x_1. Python writes the first item as x[0].

MATH-C01-T05-003Exercise: Translate Python indexing

In Python, if x = [4, 7, 9], what does x[1] return?

Compute it first, then check your number.

HintStart at zero

x[0] is 4, so x[1] is the next item.

SolutionPython position

Python uses zero-based indexing:

x[0] = 4
x[1] = 7
x[2] = 9

So x[1] returns 7. This differs from mathematical indexing because Python starts counting positions at zero.

Coordinates

Coordinates are indexed values with a geometric meaning.

The tuple

(2,5)(2, 5)

can name a point in the plane:

move 2 units horizontally
move 5 units vertically

The same notation can become a vector in the next chapter.

MATH-C01-T05-004Exercise: Read a coordinate

For the point (2,5)(2, 5), what is the vertical coordinate?

Compute it first, then check your number.

HintUse the position

In (x,y)(x, y), the second coordinate is usually the vertical coordinate.

SolutionSecond coordinate

The point is (2,5)(2, 5). The second coordinate is 5, so the vertical coordinate is 5.

Common Trap

Do not mix mathematical indexing and Python indexing without checking.

If a formula writes x1x_1, it probably means the first mathematical component. If code writes x[1], it probably means the second Python list item.

Next, we compress repeated addition and multiplication with sums and products.