TITLE: problem on a function being identically zero
QUESTION [5 upvotes]: Let $f:[0,\pi] \to \mathbb{R}$ be a continuous function such that $f(0)=0$.
If $$
\int_0^\pi f(t)\cos nt\, dt = 0
$$
for all $n \in \mathbb{N} \cup \{0 \}$,  is $f$ identically zero?

REPLY [3 votes]: Assume that $f$ is continuous on $[0,\pi]$ with $\int_{0}^{\pi}f(x)\cos nx\,dx=0$ for $n=0,1,2,3,\cdots$.
Define a new function $f_{e}$ by first extending $f$ to a even function on $[-\pi,\pi]$, and then by extending periodically to all of $\mathbb{R}$ with period $2\pi$. This new function is continuous everywhere on $\mathbb{R}$ with period $2\pi$. Therefore,
$$
\begin{align}
       \int_{0}^{2\pi}f_{e}(x)\cos nx\,dx
          & = \int_{-\pi}^{\pi}f_{e}(x)\cos nx\,dx \\
          & = 2\int_{0}^{\pi}f(x)\cos nx\,dx = 0,\;\;\; n=0,1,2,3,\cdots\;.
\end{align}
$$
And, because $f_{e}$ is even and periodic with period $2\pi$,
$$
        \int_{0}^{2\pi}f_{e}(x)\sin nx \;dx =\int_{-\pi}^{\pi}f_{e}(x)\sin nx\,dx = 0,\;\;\; n =1,2,3,\cdots\;.
$$
Therefore, the ordinary Fourier series for $f_{e}$ on $[0,2\pi]$ is now seen to be $0$. I'm assuming you have a theorem that covers this case of the ordinary Fourier series. However, if you only have theorem for differentiable functions, read on ...
Added because of remark: If you only have a theorem dealing with continuously differentiable functions, then let $g(x)=\int_{0}^{x}f_{e}(t)\,dx$. Notice that $g$ is continuously differentiable, $g'=f_{e}$, and $g(0)=g(2\pi)=0$ because $\int_{0}^{2\pi}f_{e}(t)\,dt=0$. The Fourier series for $g$ has only a constant term because
$$
\begin{align}
        \int_{0}^{2\pi}g(x)\cos(nx)\,dx & = \left.g(x)\frac{\sin(nx)}{n}\right|_{0}^{2\pi}-\frac{1}{n}\int_{0}^{2\pi}g'(x)\sin(nx)\,dx \\
         & = -\frac{1}{n}\int_{0}^{2\pi}f_{e}(x)\sin(nx) = 0,\;\;\; n=1,2,3,\cdots, \\
   \int_{0}^{2\pi}g(x)\sin(nx)\,dx & = -\left.g(x)\frac{\cos(nx)}{n}\right|_{0}^{2\pi}+\frac{1}{n}\int_{0}^{2\pi}g'(x)\cos(nx)\,dx \\
         & = \frac{1}{n}\int_{0}^{2\pi}f_{e}(x)\cos(nx) = 0,\;\;\; n=1,2,3,\cdots,\\
\end{align}
$$
We are guaranteed that the Fourier series for $g$ converges pointwise everywhere to $g$ and, therefore, $g$ is identically constant. So, $f_{e}=g'$ is identically $0$.