Maths for Machines
0 of 6 lessons done100 questions

Lesson 1 of 6

Coordinates and vector operations

A vector is an arrow with size and direction; coordinates record how far it moves along each axis.

Core lesson · about 5 minutes · 3 guided parts

To walk from the classroom to the library, go 4 metres east and 3 metres north. The vector ⟨4,3⟩ stores the trip, and it can be slid anywhere without changing its length or direction.

Your learning route

Build the idea one piece at a time

  1. Points, displacement, and components
  2. Addition and scalar multiplication
  3. Combine movements without losing direction
Coordinates and vector operations, made visible
x componenty component

Points, displacement, and components

A point says where; a vector says how to move.

The vector from A to B is B−A, found by subtracting corresponding coordinates.

Equal vectors have equal components even if their arrows start at different locations.

In d dimensions, a vector is an ordered list ⟨v₁,…,v_d⟩; each component measures movement along one coordinate axis.

A point names a location, while a vector names a displacement. Subtracting endpoint minus start removes the shared origin and leaves only how far and in which coordinate directions to move.

Displacements telescope along a route: vector AB plus vector BC equals vector AC. The middle coordinates cancel when (B−A)+(C−B) is simplified.

Components depend on the chosen axes, so state their order and units. The vector ⟨3,−2⟩ could mean 3 m east and 2 m south only after those axes are declared.

In symbolsvector AB = B − A

Worked example

Find the displacement from A=(−1,2) to B=(4,−2).

  1. Subtract starting coordinates from ending coordinates.
  2. x-component: 4−(−1)=5.
  3. y-component: −2−2=−4.
  4. Therefore B−A=⟨5,−4⟩.

Answer: ⟨5,−4⟩

Addition and scalar multiplication

Add movements component by component; a scalar stretches or reverses the whole arrow.

u+v represents doing movement u and then v, and vector addition is commutative.

Multiplying by c scales length by |c|; a negative c also reverses direction.

A linear combination c₁v₁+⋯+cₖvₖ builds new directions from available vectors.

The parallelogram picture shows vector addition: draw u and v from one point, and the opposite corner is u+v. Component addition produces that same diagonal.

A scalar of 0 collapses a vector to the zero vector, a scalar between 0 and 1 shortens it, and a negative scalar also turns it around.

A linear combination asks what movements can be built from available directions. Two non-parallel vectors in a plane can reach every planar displacement through suitable coefficients.

In symbolsc⟨v₁,…,vd⟩=⟨cv₁,…,cvd

Worked example

Let u=⟨2,−1⟩ and v=⟨−3,4⟩. Find 2u−v.

  1. Scale u: 2u=⟨4,−2⟩.
  2. Subtract v componentwise.
  3. ⟨4,−2⟩−⟨−3,4⟩=⟨4+3,−2−4⟩.
  4. The result is ⟨7,−6⟩.

Answer: ⟨7,−6⟩

Practical deep dive for this lesson

Combine movements without losing direction

A vector records several coordinated changes at once, so adding vectors gives the net effect of consecutive movements or forces.

A scalar records size only, such as 5 seconds. A vector records components relative to chosen axes, such as 5 metres east and 2 metres north.

Coordinates are instructions: ⟨3,−1⟩ means move 3 units in the positive first-axis direction and 1 unit in the negative second-axis direction.

Vector addition combines matching components because east-west changes affect only the east-west result and north-south changes affect only north-south.

Scalar multiplication changes every component. A negative scalar also reverses direction; multiplying by −2 reverses the arrow and doubles its length.

Subtracting positions gives displacement. If a trip starts at A and ends at B, the vector B−A points from A to B regardless of the route travelled.

Forces, velocities, pixel colours, model features, and embedding coordinates are stored as vectors so one operation can update every component consistently.

The coordinate values depend on axes and units, but the physical arrow does not. Rotating the coordinate system changes components while preserving the underlying displacement.

A net vector does not reveal the full path. Several different journeys can have the same start, end, and displacement but different travelled distances.

In symbolsnet displacement = Σ movement vectors; final position = initial position + net displacement

Worked example

A drone flies 120 m east and 50 m north, then 30 m west and 80 m south. Find its net displacement vector and final coordinates if it began at (40,20) m.

  1. Choose east as positive x and north as positive y.
  2. The first flight vector is ⟨120,50⟩ m.
  3. West and south are negative directions, so the second vector is ⟨−30,−80⟩ m.
  4. Add components: ⟨120,50⟩+⟨−30,−80⟩=⟨90,−30⟩ m.
  5. This means the net result is 90 m east and 30 m south of the start.
  6. Add displacement to the starting position: ⟨40,20⟩+⟨90,−30⟩.
  7. The final coordinates are ⟨130,−10⟩ m.
  8. Subtracting final minus initial, ⟨130,−10⟩−⟨40,20⟩=⟨90,−30⟩, confirms the result.

Answer: Net displacement ⟨90,−30⟩ m; final position (130,−10) m.

Check your picture

If P=(3,1) and vector v=⟨−2,5⟩, where does P+v land?

Reveal answer

(1,6)

This lesson versus the whole chapter

Your topic-specific practical example is above.

The final lesson collects five longer chapter-wide workflows for machine learning, LLMs, trading, physics, and everyday decisions.

Formula shelf

Symbols with meaning

DisplacementAB=B−A

Vector pointing from point A to point B.

Euclidean norm‖v‖₂=√(Σvᵢ²)

Straight-line vector length.

Distanced(p,q)=‖p−q‖₂

Straight-line separation of two points.

Dot productu·v=Σuᵢvᵢ=‖u‖‖v‖cosθ

Measures directional alignment.

Projectionprojvu=((u·v)/(v·v))v

Aligned part of u along v.

Parametric liner(t)=p+td

All points reached from p along d.

Point-plane distance|ax₀+by₀+cz₀−d|/√(a²+b²+c²)

Shortest separation along the normal.

Cross-product areaarea=‖u×v‖

Area of the spanned parallelogram.

Gram–Schmidt residualu₂=v₂−proju₁(v₂)

Removes the part of a vector already explained by an earlier direction.

Barycentric pointP=αA+βB+γC, α+β+γ=1

Locates a point using weights on triangle vertices.

Before moving on

You are ready when you can…

  • Distinguish points from vectors and calculate vector combinations.
  • Compute norms, distances, and normalized directions.
  • Use dot products for angles, similarity, orthogonality, and projections.
  • Represent lines and planes and calculate their intersections or distances.
  • Build orthonormal directions with Gram–Schmidt and locate points with barycentric weights.
  • Use cross products in 3D and reason carefully about high-dimensional embeddings.