# projection formula proof explanation

Let $$\langle x,y\rangle$$ be an inner product on $$F^m$$ and deﬁne $$\|x\| = \sqrt{\langle x,x\rangle}$$. Suppose $$W$$ is a subspace of $$F^m$$ and $$\dim(W) = n$$.
Let $$β = \{v_1, v_2, \ldots , v_n\}$$ be an orthogonal basis for $$W$$. Prove that for any vector $$v ∈ W$$ we have $$v = \frac{\langle v,v_1\rangle}{||v_1||^2} v_1 + \cdots + \frac{\langle v,v_n\rangle}{\|v_n\|^2} v_n$$.
Proof: Denoting $$v = c_1v_1 + c_2v_2 + \cdots + c_nv_n$$ for some $$c_1, c_2, \cdots, c_n$$ since $$\{v_1, v_2, \cdots, v_n\}$$ is a basis. We have \begin{align} & v - \frac{\langle v, v_1\rangle}{\|v_1\|^2}v_1 - \cdots - \frac{\langle v, v_n\rangle}{\|v_n\|^2}v_n \\ =\ &\left(c_1 - \frac{\langle v, v_1\rangle}{\|v_1\|^2}\right)v_1 + \cdots + \left(c_n - \frac{\langle v, v_n\rangle}{\|v_n\|^2}\right)v_n \\ =\ & \left(c_1 - \frac{\langle c_1v_1, v_1\rangle}{\|v_1\|^2}\right)v_1 + \cdots + \left(c_n - \frac{\langle c_nv_n, v_n\rangle}{\|v_n\|^2}\right)v_n \\ =\ &\left(c_1 - c_1\right)v_1 + \cdots + \left(c_n - c_n\right)v_n \\ =\ &0 \end{align} where the second equality is because $$\langle v, v_i \rangle = \langle c_1v_1 + c_2v_2 + \cdots + c_nv_n, v_i\rangle = \langle c_iv_i, v_i\rangle = c_i \langle v_i, v_i \rangle = c_i\|v_i\|^2$$
I am not sure how it arrives from $$\left(c_1 - \frac{\langle c_1v_1, v_1\rangle}{\|v_1\|^2}\right)v_1 + \cdots + \left(c_n - \frac{\langle c_nv_n, v_n\rangle}{\|v_n\|^2}\right)v_n$$ to $$\left(c_1 - c_1\right)v_1 + \cdots + \left(c_n - c_n\right)v_n$$
$$\frac{\langle c_1 v_1, v_1 \rangle}{\Vert v_1 \Vert^2} = \frac{c_1\langle v_1, v_1 \rangle}{\Vert v_1 \Vert^2} = c_1$$ since $$\langle v_1, v_1 \rangle = \Vert v_1 \Vert^2$$ per definition. Analogous for $$v_2,...,v_n$$.