Problem
Let $N$ be a positive integer. Suppose that $\phi_{1},\phi_{2},\phi_{3},\dots,\phi_{N}$ are real-valued functions defined on $[0,1]$ that satisfy
$\begin{align} \int_{0}^{1}\phi_{i}\phi_{j}&=0,\qquad i\neq j,\\ \int_{0}^{1}\phi_{i}^2&=1,\qquad i=1,2,\dots,N. \end{align}$
Suppose that the $c_{i}$ are numbers such that
$ f(x)=\sum_{i=1}^{N}c_{i}\phi_{i}(x),\qquad x\in[0,1].\tag{1} $
Prove that both
$ c_{i}=\int_{0}^{1}f\phi_{i},\text{ and }\int_{0}^{1}|f|^2=\sum_{i=1}^{N}c_{i}^2. $
Solution
Multiplying equation $(1)$ by $\phi_{j}$, integrating that from $0$ to $1$, and rearranging the RHS yields
$ \int_{0}^{1}f\phi_{j}=\sum_{i=1}^{N}c_{i}\int_{0}^{1}\phi_{i}\phi_{j}=c_{j}, $
as required. Moreover,
$\begin{align} \int_{0}^{1}|f|^2&=\int_{0}^{1}\left|\sum_{i=1}^{N}c_{i}\phi_{i}\right|^{2}\\ &=\int_{0}^{1}\left|\sum_{i=1}^{N}\phi_{i}\int_{0}^{1}f\phi_{i}\right|^{2}\\ &=? \end{align}$
I am stuck here; I have no clue how to proceed. I need to somehow get rid of the absolute value and integration signs. Could anyone give me a hint on how to continue?
Note: We are assuming that, for this case, the integration and summation signs can be interchanged.