Represent $\cos(x)$ as a sum of sines - where is my mistake Let's look at $f(x)=\cos(x)$ defined on the interval $[0,\pi]$.
We know that for any function $g$ defined on $[0,\pi]$ we have:
$g(x)=\sum_{k=1}^{\infty}B_k\sin(kx)$ where $B_k=\frac{2}{\pi}\int_{0}^{\pi}g(x)\sin(kx)dx$. And $f$ is no different. So in our case:
$B_k=\frac{2}{\pi}\int_{0}^{\pi}f(x)\sin(kx)dx=\frac{2}{\pi}\int_{0}^{\pi}\cos(x)\sin(kx)dx$
It can be shown that $\int\cos(x)\sin(kx)dx=\frac{\sin(x)\sin(kx)+k\cos(x)\cos(kx)}{1-k^2}$, so:
$B_k=\frac{2}{\pi}\int_{0}^{\pi}\cos(x)\sin(kx)dx=\frac{2}{\pi}\frac{-k\cos(k\pi)-k}{1-k^2}=\frac{2}{\pi}\frac{(-1)^{k+1}k-k}{1-k^2}$
So overall we should have $f(x)=\cos(x)=\sum_{k=1}^{\infty}\frac{2}{\pi}\frac{(-1)^{k+1}k-k}{1-k^2}\sin(kx)$ But that clearly can't be true, because $\cos(0)=1$ but that sum is equal to $0$ at $x=0$ since $\sin(0)=0$.
Where is the mistake? and not only that, we seem to have a big problem when $k=1$
 A: Any sum of sines such as $\sin kx$ will give zero for $x=0$, since $\sin (k\cdot 0)=0$ for any $k$.
Therefore, you cannot represent the cosine function as a sum of sines of the form $\sin kx$. That's why the usual Fourier series uses both sines and cosines, or the equivalent of $e^{ikx}$. Making you realize that may be the point of this exercise.

Other answers and comments point out that you can get an approximation of the cosine function, namely the restriction of cosine to the domain $(0,\pi)$. Outside that domain, the function is discontinuous at zero and $\pi$ and is an odd function so it does not approximate cosine at all for negative values of the variable. Again, using cosine functions as part of the Fourier series greatly lessons these limitations, and realizing that may be the point of the exercise.
A: Developing a sine series makes an odd periodic extension of the function. So a better question would be, which zero are you talking about? You have a discontinuity at $0$, so it depends on which side you approach from:
$$f(0^+)=1$$
and
$$f(0^-)=-1$$
The fourier series, when faced with a discontinuity, gives you an average value at the point of discontinuity (Dirichlet theorem) plus Gibbs oscillations around it.
So, your series is ok, it's just that your function is ugly.
A: Your formula after "it can be shown that" is clearly not valid for $k=1$,
so you simply have to compute $B_1$ using some different method. (For example, $\int \cos x \sin x \, dx= \frac12 \sin^2 x + C$.)
