Subjects Linear Algebra

Cosine Similarity

Step-by-step solutions with LaTeX - clean, fast, and student-friendly.

Search Solutions

Cosine Similarity


1. Stating the problem: We need to find the cosine of the angle between vector $G = (9,0,3)$ and each film vector $F_i = (a_i,d_i,h_i)$ for $i=1$ to $5$. 2. Recall the cosine similarity formula: $$\cos \theta = \frac{\vec{G} \cdot \vec{F_i}}{\|\vec{G}\| \|\vec{F_i}\|}$$ where $\vec{G} \cdot \vec{F_i}$ is the dot product and $\|\cdot\|$ denotes vector magnitude. 3. Calculate $\|\vec{G}\|$: $$\|\vec{G}\| = \sqrt{9^2 + 0^2 + 3^2} = \sqrt{81 + 0 + 9} = \sqrt{90} = 3\sqrt{10}$$ 4. For each film $F_i$, calculate: - Dot product $\vec{G} \cdot \vec{F_i} = 9a_i + 0 \cdot d_i + 3h_i = 9a_i + 3h_i$ - Magnitude $\|\vec{F_i}\| = \sqrt{a_i^2 + d_i^2 + h_i^2}$ 5. Compute $\cos \theta_i$ for each film: - For $F1 = (10,3,2)$: - Dot product: $9 \times 10 + 3 \times 2 = 90 + 6 = 96$ - Magnitude: $\sqrt{10^2 + 3^2 + 2^2} = \sqrt{100 + 9 + 4} = \sqrt{113}$ - Cosine: $$\cos \theta_1 = \frac{96}{3\sqrt{10} \times \sqrt{113}} = \frac{96}{3 \sqrt{1130}} = \frac{96}{3 \sqrt{1130}}$$ - For $F2 = (4,9,2)$: - Dot product: $9 \times 4 + 3 \times 2 = 36 + 6 = 42$ - Magnitude: $\sqrt{4^2 + 9^2 + 2^2} = \sqrt{16 + 81 + 4} = \sqrt{101}$ - Cosine: $$\cos \theta_2 = \frac{42}{3\sqrt{10} \times \sqrt{101}} = \frac{42}{3 \sqrt{1010}}$$ - For $F3 = (7,3,6)$: - Dot product: $9 \times 7 + 3 \times 6 = 63 + 18 = 81$ - Magnitude: $\sqrt{7^2 + 3^2 + 6^2} = \sqrt{49 + 9 + 36} = \sqrt{94}$ - Cosine: $$\cos \theta_3 = \frac{81}{3\sqrt{10} \times \sqrt{94}} = \frac{81}{3 \sqrt{940}}$$ - For $F4 = (2,2,10)$: - Dot product: $9 \times 2 + 3 \times 10 = 18 + 30 = 48$ - Magnitude: $\sqrt{2^2 + 2^2 + 10^2} = \sqrt{4 + 4 + 100} = \sqrt{108}$ - Cosine: $$\cos \theta_4 = \frac{48}{3\sqrt{10} \times \sqrt{108}} = \frac{48}{3 \sqrt{1080}}$$ - For $F5 = (9,4,7)$: - Dot product: $9 \times 9 + 3 \times 7 = 81 + 21 = 102$ - Magnitude: $\sqrt{9^2 + 4^2 + 7^2} = \sqrt{81 + 16 + 49} = \sqrt{146}$ - Cosine: $$\cos \theta_5 = \frac{102}{3\sqrt{10} \times \sqrt{146}} = \frac{102}{3 \sqrt{1460}}$$ 6. Final answers: - $$\cos \angle (G,F1) = \frac{96}{3 \sqrt{1130}} = \frac{32}{\sqrt{1130}} \approx 0.95$$ - $$\cos \angle (G,F2) = \frac{42}{3 \sqrt{1010}} = \frac{14}{\sqrt{1010}} \approx 0.44$$ - $$\cos \angle (G,F3) = \frac{81}{3 \sqrt{940}} = \frac{27}{\sqrt{940}} \approx 0.88$$ - $$\cos \angle (G,F4) = \frac{48}{3 \sqrt{1080}} = \frac{16}{\sqrt{1080}} \approx 0.49$$ - $$\cos \angle (G,F5) = \frac{102}{3 \sqrt{1460}} = \frac{34}{\sqrt{1460}} \approx 0.89$$