I'm starting to learn Fourier series and I've tried to find the Fourier series for $$f(x) =x+\sin(x), \quad\quad -\pi<x<\pi $$ Since $f$ is odd, it has a Fourier series of the form $$\sum_{n = 1}^{+\infty}b_n \sin(nx)$$ For $b_n$ i got $$ b_n= -\frac{2\cos(n\pi)}{n} = \frac{2(-1)^{n+1}}{n}$$So, the Series can be written as $$\sum_{n = 1}^{+\infty}\frac{2(-1)^{n+1}}{n} \sin(nx)$$
However, the solution that appears in the book (Linear Partial differential equations for scientists and engineers by Tyn Myint-U) is $$\sin(x)+\sum_{n = 1}^{+\infty}\frac{2(-1)^{n+1}}{n} \sin(nx) $$
Thanks in advance
There is a mistake in your computation of $b_1$. You should get $b_1=3$.
Compute $\int_{-\pi} ^{\pi} (x+\sin x) \sin xdx=\int_{-\pi} ^{\pi} x \sin xdx+\int_{-\pi} ^{\pi} \sin ^{2}x dx$ using integration by parts for the first term and the formula $\sin ^{2}x=\frac 1 2 (1-\cos (2x))$ for the second. You seem to have assumed that second term is $0$ but it is not.
For $n>1$ you computation is correct. Here $\int \sin x \sin (nx)dx=0$.