Using substitution while using taylor expansion I am trying to prove to myself why can substitution be used while using taylor expansion. for example: the taylor expansion of $e^{(x-3)^2}$ around $a=3$ and order of $6$ can be done by first evaluating $e^x$ and than plugging in $(x-3)^2$ getting $P_{6}(x)=1+(x-3)^2+\frac{(x-3)^4}{4}+\frac{(x-3)^6}{6}$
We know that $f(x)=P_{n}(x)+R_{n}(x)$ when $lim_{x\to a} \frac{R_n{x}}{(x-a)^n}=0$
So we first use taylor expansion around $a=0$ and of order $k=3$
So we in general we have $f(x)=P_{k}(x)+R_{k}(x)$ now we plug in $(x-3)^2$ and get $f(x)=P_{k*m}(x)+R_{k*m}(x)$ where $m=2$
Because we overall got a polynomial in the form of $f(x)=P_{n}(x)+R_{n}(x)$ the used substitution can be made? is that a valid proof? 
 A: The Taylor expansion is valid for any value of the argument; whether you write it $x$ or $(x-3)^2$ doesn't make a difference. (It also works with $\cos\theta$, but then you don't obtain a polynomial expression.)

The interesting fact that the expansions done with and without the substitution coincide is explained by the chain rule.
Let $g(x)=f(p(x))$. To the first order, the development of $g$ around $0$
$$g(x)=g(0)+g'(0)x+\cdots,$$ can be compared to the development of $f$ around $p_0:=p(0)$
$$f(p(x))=f(p_0)+f'(p_0)(p(x)-p_0)+\cdots.$$
But obviously,
$$p(x)=p(0)+p'(0)x+\cdots$$
and the previous expression is 
$$f(p(x))=f(p_0)+f'(p_0)p'(0)x+\cdots.$$
We do match
$$g'(0)=f'(p(0))p'(0).$$
Similar relations hold for the higher order terms.

For the second order,
$$g(x)=g(0)+g'(0)x+g''(0)\frac{x^2}2+\cdots$$
$$f(p(x))=f(p_0)+f'(p_0)(p(x)-p_0)+\frac12f''(p_0)(p(x)-p_0)^2+\cdots$$
$$p(x)=p(0)+p'(0)x+\frac12p''(0)x^2+\cdots$$
giving
$$f(p(x))=f(p_0)+f'(p_0)(p'(0)x+\frac12p''(0)x^2+\cdots)+\frac12f''(p_0)(p'(0)x+\frac12p''(0)x^2+\cdots)^2+\cdots$$
and the coefficients of $x^2$ say
$$g''(0)=f'(p(0))p''(0)+f''(p(0))p'^2(0).$$
This matches the second order chain rule.
A: This problem is related to series composition and what you did is almost perfectly correct.
Make a change of variable $(x-3)^2=y$ and use the fact that, around $y=0$ $$e^y=1+y+\frac{y^2}{2}+\frac{y^3}{6}+O\left(y^4\right)\tag 1$$ Now, you just need to replace $y$ by $(x-3)^2$ to get $$e^{(x-3)^2}=1+(x-3)^2+\frac{1}{2} (x-3)^4+\frac{1}{6} (x-3)^6++O\left((x-3)^{8}\right)$$
Take care : there is a typo in your formula ($\frac 14$ should be $\frac 12$).
The problem would have been different say for $e^{\sin(x)}$. You could start using $(1)$ and write $$e^{\sin(x)}=1+\sin(x)+\frac{\sin^2(x)}{2}+\frac{\sin^3(x)}{6}+O\left(\sin^4(x)\right)$$ and use $$\sin(x)=x-\frac{x^3}{6}+O\left(x^5\right)\tag 2$$ Replacing you would get $$e^{\sin(x)}=1+x+\frac{x^2}{2}-\frac{x^4}{8}+O\left(x^5\right)$$ The other way, would have been to write $$e^{\sin(x)}=e^{x-\frac{x^3}{6}+O\left(x^5\right)}$$ and use $y=x-\frac{x^3}{6}+O\left(x^5\right)$ in $(1)$. For sure, the result would be the same.
