Compute the angle between $$\mathbf x=\begin{bmatrix} 1\\ 2\end{bmatrix},\quad \mathbf y=\begin{bmatrix} -1\\ -1\end{bmatrix}$$ using
a. $\langle \mathbf x,\mathbf y\rangle := \mathbf x^\top \mathbf y$.
b. $\langle \mathbf x,\mathbf y\rangle := \mathbf x^\top \mathbf B\mathbf y$, $\mathbf B:=\begin{bmatrix}2 & 1\\ 1 & 3\end{bmatrix}$.
Solution: We have to compute $\cos\theta =\dfrac{\langle \mathbf x,\mathbf y\rangle}{\sqrt{\langle \mathbf x,\mathbf x\rangle \cdot \langle \mathbf y,\mathbf y\rangle}}$ and then take $\arccos$ to get the angle $\theta$.
a. We have $$\langle \mathbf x,\mathbf y\rangle = 1\cdot (-1)+2\cdot (-1)=-3,$$ $$\langle \mathbf x,\mathbf x\rangle = 1\cdot 1+2\cdot 2=5,$$ $$\langle \mathbf y,\mathbf y\rangle = (-1)\cdot (-1)+(-1)\cdot (-1)=2.$$Hence $$\cos\theta =\dfrac{\langle \mathbf x,\mathbf y\rangle}{\sqrt{\langle \mathbf x,\mathbf x\rangle \cdot \langle \mathbf y,\mathbf y\rangle}}=\frac{-3}{\sqrt{2\cdot 5}}=\frac{-3}{\sqrt{10}}.$$Take inverse function $\arccos$, we get $$\theta =\arccos \dfrac{-3}{\sqrt{10}}\approx 2.82\,\mathrm{rad}.$$ b. We have \begin{align*}\langle \mathbf x,\mathbf y\rangle =&\begin{bmatrix} 1 & 2\end{bmatrix}\begin{bmatrix}2 & 1\\ 1 & 3\end{bmatrix}\begin{bmatrix} -1\\ -1\end{bmatrix}\\=&\begin{bmatrix} 4 & 7\end{bmatrix}\begin{bmatrix} -1\\ -1\end{bmatrix}=-11,\end{align*} \begin{align*}\langle \mathbf x,\mathbf x\rangle =&\begin{bmatrix} 1 & 2\end{bmatrix}\begin{bmatrix}2 & 1\\ 1 & 3\end{bmatrix}\begin{bmatrix} 1\\ 2\end{bmatrix}\\=&\begin{bmatrix} 4 & 7\end{bmatrix}\begin{bmatrix} 1\\ 2\end{bmatrix}=18,\end{align*} \begin{align*}\langle \mathbf y,\mathbf y\rangle =&\begin{bmatrix} -1 & -1\end{bmatrix}\begin{bmatrix}2 & 1\\ 1 & 3\end{bmatrix}\begin{bmatrix} -1\\ -1\end{bmatrix}\\=&\begin{bmatrix} -3 & -4\end{bmatrix}\begin{bmatrix} -1\\ -1\end{bmatrix}=7,\end{align*} Hence $$\cos\theta =\dfrac{\langle \mathbf x,\mathbf y\rangle}{\sqrt{\langle \mathbf x,\mathbf x\rangle \cdot \langle \mathbf y,\mathbf y\rangle}}=\frac{-11}{\sqrt{18\cdot 7}}=\frac{-11}{\sqrt{126}}.$$Take inverse function $\arccos$, we get $$\theta =\arccos \dfrac{-11}{\sqrt{126}}\approx 2.94\,\mathrm{rad}.$$