# Odd harmonics only in Fourier transform

If a function is even or odd, it implies that there are respectively only cos and sine terms in its Fourier expansion. But is there a condition for a function to have an expansion with only odd or even harmonics, like this:

$\frac{a_0}{2} + \sum_{n=1,3,5,...}^\infty a_n \cos(nx)$

-

Yes, you have to consider symmetries around $\pi/2$. Let me show you an example. Let $f\colon[-\pi,\pi]\to\mathbb{R}$ be an odd continuous function. Then it's Fourier series has only sine terms: $$f\sim\sum_{n=1}^\infty b_n\sin(n\,x),\quad b_n=\frac{2}{\pi}\int_0^\pi f(x)\sin(n\,x)\,dx.$$ Suppose further that $f$ satisfies $f(\pi-x)=f(x)$ if $0\le x\le\pi$. Then for all $n\in\mathbb{N}$ $$\int_0^\pi f(x)\sin(2\,n\,x)\,dx=\int_0^\pi f(\pi-x)\sin(2\,n\,\pi-2\,n\,x)\,dx=-\int_0^\pi f(x)\sin(n\,x)\,dx.$$ This implies that $b_{2n}=0$.
If $f(\pi-x)=-f(x)$, then $b_{2n+1}=0$. You can find similar conditions for cosine series.