Is f a zero function Let be $f$ a continuous function in $[0,\pi]$ and
$$\int_{0}^{\pi} f(x) \sin(nx)\,dx =0, \qquad \forall n \geq 1$$
My question: Is $f$ a zero function?
 A: I'll assume that $f$ is real-valued.
The condition implies
$$\int_0^\pi g(x)\phi_n(x)\,dx=0$$
where
$$g(x)=f(x)\sin x$$
and
$$\phi_n(x)=\frac{\sin nx}{\sin x}=U_n(\cos x)$$
where $U_n$ is a Chebyshev polynomial of the second kind.
In particular $U_n$ is a polynomial of degree exactly $n-1$.
It follows that
$$\int_0^\pi g(x)\cos^m x\,dx=0$$
for all $m\ge0$. Equivalently
$$\int_0^\pi g(x)H(\cos x)\,dx=0$$
for all polynomials $H$. By the Stone-Weierstrass theorem, the
$H(\cos x)$ for polynomials $H$ are dense in the space
of continuous functions on $[0,\pi]$. There is a sequence of
polynomials $H_j$ such that $H_j(\cos x)\to g(x)$ uniformly. Therefore
$$\int_0^\pi g(x)^2\,dx=0.$$
As $g$ is continuous, then $g\equiv0$, and therefore $f\equiv0$.
A: Yes, you can prove it with Fourier series (unsurprisingly). Define
$$g : [-\pi, \pi] \to \mathbb{R} : g(x) = \begin{cases} f(x) & \text{if} & x \ge 0 \\ 0 & \text{if} & x < 0 \end{cases}.$$
We can compute the Fourier series for $g$, obtaining:
$$g(x) = \frac{a_0}{2} + \sum_{n=1}^\infty a_n \cos(nx) + b_n\sin(nx),$$
for all $x$ at which $g$ is continuous (i.e. everywhere except possibly $x = 0$), where
\begin{align*}
a_n &= \frac{1}{\pi} \int_{-\pi}^\pi g(x) \cos(nx) = \frac{1}{\pi} \int_0^\pi f(x) \cos(nx) &n \ge 0\\
b_n &= \frac{1}{\pi} \int_{-\pi}^\pi g(x) \sin(nx) = \frac{1}{\pi} \int_0^\pi f(x) \sin(nx) = 0 &n \ge 1
\end{align*}
It follows therefore that $g$ is an infinite sum of even functions on $[-\pi, 0) \cup (0, \pi]$, and hence is even. But for $x \in [-\pi, 0)$, $g(x) = 0$, and for $x \in (0, \pi]$, we have $g(x) = f(x)$. Therefore, $f(x) = 0$ for all $x \in (0, \pi]$. By the continuity of $f$, we have $f(0) = 0$ too.
