← Back

Vectors

Sep 2, 2025

the best thing school ever taught me

Understanding Vectors

Vectors are fundamental objects in mathematics and physics, representing both magnitude and direction.

What is a Vector?

A vector is typically written as v = (x, y) in 2D or v = (x, y, z) in 3D.

Example

v = (3, 4)

Vector Operations

  • Addition:
    Add corresponding components: (x1, y1) + (x2, y2) = (x1 + x2, y1 + y2)
  • Scalar multiplication:
    Multiply each component by a scalar a: a(x, y) = (ax, ay)
  • Dot product:
    (x1, y1) · (x2, y2) = x1x2 + y1y2

Magnitude and Direction

The magnitude of v = (x, y) is |v| = sqrt(x^2 + y^2). The direction is the angle θ such that tan(θ) = y/x.

Use Cases

  • Physics: velocity, force
  • Graphics: positions, normals
  • ML: embeddings, features