Vectors
Key points
What a vector is
A vector is a quantity that states a size and a direction at the same time: a velocity of 60 km/h heading north, or a force of 10 N pushing to the right. That is what separates it from a scalar, which is only a size. We draw a vector as an arrow, and arrows can be added, subtracted, and stretched or shrunk by multiplying by a number.
Adding and scaling vectors
Once a vector is written in components as a = (a₁, a₂), the arithmetic is easy: to add two vectors, add them one component at a time, and to multiply by a number k, multiply every component by k.
The length of a vector (its norm)
The length |a| of a vector a = (a₁, a₂) comes straight from the Pythagorean theorem — the components are the two legs of a right triangle and the vector is the hypotenuse. The same formula extends to three dimensions, and to any number of dimensions, by adding one more squared term.
The dot product
The dot product a · b = a₁b₁ + a₂b₂ = |a||b|cos θ turns "how much do these two point the same way?" into a single number. When the angle θ is 90°, the dot product is 0, which is the standard test for whether two vectors are perpendicular. Recommendation systems use exactly this number to measure how similar two items are.
High-dimensional vectors and AI
In machine learning, a word like "dog" is stored as a list of numbers such as [0.2, 0.8, -0.1, ...] — often a thousand components long (this is what Word2Vec and BERT produce). To ask how close two words are in meaning, you take their dot product and divide by their lengths; that ratio is called cosine similarity. Nothing new is going on mathematically. It is the same dot product you are learning here, just with more components.
Jobs that use this
Robotics engineer$130k
AI engineer (natural language processing)$160k
Game physics programmer$108k
§
Members-only from here
The practice questions and full career details are for members. $4.99/mo, cancel anytime.
Comments
Sign in to comment