I have troubles understanding why and when you can substitute your variables in a Taylor series. Could somebody help me explain why that is possible? Especially because the derivative often involves the chain rule and product rule at higher derivatives. So it's not very obvious to me.
I will try to give an example of a problem, where you're supposed to do it:
Problem 1) Consider the function $f(x)=\sin \left(\frac{\pi}{2}+x^{2}\right)$.
a) Show that the Taylor polynomial of 4th degree $T_4$ around $x=0$ is given by
$T_{4}(x)=1-\frac{1}{2} x^{4}$.
b) Consider the help function $g(t)=\sin \left(\frac{\pi}{2}+t\right)$. Show that
$\left|g(t)-\left(1-\frac{t^{2}}{2}\right)\right| \leq \frac{1}{24} t^{4}, \quad$ for all $t \in \mathbb{R}$
c) Conclude that:
$\left|f(x)-T_{4}(x)\right| \leq \frac{1}{24} x^{8}, \quad$ for all $x \in \mathbb{R}$
We need the following corollary for b and c):
Corollary 1 (Estimates for remainder): Let $f\in C^{\infty}(I)$. Let $n \in \mathbb{N}$. Let $x_0,x \in I$. Let $M_n \in [0,\infty[$ satisfy:
$M_{n} \geq \max \left\{\left|f^{(n+1)}(t)\right| \mid t \in\left[x_{0}, x\right]\right\},$ if $x_{0} \leq x$
$M_{n} \geq \max \left\{\left|f^{(n+1)}(t)\right| \mid t \in\left[x, x_{0}\right]\right\},$ if $x \leq x_{0}$
Then the following is true:
$\left|\left(R_{n} f\right)(x)\right| \leq \frac{M_{n}}{(n+1) !}\left|x-x_{0}\right|^{n+1}$
Trying to solve the problems:
a) This is pretty straight forward:
$f(x)=\sin \left(\frac{\pi}{2}+x^{2}\right)=cos(x^2)$, $f(0)=1$
$f'(x)=-2 x \sin \left(x^{2}\right)$, , $f'(0)=0$
$f''(x)=-\left(2 \sin \left(x^{2}\right)\right)-4x^{2}\cos \left(x^{2}\right)$, $f''(0)=0$
$f^3(x)=8 x^{3} \sin \left(x^{2}\right)-12 x\cos \left(x^{2}\right)$, $f^3(0)=0$
$f^4(x)=16 x^{4} \cos \left(x^{2}\right)-12 \cos \left(x^{2}\right)+48 x^{2} \sin \left(x^{2}\right)$, $f^4(0)=12$.
So the taylor polynomial becomes:
$T_{4}f(x)=f(0)+\frac{f^{\prime}(0)}{1 !} x+\frac{f^{\prime \prime}(0)}{2 !} x^{2}+\frac{f^{(3)}(0)}{3 !} x^{3}+\frac{f^{(4)}(0)}{4 !} x^{4}=1-\frac{1}{2} x^{4}$.
b) Already here I'm in doubt what they want me to realize. Should I manually calculate the taylor approximation again for $g(t)=cos(t)$ and realize that $1-t^2/2$ is g's taylor polynomial of third degree (or truly second)? Or should I do some substitution?
If I figure out it's the taylor polynomial of third degree, I can say that: $g^4(t)=cos(x)$.
$\max \left\{\left|f^{(4)}(u)\right| \mid u \in\left[0, t\right]\right\}\leq 1,$ if $0 \leq t$
$\max \left\{\left|f^{(4)}(u)\right| \mid u \in\left[t, 0\right]\right\}\leq 1,$ if $t \leq 0$
choose $M_3=1$ and use the corollary s.t.:
$\left|g(t)-\left(1-\frac{t^{2}}{2}\right)\right|=|g(t)-T_3g(t)|=|(R_3g)(t)|\leq \frac{M_{3}}{(4) !}\left|t\right|^{4} = \frac{1}{24} t^{4} $
c) By now I should obviously use some kind of substitution (Which probably should be obvious in the previous question). Why can I just set $t=x^2$ in the results from b) and get the right results?
Your title is about Taylor series but your post doesn't contain a single series. However it does contain Taylor polynomials. Remember that Taylor polynomials are polynomials so we can substitute as usual.
In your particular example you want to substitute $t = x^2$ into the inequality
$$ \left\vert g(t) - \left(1- \frac{t^2}{2}\right)\right\vert \leq \frac{1}{24}t^4 \qquad , \forall t \in \mathbb R$$ As with any substitution we must check that the substitution makes sense ! Since this inequality is true for all $t \in \mathbb R$ it is also true for $t = x^2$ when $x \in \mathbb R$. Therefore we can substitute $t = x^2$ into the inequality and it will still be true. This gives us $$ \left\vert g(x^2) - \left(1- \frac{x^4}{2}\right)\right\vert \leq \frac{1}{24}x^8 \qquad ,\forall x^2 \in \mathbb R$$ which can be rewritten has
$$ \left\vert f(x) - \left(1- \frac{x^4}{2}\right)\right\vert \leq \frac{1}{24}x^8 \qquad ,\forall x \in \mathbb R.$$
Additionnal comments
By substitute as usual i mean that you can do substitution just has with any polynomial. But as usual you must be careful when substituting into inequalities or inequalities. Here's an example. We have the following inequality
$$ x^2 + 2x < 0 \qquad \iff x \in (-2,0).$$
Imagine you want to substitute $g(t)$ into the above inequality. Since the above inequality is only true when $x \in (-2,0)$ we will have
$$ g(t)^2 + 2 g(t) < 0 $$ only when $t$ is such that $g(t) \in (-2,0).$ That is why you can't substitute $x = t^2$ because $t^2 \geq 0$ so $t^2 \not \in (-2,0)$
The reasoning is similar when considering approximations like $e^x \approx 1 + x + x^2/2 + x^3/6$. You know that this approximation is only a good one when $x$ near $0$. Therefore we can also approximate $e^{\cos(t)}$ by $1 + \cos(t) + \frac{\cos^2(t)}{2} + \frac{\cos^3(t)}{6}$ whenever $\cos(t)$ is close to $0$ i.e. when $t$ is near $ \pi/2 + k\pi$ for some $k\in \mathbb Z$. Actually when plotting both $1 + \cos(t) + \frac{\cos^2(t)}{2} + \frac{\cos^3(t)}{6}$ and $e^{\cos(t)}$ you will see that this approximation is actually a very good one.
However, even though it is a good approximation, it is important to notice that the function $\tilde T_3 (t)= 1 + \cos(t) + \frac{\cos^2(t)}{2} + \frac{\cos^3(t)}{6}$ is not a Taylor polynomial for $e^{\cos{(t)}$. In fact it isn't a polynomial at all !!!
By the way this does not exclude us from approximating $e^{\cos(t)}$ by $e^{1 - \frac{t^2}{4} + \frac{t^4}{24}}$ but this approximation is only a good one when $t$ is near $0$.
This is how you can substitute into taylor polynomials.
When it comes to taylor series the reasonning is similar. Let $f \in C^\infty (I)$ and consider the taylor series of $f$ at $a \in I$
$$ \sum_{k \geq 0} \frac{f^{(k)}(a)}{k!} (x-a)^k$$
Suppose also that this series converges on $I$ and that $$ f(x) = \sum_{k \geq 0} \frac{f^{(k)}(a)}{k!} (x-a)^k \qquad \forall x \in I$$
Then we can substitute $x = g(t)$ in the above equality as long as $g(t) \in I$ and we have
$$ f(g(t)) = \sum_{k \geq 0} \frac{f^{(k)}(a)}{k!} (g(t)-a)^k \qquad \forall g(t) \in I.$$
Of course this does not mean that the series $$\sum_{k \geq 0} \frac{f^{(k)}(a)}{k!} (g(t)-a)^k \qquad \forall g(t) \in I $$ is the taylor series of $f(g(t))$ at $a$ ! This is because
As an example consider the taylor series of $e^x$ at $a = 0$
$$ e^x = \sum_{k = 0}^\infty \frac{x^k}{k!} \qquad \forall x \in \mathbb R.$$
Since $\vert x \vert \in \mathbb R$ we have
$$ e^{\vert x \vert } = \sum_{k = 0}^\infty \frac{\vert x\vert^k}{k!} \qquad \forall x \in \mathbb R.$$
This last series is not the Taylor series of $e^{\vert x \vert }$ at $0$. Actually $e^{\vert x \vert }$ is not even differentiable at $x = 0$