The following is a worked example:

In the following, for example

$\displaystyle \frac{(g,p_0)}{(p_0,p_0)}p_0 = \frac{(-1)}{2}.1$

What I don't understand is that why they got $\displaystyle (g,p_0)=(-1)$.

Since $\displaystyle p_0 = 1$

And $\displaystyle (g,p_0) = \int^1_{-1} 1.g(x)dx$

But what do we need to substitute for $\displaystyle g$? Because this function is piece-wise, how do I know which one of the two functions I have to put into the formula?