I’m a calculus student learning infinite series and sequences for the first time, and I have a question about manipulating the Taylor series for $e^x$ to arrive at one for $e^{2x}$.
My first thought was to say that $$g(x) = e^x = \sum_{n=0}^\infty \frac{x^n}{n!}$$ And $f(x) = x^2$, so $$ e^{2x} = g(f(x)) = \left(\sum_{n=0}^\infty \frac{x^n}{n!}\right)^2 = \sum_{n=0}^\infty \frac{x^{2n}}{(n!)^2} $$ However, this isn’t what my textbook got. It said that I can just set $f(x) = e^x$ and $g(x) = 2x$, meaning that $$f(g(x)) = e^{2x} = \sum_{n=0}^\infty \frac{(2x)^n}{n!}$$ I understand this and think it’s a little simpler than what I originally tried out.
So both of these methods make sense to me, but I got different answers for each of them. What am I doing wrong in the first one?
Note that $$ e^y = \sum_{k=0}^\infty \frac{y^k}{k!} $$ therefore, if $y=2x$ you get $$ e^{2x} = \sum_{k=0}^\infty \frac{(2x)^k}{k!} = \sum_{k=0}^\infty \frac{2^k x^k}{k!} $$
There are issues with what you did. Even though as you claim $$ e^{2x} = \left(e^x\right)^2 = \left(\sum_{k=0}^\infty \frac{x^k}{k!}\right)^2, $$ but squaring that sum is not a simple matter because of the crossing terms, since $$(x+y)^2 = x^2 + y^2 + 2xy \ne x^2 + y^2$$
If you want to continue your method to its logical end, you can use $$ \begin{split} e^{2x} &= \left(\sum_{k=0}^\infty \frac{x^k}{k!}\right) \cdot \left(\sum_{k=0}^\infty \frac{x^k}{k!}\right)\\ &= \sum_{n=0}^\infty \sum_{k=0}^n \frac{x^k}{k!} \frac{x^{n-k}}{(n-k)!} \\ &= \sum_{n=0}^\infty x^n \left( \sum_{k=0}^n \frac{1}{k!(n-k)!}\right) \\ &= \sum_{n=0}^\infty \frac{x^n}{n!} \sum_{k=0}^n \frac{n!}{k!(n-k)!} \\ &= \sum_{n=0}^\infty \frac{x^n}{n!} \sum_{k=0}^n \binom{n}{k} \\ &= \sum_{n=0}^\infty \frac{2^n x^n}{n!}, \end{split} $$ with the last step using the Binomial theorem.