Bird
0
0

Given vectors A = [1, 2, 3] and B = [4, 5, 6], what is the cosine similarity (rounded to 2 decimals)?

medium📝 Predict Output Q13 of 15
NLP - Text Similarity and Search
Given vectors A = [1, 2, 3] and B = [4, 5, 6], what is the cosine similarity (rounded to 2 decimals)?
A0.97
B0.83
C0.74
D0.56
Step-by-Step Solution
Solution:
  1. Step 1: Calculate dot product of A and B

    Dot product = 1*4 + 2*5 + 3*6 = 4 + 10 + 18 = 32
  2. Step 2: Calculate norms of A and B

    Norm A = sqrt(1^2 + 2^2 + 3^2) = sqrt(14) ≈ 3.74; Norm B = sqrt(4^2 + 5^2 + 6^2) = sqrt(77) ≈ 8.77
  3. Step 3: Compute cosine similarity

    Cosine similarity = 32 / (3.74 * 8.77) ≈ 32 / 32.83 ≈ 0.9749 rounded to 0.97
  4. Step 4: Check closest option

    0.97 matches the value rounded to 2 decimals.
  5. Final Answer:

    0.97 -> Option A
  6. Quick Check:

    Dot product / (norms product) ≈ 0.97 [OK]
Quick Trick: Calculate dot product and divide by product of lengths [OK]
Common Mistakes:
MISTAKES
  • Forgetting to take vector norms
  • Mixing up dot product with element-wise multiplication
  • Rounding too early causing wrong answer

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NLP Quizzes