The nth term of the Taylor series of f(x) centered at a is given by
f^((n))(a)(x-a)^n/(n!)
For our case, a=0, so the nth term is given by
f^((n))(0)x^n/(n!)
So, to find the first 4 terms using this formula, we'll need the function itself evaluated at a=0, as well as the first three derivatives (as the 0th derivative is the function itself).
f(0)=0(e^0)=0
f'(x)=e^x+xe^x, f'(0)=e^0=1
f''(x)=2e^x+xe^x, f''(0)=2e^0=2
f'''(x)=3e^x+xe^x, f'''(0)=3e^0=3
0th term: 0(x^0)/(0!)=0, 0! =1 is a convention we'll adopt here.
1st term: x/(1!)=x
2nd term: 2x^2/(2!)=x^2
3rd term 3x^3/(3!)=x^3/2:
As the 0th term is 0, and we're generally interested in non-zero terms , we can take the fourth derivative and find the next term (this is, I presume, why the first four derivatives were taken, as you need four derivatives to get four non-zero terms with this function):
f^((4))(x)=4e^x+xe^x, f^((4))(0)=4e^0=4
4th (non-zero) term: 4x^4/(4!)=x^4/6
Alternatively, we can use known Taylor series, which is easier with this function: (this method requires no derivatives)
e^x=sum_(n=0)^oox^n/(n!)
xe^x=xsum_(n=0)^oox^n/(n!)
xe^x=sum_(n=0)^oox^(n+1)/(n!)
Evaluate from n=0 to n=3:
sum_(n=0)^3x^(n+1)/(n!)=x+x^2+x^3/2+x^4/6