Clearing up a property of orthonormal basis I'm learning the concept of principal component analysis and in one explanation I found the following statement:
Let's take an arbitrary $n$-dimensional vector $\textbf{v} = (v_1, ..., v_n)$ and orthonormal basis $\textbf{e}_1, \textbf{e}_2, ..., \textbf{e}_n$. We can write vector $\textbf{v}$ as:
$\textbf{v} = \sum_{i=1}^{n} \textbf{e}_i * \langle\textbf{e}_i, \textbf{v}\rangle $
and 
$\sum_{i=1}^{n}\langle\textbf{e}_i, \textbf{v}\rangle^2 = 1 $ . 
Why is the latter part true? Could someone maybe prove this? :) The $*$-sign denotes ordinary multiplication and $\langle \rangle$ denotes dot product :)
Here is the post i'm using as reference 
https://stats.stackexchange.com/questions/2691/making-sense-of-principal-component-analysis-eigenvectors-eigenvalues/33654#33654
Thank your for any help!
 A: As fretty said, your right hand side of the second equation should be $\lvert v\rvert^2$.  To see this: use the first.  We know
$$
\lvert v\rvert^2=\langle v,v\rangle=\left\langle\sum_{i=1}^{n}\langle e_i,v\rangle e_i,\sum_{j=1}^{n}\langle e_j,v\rangle e_j\right\rangle=\sum_{i,j}\langle e_i,v\rangle\langle e_j,v\rangle\langle e_i,e_j\rangle.
$$
But, since $(e_i)_{i=1}^{n}$ is an orthonormal basis, we know that 
$$
\langle e_i,e_j\rangle=\begin{cases}1 & \text{if $i=j$}\\ 0 & \text{else}\end{cases},
$$
and so this simplifies as
$$
\lvert v\rvert^2=\sum_{i=1}^{n}\langle e_i,v\rangle^2,
$$
as claimed.
A: The second one isn't true, the RHS should be $||v||^2$. This is the analogue of Pythagoras' theorem in higher dimensions.
A: The second equation is equivalent to state that $\|v\|^2=1$. As easy example, consider the vector $v=v_1e_1+v_2e_2$  in $\mathbb R^2$, with $e_1=(1,0)$ and $e_2=(0,1)$. Then $v_1=\langle v,e_1 \rangle$ and similarly for $v_2$ as $\langle e_i,e_j \rangle=\delta_{ij}$. So you can write $v=\langle v,e_1 \rangle e_1+\langle v,e_2 \rangle e_2$. In the end
$$\|v\|^2=\langle v,e_1 \rangle^2+\langle v,e_2 \rangle^2 $$
