Inner Product, Length and Orthogonality
The dot product (inner product) lets you measure length, distance and angle in any , not just the 2D and 3D you can picture. Two vectors are orthogonal, meaning perpendicular, exactly when their dot product is zero, because that's when the in is zero.
What the symbols mean
- Length
The Pythagorean theorem in n dimensions.
What the symbols mean
- W perp
Every vector perpendicular to the whole subspace W.
Explanation
The inner product is simply the dot product: multiply two vectors entry by entry, add up the results, and you get one number that tells you how much the two point the same way. It's called an "inner" product because, written as a matrix product, it's , a row times a column, which collapses to a single number (the "outer" product blows up into a whole matrix instead). "Orthogonal" is just the formal word for perpendicular; it comes from the Greek for "right angle." What it's good for: length, distance and angle in any number of dimensions, even ones you can't draw. All we're really saying here is that (multiply matching entries and add) gives you everything, because (square each entry, add, take the root: Pythagoras) and (the length of the arrow from one point to the other). It's three small formulas built on one operation; bear with the notation.
Everything you know about dot products in 2D and 3D works in any dimension. You can't picture , but you don't need to: "perpendicular" there just means dot product zero.
Pythagoras: exactly when . Think about why that works. Expanding gives . The middle term is the only thing standing between you and the familiar , and it disappears exactly when .
Complements. collects every vector that's perpendicular to all of at once, and . The big fact: the row space of and its null space are orthogonal complements, and so are the column space and the null space of . It makes sense once you write out row by row: each entry of is a row of dotted with , so says exactly that is perpendicular to every row.
A common mistake. It's tempting to think is everything in that isn't in , because "complement" sounds like "whatever's left over." It isn't: is only the vectors perpendicular to all of , and it's a subspace in its own right (it contains , for one thing). In , the complement of a line through the origin is the plane perpendicular to it, not every point off the line.
There's an animation further down that shows the dot product changing sign as one vector swings around another.
See it
Worked examples
Are and orthogonal? Find the length of the first.
- 1
Multiply matching entries and add: . The dot product is zero, so they're orthogonal.
Practice
Type your answer and check it. Solve them all to complete the lesson.
Find .
Find .
Find the distance between and .
Find the unit vector in the direction of .
is a line through the origin in . What is ?
A streaming service scores movies on (action, comedy, drama). Sam's taste vector is and a new movie's profile is . The service recommends by cosine similarity, . Find it.
The hardest one here. Get it, and you've got this lesson.
Vectors and have , and . Find .
Where it's used
Recommendation engines and search engines measure similarity between users or documents as the angle between high-dimensional vectors (cosine similarity).