projection of a function on an orthogonal set

I'm currently trying to solve an equation of the form $$f(x) = \sum_m\,a_m\,\varphi_m(x)$$ and it's required me to project this equation on a different set of functions $$\{\phi_m(x)\}$$ that is orthonormal on the interval (a,b).

How do I execute such kind of projection?

-
The question is not clear. Your $f$ is already a linear combination of $\{\varphi_m\}$. Can you make your question more clear? – Siminore Sep 1 '12 at 9:58
Sorry, I wrote it wrong... the basis is different from the other one :) – Juan Sebastian Totero Sep 1 '12 at 10:42

I think the coefficients of $f$ on the new basis should be given by
supposing the integral-sum exchange is possible and where $w(x)$ is the weight function of the given scalar product.