I am trying to understand a formula from Hoffman's book.
Corollary: If a vector $B$ is a a linear combination of an orthogonal sequence of non-zero vectors $a_1,...a_m$, then $B$ is the particular linear combination $\beta= \sum^m_{k=1}\frac{(B|a_k)}{||a_k||^2}a_k$
I thought, $(B|a_k)$ gives the length of $B$ in terms of $a_k$ and then we divide $a_k$ to it's magnitude so that we could multiply the inner product with the normalized vector and we can get $B$.
This should have worked because I thought inner product was the length of the projection. So if $B=<2,1>$ then $(B,e_1)=2$. But when I try $(<2,2>,<2,0>)=4$.
This made me confused, because my intuition was telling me that dot product should me the length of the projection of first vector to the second inside the inner product, but when we check $(<2,2>,<2,0>)$, the projection should be the second vector which has length 2? Does that mean that the intuition is wrong? If so what is the correct way of thinking about this. Also, why do we divide with norm squared, is it related to this? If we divide a vector with it's normal it should normalize the vector, but why do we need squared? Thanks a lot in advance. I am really confused it would be really helpful if you can explain it in a simple manner.