Fourier series problem

Consider the function $f(x)$ defined for $0<x<1$ by $$f(x)=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}\int_{0}^{1}f(x)dx$$ ie $a_0=\frac{1}{3}$

and $$a_n=\frac{2}{L}\int_{0}^{1}f(x)cos(\frac{n\pi x}{L})dx$$ where $L=1$ in this case

ie $$a_n=2[\int_{0}^{1}xcos(n\pi x)dx-\int_{0}^{1}x^2cos(n\pi x)dx]$$

i assume i then use intergration by parts twice to solve for $a_n$

Now calculating $b_n$

$$b_n=\frac{2}{L} \int_0^{1} f(x)sin(\frac{n\pi x}{L})dx$$

$$b_n=2[\int_0^{1}xsin(n\pi x)dx-\int_0^{1}x^2sin(n\pi x)dx$$

and again i assume we can use integration by parts twice here?

can anyone tell me if i'm going wrong anywhere here

• You are right. Take care that the first coefficient of the cosine series is $\frac{a_0}{2}=\frac{1}{6}$. – JJacquelin Mar 12 '17 at 10:55

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!

• i dont need to plot it on maple, this is from a textbook – user395952 Mar 10 '17 at 16:55
• Must be a hell of a coincidence then. – hehe xd Mar 11 '17 at 7:25
• The book is called Elementary differential equations and boundary value problems by william e. boyce and richard c.diprima page 621 question 26 – user395952 Mar 11 '17 at 16:48

In order to make clear of what Fourier series it is about :

[A typo corrected in last equation.]

• $f(x) = \{x\}-\{x\}^2$ where $\{x\} = x - \lfloor x \rfloor$ (otherwise it suggests not looking for the convergence at the boundary of $(0,1)$). Since $f(x)$ is continuous and $C^1$ on $(0,1)$ its Fourier series converges uniformly – reuns Mar 12 '17 at 11:12
• I think that there is a small ambiguity in the wording of the question. it should be more precise about the definitions of function and kind of Fourier Series concerned, in order to avoid some discussion. – JJacquelin Mar 12 '17 at 11:26
• brilliant, may i ask what program you used to plot them graphs? – user395952 Mar 12 '17 at 13:22
• I this case, I used Mathcad. – JJacquelin Mar 12 '17 at 15:12