Checkpoint
Vectors and the dot product
Eleven questions across the whole module: combinations, span and bases, the dot product and projection, length, cosine similarity and Cauchy-Schwarz. The numbers are new, and several questions aim at the classic confusions. Work on paper before answering, and write the code without looking back at the lessons if you can. You need 80% to pass.
- 1
Do and span all of ?
- 2
Compute .
result - 3
In the basis , , what are the coordinates of the vector ?
coordinates in p, q - 4
Which statement about the vectors , and is true?
- 5
Two vectors have lengths and , and the angle between them is . What is ?
a · b - 6
Find for and .
proj - 7
Find the cosine similarity of and , to 3 decimal places.
cos θ - 8
Two embeddings have been normalized to length 1, and their cosine similarity is . How far apart are their tips?
distance - 9
Vectors and have and . Which of these values could take? Select every possible value.
- 10
A search index stores one embedding per document. A bug multiplies one document's vector by 3 and leaves every other vector unchanged. For a fixed query, which rankings could change? Select all that apply.
- 11
Code it Write
angle_degrees(a, b): the angle between two nonzero vectors, in degrees, from 0 to 180. RaiseValueErrorif either vector is the zero vector. It must return a real number for every pair of nonzero vectors, parallel ones included.