Find a function such that $ \int_{-\pi}^{\pi} f(x)\sin(nx)dx = \frac{(-1)^n}{\sqrt n} $ and $ \int_{-\pi}^{\pi} f(x)\cos(nx)dx = 0 $ As the title states, I must say if the function exists or not.
I'm not sure where to begin...
Is there a general method or approach to finding this type of functions?
All I can think is that $ (-1)^n = \cos(\pi n) $ but I don't know how the $ \sqrt n $ could appear.
 A: It tells you what the Fourier series of $f$ should be. So by the definition of the polylogarithm $\operatorname{Li}_s(z)$ and its integral representation,
$$
f(x) = \sum\limits_{n = 1}^\infty  {\frac{{( - 1)^n }}{{\sqrt n }}\sin (nx)}  = \Im \sum\limits_{n = 1}^\infty  {\frac{{( - 1)^n \mathrm{e}^{\mathrm{i}xn} }}{{\sqrt n }}}  = \Im \operatorname{Li}_{1/2} ( - \mathrm{e}^{\mathrm{i}x} )
\\
 = -\frac{1}{{\sqrt \pi  }}\Im \int_0^{ + \infty } {\frac{1}{{\sqrt t }}\frac{1}{{\mathrm{e}^{t - \mathrm{i}x}  + 1}}\mathrm{d}t}  = -\frac{\sin x}{2{\sqrt \pi  }}\int_0^{ + \infty } {\frac{1}{{\sqrt t }}\frac{{\mathrm{d}t}}{{\cosh t + \cos x}}} .
$$
This is a possible representation of a function that satisfies the requirements.
A: The function $$\frac{i}{2} \left\{\textrm{Li}_{1/2}[-e^{-ix}] - \textrm{Li}_{1/2}[-e^{ix}] \right\}= \sum_{k=1}^\infty (-1)^k \left[ \frac{e^{-ikx}}{k^{1/2}}- \frac{e^{ikx}}{k^{1/2}}\right]=\sum_{k=1}^\infty (-1)^{k} \frac{\sin kx }{k^{1/2}} $$ satisfies the requirements.
Here $\textrm{Li}_{\alpha}(x)$ is the polylogarithm function.
A: It has been some time since I studied Fourier analysis, but here is my take. Let $f$ be some odd function. In particular this means that
$$ \int_{-\pi}^{\pi} f(x) \cos nx \,\mathrm{d}x
 = 0 $$
You can prove this yourself by splitting the integral in two and using that for any odd function we have $f(–x) = –f(x)$. Now all we have to do is find some odd function such that the integral converges. 
$$ \int_{-\pi}^{\pi} f(x) \sin nx \,\mathrm{d}x
 = 0 
$$
You can nearly choose whatever you want here. Let for instance $f$ be a bounded and continuous function for $x \in [-\pi, \pi]$. This ensures that the integral converges.
$$K = \int_{-\pi}^{\pi} f(x) \sin nx \,\mathrm{d}x \leq \int_{-\pi}^{\pi} |f(x)| \cdot |\sin nx| \,\mathrm{d}x
\leq \int_{-\pi}^{\pi} |f(x)| \,\mathrm{d}x$$
Note, we do not have to pick $f$ to be continuous all we need to do is pick $f$ such that the integral above converges. However, it is merely convenient to just let $f$ be bounded and continuous as it makes life easy... As the integral converges, we know that the result is some value $K$. We can now achieve our goal by selecting our final function
$$\overset{\sim}{f}(x) = \frac{1}{K} \frac{(-1)^n}{\sqrt{n}}f(x)$$
where $\overset{\sim}{f}$ is an bounded, odd and continuous function for $x \in [-\pi, \pi]$. 
This function satisfies the two restrictions
$$ \displaystyle
\int_{-\pi}^{\pi} \overset{\sim}{f}(x) \sin nx \,\mathrm{d}x
= \frac{(-1)^n}{\sqrt{n}}
\qquad \text{and} \qquad 
\int_{-\pi}^{\pi} \overset{\sim}{f}(x) \sin nx \,\mathrm{d}x = 0
$$

Example: Take $g$ to be defined as $x$. Then
$$
K = \int_{-\pi}^{\pi} g(x) \sin nx \,\mathrm{d}x = \int_{-\pi}^{\pi} x \sin nx = \frac{2 \sin(\pi n) - 2\pi n \cos(\pi n)}{n^2}
$$ 
So let 
$$f(x) = \frac{n^2}{2 \sin(\pi n) - 2\pi n \cos(\pi n)} \frac{(-1)^n}{\sqrt{n}} x$$
Then
$$ \displaystyle
\int_{-\pi}^{\pi} \overset{\sim}{f}(x) \sin nx \,\mathrm{d}x
= \frac{(-1)^n}{\sqrt{n}}
\qquad \text{and} \qquad 
\int_{-\pi}^{\pi} \overset{\sim}{f}(x) \sin nx \,\mathrm{d}x = 0
$$
