prove $f(x)$ has at least $2n$ roots Let $f(x)$ be continuous function in $(0,\pi)$,for any integer $k$ where $1\leq k\leq n$,we have $$ \int_{0}^{\pi}f(x)\cos kxdx=\int_{0}^{\pi}f(x)\sin kxdx=0 $$
Prove that:$f(x)$ has at least $2n$ roots on $(0,\pi)$.
I can only solve the cases when $n=1$,Can anyone help me? Thank you very much!
 A: Since $f$ is only assumed to be continuous on $(0,\pi)$, $f$ may not be bounded on $(0,\pi)$. Then for clarity, I will assume that you are talking about Lebesgue integral. From the integrability of $f(x)\sin x$ and $f(x)\cos x$ on $(0,\pi)$, it is easy to see that $f$ is integrable on $(0,\pi)$. Therefore, for any bounded measurable function $g$ on $(0,\pi)$, $fg$ is integrable on $(0,\pi)$.
The lemma below follows from basic facts of trigonometric functions, so let me omit its proof. 

Lemma:  Given $m\ge 1$ and $0<a_1<\cdots< a_{2m}<\pi$, define $$h(x)=\prod_{k=1}^{2m}\sin\frac{x-a_k}{2}.\tag{$*$}$$ 
(i) $h$ is a linear combination of $1,\sin x,\cos x,\cdots,\sin mx$ 
  and $\cos mx$, and for every $x_0\in\Bbb R$, $h(x)\sin(x-x_0)$ 
  is a linear combination of $\sin x,\cos x,\cdots,\sin (m+1)x$ and 
  $\cos (m+1)x$. 
  (ii) $h>0$ on $(0,a_1)\cup\bigcup\limits_{k=1}^{m-1}(a_{2k},a_{2k+1})\cup(a_{2m},\pi)$, and $h<0$ on $\bigcup\limits_{k=1}^m(a_{2k-1},a_{2k})$.


Now suppose that $f$ has at most $2n-1$ roots in $(0,\pi)$ and let us deduce some contradiction. Since $f$ is continuous on $(0,\pi)$ and since $\int_0^\pi f(x)\sin x dx=0$, there exist $1\le p<2n$ and $0:=a_0<a_1<\cdots <a_p<a_{p+1}:=\pi$, such that $f\ne 0$ on $(a_{k-1},a_k)$ for $1\le k\le p+1$ and $f$ has different signs on each pair of adjacent intervals $(a_{k-1},a_k)$ and  $(a_k,a_{k+1})$ for $1\le k\le p$. Without lost of generality, let us assume that $f>0$ on  $(a_0,a_1)$ for convenience.
If $p$ is even, say $p=2m$, let $g(x)=h(x)\sin x$, where $h$ is defined by $(*)$. Otherwise, if $p$ is odd, say $p=2m+1$, let $g(x)=-h(x)\sin (x-a_p)$, where $h\equiv 1$ when $m=0$ and $h$ is defined by $(*)$ when $m\ge 1$. In both cases, $m<n$ and due to (i) of the lemma, $g$ is a linear combination of $\sin x,\cos x,\cdots,\sin (m+1)x$ and $\cos (m+1)x$, so $\int_0^\pi f(x)g(x)dx=0$. However,  due to (ii) of the lemma, in both cases $fg>0$ on $(0,\pi)\setminus\{a_k\}_{k=1}^p$, so $\int_0^\pi f(x)g(x)dx>0$. This contradiction completes the proof. $\qquad\square$
