Consider the following Maclaurin expansion:
$(x+1)^n = 1 + nx + \frac{n(n-1)}{2!}x^2 + \cdots $
I understand why this result is correct, because if we let $f(x) = (x+1)^n$, then
$f'(x) = n(x+1)^{n-1}$,
$f''(x) = n(n-1)(x+1)^{n-1}$,
and so forth. Substituting $x=0$ into each function to get the coefficients, we get
$f(0) = 1$,
$f'(0) = n$,
$f''(0) = n(n-1)$,
each of which correspond to each term in the original Maclaurin expansion as first stated.
However, my textbook then proceeds to use this result to show that
$g(x) = (x^2+1)^{-1} = 1 -x^2 + x^4 + \cdots$
Seemingly on the basis that we may simply substitute $x = x^2$ in the expansion of $f(x)$, like so:
$g(x) = 1 + (-1)(x^2) + \frac{-1\times(-1-1)}{2!}(x^2)^2 + \cdots$
$g(x) = 1 -x^2 + x^4 + \cdots$
There is no explanation as to the rationale behind this move.
In the interests of demonstrating that this operation is valid (namely, blindly substituting $x$ with $x^2$, I found the Maclaurin expansion of $(x^2+1)^n$ to yield the following result:
Let $g(x) = (x^2 + 1)^n$. Then,
$g'(x) = 2xn(x^2 + 1)^{n-1}$
$g''(x) = 4x^2n(n-1)(x^2 + 1)^{n-2}$
And so forth. One can immediately see that all derivatives will be equal to $0$, because of the x term coming outside of the parenthesis:
$g(0) = 1$
$g'(0) = 2(0)(-1)(0^2 + 1)^n = 0$
Generally, $g^{(k)}(0) = 0$ for $k > 0$.
Which finally gives the result that $g(x) = 1$.
But I know that the answer is not $g(x) = 1$. So, I ask, where is the problem with my reasoning?
Nevermind, I realise I made a mistake in calculating $g''(x)$, where I completely disregarded the $x$ outside of the brackets. Using the product rule,
$g''(x) = 4x^2(x^2+1)^{n-2} + 2n(x^2+1)^{n-1}$
And evaluating $g''(0)$,
$g''(0) = 4\times0^2(0^2+1)^{n-2} + 2n(0^2+1)^{n-1} = 2n$
Thus the second term in the Maclaurin series becomes
$\frac{2n}{2!}x^2 = \frac{2(-1)}{2!}x^2 = -x^2$.
Which evaluates to the expected value.