problem on a function being identically zero 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?
 A: 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$.
A: The Fejér Kernel
TheFejér Kernel is defined as
$$
\begin{align}
F_n(x)
&=\frac1{2\pi}\sum_{|k|\lt n}\left(1-\frac{|k|}{n}\right)\cos(kx)\tag{1}\\
&=\frac{\sin^2(nx/2)}{2\pi n\sin^2(x/2)}\tag{2}
\end{align}
$$
Formula $(1)$ guarantees that
$$
\int_{-\pi}^\pi F_n(x)\,\mathrm{d}x=1\tag{3}
$$
and formula $(2)$ says that
$$
F_n(x)\ge0\tag{4}
$$
For $x\in[0,\pi]$, $\sin(x/2)\ge\dfrac{x}\pi$. Therefore, if $x\in\left.\left[-\pi,\pi\vphantom{n^{1/3}}\right]\middle\backslash\left[-n^{-1/3},n^{-1/3}\right]\right.$, $(2)$ says
$$
F_n(x)\le\frac{\pi}2n^{-1/3}\tag{5}
$$
Furthermore, $(3)$, $(4)$, and $(5)$ imply that
$$
\int_{-n^{-1/3}}^{n^{-1/3}}F_n(x)\,\mathrm{d}x\ge1-\pi^2n^{-1/3}\tag{6}
$$

Two Kernels Make A General (Answer)
Suppose that $f$ is continuous on $[0,\pi]$ and for all $k\ge0$,
$$
\int_0^\pi f(x)\cos(kx)\,\mathrm{d}x=0\tag{7}
$$
Since $f$ is continuous on a compact set, it must be bounded; say $|f(x)|\le M$.
Suppose for some $x_0\in(0,\pi)$, $f(x_0)\ne0$. Since $f$ is continuous, there must be a $\delta\gt0$ so that if $|x-x_0|\le\delta$, $|f(x)-f(x_0)|\le |f(x_0)|/2$.
We can assume that $\delta\le\min(x_0,\pi-x_0)$ so that $[x_0-\delta,x_0+\delta]\subset[0,\pi]$.
Consider
$$
F_n(x+x_0)+F_n(x-x_0)
=\frac1{2\pi}\sum_{|k|\lt n}\left(1-\frac{|k|}{n}\right)2\cos(kx)\cos(kx_0)\tag{8}
$$
Equations $(7)$ and $(8)$ imply that for all $n\gt0$
$$
\int_0^\pi f(x)\big[F_n(x+x_0)+F_n(x-x_0)\big]\,\mathrm{d}x=0\tag{9}
$$
Choose any $n\ge\delta^{-3}$, then $(5)$ says
$$
\left|\int_0^\pi f(x)F(x+x_0)\,\mathrm{d}x\right|
\le\frac{\pi^2}2Mn^{-1/3}\tag{10}
$$
and
$$
\left|\int_{[0,\pi]\setminus[x_0-\delta,x_0+\delta]}f(x)F_n(x-x_0)\,\mathrm{d}x\right|
\le\frac{\pi^2}2Mn^{-1/3}\tag{11}
$$
Now $(6)$ implies
$$
\left|\int_{x_0-\delta}^{x_0+\delta}f(x)F_n(x-x_0)\,\mathrm{d}x\right|
\ge\left|\frac{f(x_0)}{2}\right|(1-\pi^2n^{-1/3})\tag{12}
$$
However, $(9)$, $(10)$, $(11)$, and $(12)$ imply that for all $n\ge\delta^{-3}$,
$$
\begin{align}
0
&=\left|\int_0^\pi f(x)\big[F_n(x+x_0)+F_n(x-x_0)\big]\,\mathrm{d}x\right|\\
&\ge\left|\frac{f(x_0)}{2}\right|-\pi^2n^{-1/3}\left[\left|\frac{f(x_0)}{2}\right|+M\right]\tag{13}
\end{align}
$$
Inequality $(13)$ says that for all $n\gt\max\left(\pi^6,\delta^{-1/3}\right)$,
$$
|f(x_0)|\le M\frac{2\pi^2}{n^{1/3}-\pi^2}\tag{14}
$$
Inequality $(14)$ can only be true if $f(x_0)=0$. Thus, our assumption that $f(x_0)\ne0$ must be false and so $f(x)=0$ for all $x\in[0,\pi]$.
