$$M=\left\{f\in C[0,2\pi],\int_{0}^{2\pi}f(x)\sin x\,dx=\pi,\int_{0}^{2\pi}f(x)\sin2x\,dx=2\pi\right\} $$ $a,b\in \mathbb R, g\in M, g(x)=a\sin x+b\sin2x,x\in [0,2\pi]$
I've read on the answers that $a=1,b=2$ and I don't know how to calculate them. Can somebody explain me,please? By the way, the problem is to determine $ \int_{0}^{2\pi}(g(x))^2 dx$ so you have to first get the constants $a$ and $b$.
The overall pattern is $$\int_0^{2\pi}\sin(mx)\sin(nx)dx=\pi \delta_{mn}$$ where $\delta_{mn}$ is $1$ when $m=n$ and $0$ otherwise.
The average value of $\sin^2$ is $\frac 12$ and sines with different periods are orthogonal over a common period. You can prove the the first from $\sin^2x=\frac 12-\frac 12\cos(2x)$. The $\cos (2x)$ integrates away. You can prove the first by using the function product identities, which gets you a sum of sine waves that integrate to zero as well. The same thing works for cosines.
This works because the sines and cosines form an orthogonal basis for the $2\pi$ periodic functions and you are effectively expanding a function in that basis.