Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now
1 of 4

You examples are easy, I was hoping for harder ones ;) This is from the definition.

f1[x_] := Piecewise[{{1 - x^2 , x < 0}, {0, True}}];
f2[x_] := Piecewise[{{1 + x^2 , x > 0}, {0, True}}];
FourierSeries[f1[x], x, 3]

Mathematica graphics

FourierSeries[f2[x], x, 3]

Mathematica graphics

You can use the definition of the $c_k$ also by using FourierParameters to make it match the textbook you are using. So make sure to look at FourierParameters and adjust it as needed else you'll get different looking result from the textbook if the textbook does not use the default setting used by Mathematica.