2
$\begingroup$

What is the angle between $\vec{x}=\begin{bmatrix} 1 \\ 1 \end{bmatrix}$ and $\vec{y}=\begin{bmatrix} -1 \\ 1 \end{bmatrix}$ using the inner product defined as $⟨\vec{x},\vec{y}⟩=\vec{x}^{T}\begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix}\vec{y}$

My Attempt

$$\Rightarrow ⟨\vec{x},\vec{y}⟩ = \begin{Vmatrix} \vec{x} \end{Vmatrix}\begin{Vmatrix} \vec{y} \end{Vmatrix} \cos \theta$$ $$\Rightarrow \cos \theta = \frac{⟨\vec{x},\vec{y}⟩}{\begin{Vmatrix} \vec{x} \end{Vmatrix}\begin{Vmatrix} \vec{y} \end{Vmatrix}}$$ $$\Rightarrow \cos \theta = \frac{\vec{x}^{T}\begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix}\vec{y}}{\begin{Vmatrix} \vec{x} \end{Vmatrix}\begin{Vmatrix} \vec{y} \end{Vmatrix}}$$ $$\Rightarrow \cos \theta = \frac{{\begin{bmatrix} 1 \\ 1 \end{bmatrix}}^{T}\begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix}\begin{bmatrix} -1 \\ 1 \end{bmatrix}}{\begin{Vmatrix} 1 \\ 1 \end{Vmatrix}\begin{Vmatrix} -1 \\ 1 \end{Vmatrix}}$$ $$\cos \theta = \frac{-1}{\sqrt{2}\sqrt{2}}$$ $$\theta = cos^{-1}-\frac{1}{2} \approx 2.09 radian \approx 120 degree$$

But the accepted answer is 1.9

What am I missing?

Note The question is from the Week-2 Coursera Course Mathematics for Machine Learning: PCA video Inner product: angles and orthogonality

$\endgroup$
  • $\begingroup$ You need to take the norms using the one induced by the inner product. $\endgroup$ – copper.hat Jun 16 at 19:29
  • $\begingroup$ @copper.hat Can you please elaborate? $\endgroup$ – Abhijit Jun 16 at 19:30
  • 2
    $\begingroup$ In other words, $$\cos \theta = \frac{\langle x,y\rangle}{\sqrt{\langle x,x\rangle \langle y,y\rangle}}$$ $\endgroup$ – Hamed Jun 16 at 19:32
  • $\begingroup$ @copper.hat Damm me :-) Thank you. I am mixing up concepts. $\endgroup$ – Abhijit Jun 16 at 19:33
  • 1
    $\begingroup$ $\|\binom{1}{1}\| =\sqrt{2+1} = \sqrt{3}$. $\|x\| = \sqrt{\langle x, x \rangle}$. (Thanks @Andrei.) $\endgroup$ – copper.hat Jun 16 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.