Maclaurin series degree 6 involving substitution

real-analysissubstitutiontaylor expansion

So I am aware that you can perform operations on taylor series, such as integration, differentiation, etc. However, I am not sure of when exactly one is allowed to substitute values into another taylor series. For example:

Find the degree 6 taylor polynomial of:

$f(x) = e^{\sin(x^2)} $ about $x=0$

So what exactly would be the process? Clearly they don't expect you to differentiate $f(x)$ 6 times under exam conditions, so I thought maybe you could find the degree 6 taylor polynomial of $e^x$:

$P_{6,0}(e^x) = 1 + x + \frac{1}{2}x^2 + \frac{1}{6}x^3 + \frac{1}{24}x^4 + \frac{1}{120}x^5 + \frac{1}{720}x^6$

And then making a $\sin(x^2)$ substitution for x giving:

$P_{6,0}(x) = 1 + x + \frac{1}{2}\sin(x^2)^2 + \frac{1}{6}\sin(x^2)^3 + \frac{1}{24}\sin(x^2)^4 + \frac{1}{120}\sin(x^2)^5 + \frac{1}{720}\sin(x^2)^6$

But I don't suppose this is right, and I don't know why. Even so, I know this can't always be done. Any tips or points are appreciated. Thanks in advance.

Best Answer

Since$$e^x=1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\frac{x^4}{4!}+\frac{x^5}{5!}+\frac{x^6}{6!}+\cdots\text{ and }\sin(x^2)=x^2-\frac{x^6}{3!}+\cdots,$$you have that $P_{6,0}(x)$ is$$1+\left(x^2-\frac{x^6}{3!}\right)+\frac{\left(x^2-\frac{x^6}{3!}\right)^2}{2!}+\frac{\left(x^2-\frac{x^6}{3!}\right)^3}{3!}+\frac{\left(x^2-\frac{x^6}{3!}\right)^4}{4!}+\frac{\left(x^2-\frac{x^6}{3!}\right)^5}{5!}+\frac{\left(x^2-\frac{x^6}{3!}\right)^6}{6!}$$minus those monomials whose degree is greater than $6$. Note, furthermore, that every monomial obtained when you expand$$\frac{\left(x^2-\frac{x^6}{3!}\right)^4}{4!}+\frac{\left(x^2-\frac{x^6}{3!}\right)^5}{5!}+\frac{\left(x^2-\frac{x^6}{3!}\right)^6}{6!}$$has degree greater than $6$, and therefore they don't matter.