<s>[INST] Euclidean norm and matrix questions Let $A$ be an $n×m$ real matrix and define $\vert A \vert_{2}^{2}={\rm tr}(A^tA)$.
1)Show that $|A|_2$ is the Euclidean norm of $A$, when we view $A$ as a vector in $R^{nm}$ by stacking the columns of $A$.
2)Find the cosine of the angle between
$A=\begin{bmatrix}
1 & 1 & 1\\ 
 1& 0 & 1
\end{bmatrix}$, and $B=\begin{bmatrix}
4 & 0 & 0\\ 
 1& 0 & 0
\end{bmatrix}$
(Here what stacking the columns of $A$ means?)
 [/INST] This: if
$$
A =
\begin{pmatrix}
1  &  3  &  5  \\
2  &  4  &  6
\end{pmatrix}
$$
then, as a vector of $\mathbb{R}^{3\cdot 2}$, we view it like
$$
\begin{pmatrix}
1  \\
2  \\
3  \\
4  \\
5  \\
6
\end{pmatrix}
$$
and the square of its norm is
$$
\vert A \vert_2^2 =
\mathrm{tr}
\left[ 
\begin{pmatrix}
1  &  2  \\
3  &  4  \\
5  &  6
\end{pmatrix}
\begin{pmatrix}
1  &  3  &  5  \\
2  &  4  &  6
\end{pmatrix}
\right]
=
\mathrm{tr}
\begin{pmatrix}
1+4  &  11  &  17  \\
11 &  9+16  &  39  \\
17 &  39  &  25 + 36
\end{pmatrix}
=
1 + 4 + 9 + 16 + 25 + 36 
$$
Which happens to be the same as
$$
(1,2,3,4,5,6)
\begin{pmatrix}
1  \\
2  \\
3  \\
4  \\
5  \\
6
\end{pmatrix}
=
1 + 4 + 9 + 16+ 25 + 36  \ .
$$
</s>