[Math] If $ \int_0^{\pi}f(x)\cos(nx)\,dx=0$ for all $n$ then prove that $f\equiv 0$

analysisdefinite integralsintegrationreal-analysis

If $f:[0,\pi]\to \mathbb R$ is continuous and $f(0)=0$ such that $\displaystyle \int_0^{\pi}f(x)\cos(nx)\,dx=0$ for all $n=0,1,2,\cdots$ then prove that $f\equiv 0$ in $[0,\pi]$.

I want to apply Weierstrass approximation theorem. As $f$ is continuous so there exists a sequence of polynomials $\{p_n(x)\}$ such that $p_n(x)\to f$ uniformly. If I expand $\cos nx=1+\frac{n^2x^2}{2!}+\cdots$ then $$\int_0^{\pi}f(x)\,dx+\frac{n^2}{2!}\int_0^{\pi}x^2f(x)\,dx+\cdots=0.$$which implies $\displaystyle \int_0^{\pi}x^{2n}f(x)\,dx=0$ for each $n=0,1,2,\cdots$. Is this step correct ? If yes then I can deduce from it that $f\equiv 0$. If I am Not correct then solve it please.

Best Answer

Extend $f$ to be even on $[-\pi,\pi].$ We then have

$$\hat f (n) = \frac{1}{2\pi}\int_{-\pi}^\pi f(x)e^{-inx}\,dx = \frac{1}{\pi}\int_{0}^\pi f(x)\cos (nx)\,dx = 0$$

for all $n\in \mathbb {Z}.$ Thus $$\frac{1}{2\pi}\int_{-\pi}^\pi|f|^2 = \sum |\hat f (n)|^2 = 0.$$

This implies $f\equiv 0.$ I did not use the condition $f(0)=0,$ which makes me think the problem should have been stated assuming $\int_0^\pi f(x)\sin (nx)\, dx =0, n=1,2,\dots.$

Related Question