g[x_] := 2*x;
bn = (∫_(-1)^1) g[x]*
          Sin[n*π*x] \[DifferentialD]x

((-4 n π *(((-1))^n))/((n^2) (π^2)))*
      Sin[n*π*x]

D[(4/((n^2)*(π^2)))*(((-1))^n)*Cos[n*π*x], x]

g[x_] := 
        Which[-3 < x < -1, 2*(x + 2), -1 < x < 1, 2*x, 
          1 < x < 3, 2*(x - 2)];

Plot[{(∑_(n = 1)^15)-((4 (((-1))^n) Sin[
                    n π x])/(n π)), g[x]}, {x, -3, 3}, 
      PlotStyle -> {{RGBColor[1, 0, 0], 
            Thickness[0.01]}, {RGBColor[0, 1, 0], 
            Thickness[0.008]}}]