I have a single variable function $f(x)$ defined for $x\in[0,L]$. The actual form of $f(x)$ is not known, but I know that $f(x)$ is bounded (maximum value of $|f(x)|=C,$ say) and $f(L)=0$. Also it is infinitely differentiable. Examples of such functions are $a/(b+x)$ with $a,b>0$, $e^{-x}\cos x,$ etc.
Now I write the unknown $f(x)$ as a cosine series: $f(x)=a_0/2+\sum_{n=1}^\infty a_n\cos (n\pi x/L)$ in which $a_n=(2/L)\int_0^Ldx~f(x)\cos(n\pi x/L)$. I happen to know the value of $a_0$ by another independent (physical) argument.
I want to know if one may infer reasonably tight bounds on $a_n$ with this much information? One may of course do the following: $a_n\leq(2/L)\int_0^Ldx~|f(x)||\cos(n\pi x/L)|\leq(2C/L)\int_0^Ldx~|\cos(n\pi x/L)|\leq 2C.$ Can something better than this be done?
The important information is not only boundness of $f$ but the fact that it is infinitely differentiable. With this information, we can find the estimate $$ a_n = \frac{2}{L} \int_0^L\!dx\,f(x) \cos(n\pi x /L) = -\frac{2}{n\pi} \int_0^L\!dx\, f'(x) \sin(n\pi x /L)$$ by integration by parts.
This shows, that given a bound $C_1$ on the first derivative, we have $$|a_n| \leq \frac{2 L C_1}{n \pi}\,.$$
Continuing this process, we obtain $$ a_n = \frac{2 L \left[(-1)^{n} f'(L)-f'(0)\right]}{\pi ^2 n^2} - \frac{2L}{(\pi n)^2} \int_0^L\!dx\,f''(x)\cos(n\pi x /L).$$ With a bound $C_2$ on the second derivative, we have $$|a_n|\leq \frac{2 L \left[(-1)^{n} f'(L)-f'(0)\right]}{\pi ^2 n^2} + \frac{2 L^2 C_2}{(\pi n)^2}.$$
These bounds are better then your original bound for large $n$. Proceeding, we realize that if we have all derivatives bounded the Fourier coefficients $a_n$ decay faster than any power.