# `f(x)=xcosx` Find the Maclaurin series for the function.

Maclaurin series  is a special case of Taylor series which is centered at a=0. We follow the formula:

`f(x) =sum_(n=0)^oo (f^n(0))/(n!)x^n`

or

`f(x) = f(0) + (f'(0))/(1!)x+(f''(0))/(2!)x^2+(f'''(0))/(3!)x^3 +(f^4(0))/(4!)x^4 +(f^5(0))/(5!)x^5 +...`

To list of `f^n(x)`  up to `n=9` , we may apply the Product rule for differentiation: `d/(dx) (u*v) = u'*v +u*v'` .

`f(x) = xcos(x)`

`f'(x) = cos(x)-xsin(x)`

`f''(x) = -xcos(x)-2sin(x)`

`f'''(x) = xsin(x)-3cos(x)`

`f^4(x) = xcos(x)+4sin(x)`

`f^5(x) = 5cos(x)-xsin(x)`

`f^6(x) = -xcos(x)-6sin(x)`

`f^7(x) = xsin(x)-7cos(x)`

`f^8(x) = xcos(x)+8sin(x)`

`f^9(x) = 9cos(x)-xsin(x)`

Note: `d/(dx)x=1` ,  `d/(dx) cos(x) =-sin(x)` , and `d/(dx) sin(x)=cos(x).`

Plug-in `x =0` , we get:

`f(0) = 0*cos(0) `

`= 0*1`

`=0`

`f'(0) = cos(0)-0*sin(0)`

`= 1 -0*0`

`=1`

`f''(0) = -0*cos(0)-2sin(0)`

`=-0*1 - 2*0`

`=0`

`f'''(0) = 0*sin(0)-3cos(0)`

` =0*0 - 3*1`

`=-3`

`f^4(0) = 0*cos(0)+4sin(0)`

`=0*1 +4*0`

` =0`

`f^5(0) = 5cos(0)-0*sin(0)`

` =5*1 -0*0`

` =5`

`f^6(0) = -0*cos(0)-6sin(0)`

`=-0*1 -6*0`

`=0`

`f^7(0) = 0*sin(0)-7cos(0)`

`= 0*0-7*1`

`=-7`

`f^8(0) = 0*cos(0)+8sin(0)`

`=0*1+8*0`

`=0`

`f^9(0) = 9cos(0)-0*sin(0)`

`=9*1 -0*0`

`=9`

Note: `cos(0)=1` and `sin(0)=0` .

Plug-in the values in the formula, we get:

`f(x) = 0 + 1/(1!)x+0/(2!)x^2+(-3)/(3!)x^3+0/(4!)x^4+5/(5!)x^5+0/(6!)x^6+ (-7)/(7!)x^7+0/(8!)x^8+9/(9!)x^9`

`=0 + 1/(1)x+0/(1*2)x^2-3/(1*2*3)x^3+ 0/(1*2*3*4)x^4 + 5/(1*2*3*4*5)x^5+ 0/(1*2*3*4*5*6)x^6`

` -7/(1*2*3*4*5*6*7)x^7 + 0/(1*2*3*4*5*6*7*8)x^8 + 9/(1*2*3*4*5*6*7*8*9)x^9+...`

``

`=0 + x+0/2x^2-3/6x^3+ 0/24x^4 + 5/120x^5 + 0/720x^6 -7/5040x^7 + 0/40320x^8 + 9/362880x^9+...`

`=0 + x+0-1/2x^3 + 0+ 1/24x^5 + 0 -1/720x^7 + 0+ 9/40320x^9+...`

`= x-1/2x^3 +1/24x^5 -1/720x^7 + 9/40320x^9 +...`

Therefore, the Maclaurin series for the function `f(x) =xcos(x)` can be expressed as:

`xcos(x)= x-1/2x^3 +1/24x^5 -1/720x^7 + 9/40320x^9 +...`

Approved by eNotes Editorial Team