# [Math] angle between two vectors-given in matrix form

linear algebra

Let
$u=\left\{\begin{pmatrix} 1&a&0\\0&1&0\\0&0&1\end{pmatrix} \begin{pmatrix}1\\1\\0\end{pmatrix}:a\epsilon R\right\}$

$v=\left\{\begin{pmatrix} a&0&0\\0&a&0\\0&0&1\end{pmatrix} \begin{pmatrix}1\\1\\0\end{pmatrix}:a\epsilon R\right\}$

Then what is the angle between these two?

here $u=\begin{pmatrix} 1+a\\1\\0\end{pmatrix}$ and $v=\begin{pmatrix} a\\a\\0\end{pmatrix}$
after that how to proceed..not getting the correct answer.
Hint: $u\cdot v = \|u\| \|v\|\cos\theta$, where $\theta$ is the angle between $u$ and $v$
We have $u\cdot v = (1+a)a + a = a^2 + 2a$, $\|u\|^2 = (1+a)^2 + 1$ and $\|v\|^2 = 2a^2$, thus $\cos\theta = \dfrac{a^2 + 2a}{\sqrt{((1+a)^2 + 1)(2a^2)}}$, then solve it for $\theta$
Now we have $\cos\theta = \dfrac{a^2 + 2a}{\sqrt{2(a^2 + 2a + 2)}|a|}$. For a given value of $a$, we can compute the value of RHS, say $\dfrac{a^2 + 2a}{\sqrt{2(a^2 + 2a + 2)}|a|} = b$, then $\theta = \arccos(b)$, where $\arccos$ is the inverse function of $\cos$