Solution (source code)

= Solution

On the open interval, $g=f'$. It is an <odd function> there, so its constant and cosine coefficients vanish; assigned values at the endpoints do not affect these <integrals>. For its sine coefficient, <integration by parts> gives
$$
b_n^{(g)}=\int_{-1}^1 f'(x)\sin(n\pi x)\,dx
=\left[f(x)\sin(n\pi x)\right]_{-1}^1-n\pi\int_{-1}^1 f(x)\cos(n\pi x)\,dx
=-n\pi a_n.
$$
Consequently
$$
\boxed{g(x)=2\pi\sinh1\sum_{n=1}^{\infty}\frac{(-1)^{n+1}n\sin(n\pi x)}{1+n^2\pi^2}},\qquad -1<x<1.
$$
The endpoint qualification matters. The periodic $g$ has a <jump discontinuity> at every odd integer, with one-sided limits $\pm\sinh1$. By the <Dirichlet-Jordan convergence theorem>, the <Fourier series> converges to their average, zero, there, not to the assigned value $g(1)=\sinh1$. The <integration by parts> argument also avoids assuming unrestricted termwise differentiation of the first series.