# Math Help - expand f(x) using a sine or cosine series

1. ## expand f(x) using a sine or cosine series

f(x)= x|x| , -1<x<1

i did a sine series because function is odd over given interval.
p=1

so, bn= 2 x^2 sin(npix) dx , from 0 to 1not sure how to do this integral, any help would be appreciated.

2. For bn, do you want the exact value, or its series representation?

3. series representation i think. the question says "expand the given function in an appropriate sine or cosine series"

4. Originally Posted by linalg123
series representation i think. the question says "expand the given function in an appropriate sine or cosine series"
Okay, using the Maclaurin series for the sine function, we have:

\begin{aligned} b_n & = 2\int_{0}^{1}x^2\sin{n\pi x}\;{dx} = 2\int_{0}^{1}x^2\bigg(\sum_{k\ge0}\frac{(-1)^kn^{2k+1}\pi^{2k+1}x^{2k+1}}{(2k+1)!}\bigg)\;{d x} \\& = 2\int_{0}^{1}\sum_{k\ge0}\frac{(-1)^kn^{2k+1}\pi^{2k+1}x^{2k+3}}{(2k+1)!}\;{dx} = 2\sum_{k\ge0}\int_{0}^{1}\frac{(-1)^kn^{2k+1}\pi^{2k+1}x^{2k+3}}{(2k+1)!}\;{dx} \\& = 2\sum_{k\ge0}\bigg[\frac{(-1)^kn^{2k+1}\pi^{2k+1}x^{2k+4}}{(2k+1)!(2k+4)} \bigg]_{0}^{1} = 2\sum_{k\ge0}\frac{(-1)^kn^{2k+1}\pi^{2k+1}}{(2k+1)!(2k+4)}.\end{aligne d}

The exact value can be calculated too:

\begin{aligned} b_{n} & = 2\int_0^1 x^2\sin\left(n\pi x\right)\;{dx} = -\frac{2}{n\pi}\int_0^1 x^2(\cos{n\pi x})'\;{dx} \\& = -\frac{2}{n\pi}x^2\cos{n\pi x}\bigg|_{0}^{1}+\frac{2}{n\pi}\int_0^1 (x^2)'\cos{n\pi x}\;{dx} \\& = \frac{2(-1)^{n+1}}{n\pi}+\frac{4}{n\pi}\int_0^1 x\cos{n\pi x}\;{dx} \\& = \frac{2(-1)^{n+1}}{n\pi}+\frac{4}{n^2\pi^2}\int_0^1 x(\sin{n\pi x})'\;{dx} \\& = \frac{2(-1)^{n+1}}{n\pi}+\frac{4}{n^2\pi^2} x\sin{n\pi x}\;{dx}\bigg|_{0}^{1} \\& -\frac{4}{n^2\pi^2}\int_0^1 (x)'\sin{n\pi x}\;{dx} \\& = \frac{2(-1)^{n+1}}{n\pi} -\frac{4}{n^2\pi^2}\int_0^1 \sin{n\pi x}\;{dx} \\& = \frac{2(-1)^{n+1}}{n\pi}+\frac{4}{n^3\pi^3}\cos{n\pi x}\bigg|_{0}^{1} \\& = \boxed{\frac{2(-1)^{n+1}}{n\pi}+\frac{4}{n^3\pi^3}(-1)^n-\frac{4}{n^3\pi^3}}.\end{aligned}