# Angles between vectors using a non-standard inner product

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

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