Chapter 1

Vectors

The geometric picture

In the plane, a vector is an arrow with a direction. Placing two arrows head to tail adds them; stretching, shrinking or flipping an arrow multiplies it by a scalar.

vector

Vector spaces

Vector space

Let be a set with an addition and a scalar multiplication . If commutativity, associativity, a zero, negatives and the distributive laws hold for all and , then is a vector space over .

The most common example is : add componentwise and multiply every component by the same number.

Linear combinations

Linear combination

Given vectors and numbers , the vector

is a linear combination of .

The set of all linear combinations is the span of the vectors, written .

Length and inner product

The length of a vector in comes from Pythagoras:

The inner product satisfies .

Check it in code

import math
 
def norm(v: list[float]) -> float:
    return math.sqrt(sum(x * x for x in v))
 
print(norm([3.0, 4.0]))  # 5.0

The next chapter writes linear combinations more compactly with matrices; see Matrices › Matrix multiplication.

Comments