Skip to main content
2 of 3
deleted 22 characters in body

You are right István Sikari-Nágl, it is not as easy at all as it looks.

f[x_] = Piecewise[{{x + π, -π < x < 0}, {x - π, 0 < x < π}}]; g = FourierSeries[f[x], x, 2] // ExpToTrig (* -2 Sin[x] - Sin[2 x] *) Plot[{g, f[Mod[x, -2 π]] + f[Mod[x, 2 π]]}, {x, -3 π, 3 π}, Exclusions -> None] 

enter image description here

user36273