Consider the function $f\left(x\right)$ defined for $0<x<1$ by $$f\left(x\right)=x-x^2$$
I want to determine the fourier sine series and fourier cosine series of f.
my attempt
Recall that $$a_0=\frac{2}{L}∫_{0}^{1}f\left(x\right)dx$$ ie $a_0=\frac{1}{3}$
and $$a_n=\frac{2}{L}∫_{0}^{1}f\left(x\right)\cos \left(\frac{nπ x}{L}\right)dx$$ where $L=1$ in this case
ie $$a_n=2\left[∫_{0}^{1}x\cos \left(nπ x\right)dx-∫_{0}^{1}x^2\cos \left(nπ x\right)dx\right]$$
i assume i then use intergration by parts twice to solve for $a_n$
Now calculating $b_n$
$$b_n=\frac{2}{L} ∫_0^{1} f\left(x\right)\sin \left(\frac{nπ x}{L}\right)dx$$
$$b_n=2\left[∫_0^{1}x\sin \left(nπ x\right)dx-∫_0^{1}x^2\sin \left(nπ x\right)dx\right]$$
and again i assume we can use integration by parts twice here?
can anyone tell me if i'm going wrong anywhere here

Technically correct, but:
For the fourier cosine series, it extends $f(x)$ over a period of $2l$ i.e. $-1 < x < 1$. This makes $f(x)$ into a even function, therefore the FCS of $f(x)$ is also an even function and therefore can only contain even terms. therefore only need to calculate an.
When calculating an's:
perform integration by parts on $2( x - x^2)\cos(n\pi x)$ between limits 0 and 1 please dont make the mistake of just integrating between -1 and 1
$f(x) = x-x^2$ is not even, the extension is odd. i.e. $f(x)$ does not equal the FCS of $f(x)$ in the way the maths interprets it anyway. believe me!
Also for the FCS, the graph on maple won't look like it is right, it just hasn't converged yet.
Tremendous!