Maclaurin Series – Finding a Function from Its Maclaurin Series

taylor expansion

I recently came across the following:

$\frac{1}{2!}+\frac{2}{3!}+\frac{3}{4!}+\frac{4}{5!}+…=1$

The factorials in the denominators reminded me of a Taylor Series. In particular, I found that it fit the Maclaurin series, evaluated at 1:

$f(x)=f(0)+f'(0)x+\frac{f''(0)}{2!}x^2+\frac{f^{(3)}(0)}{3!}x^3+\frac{f^{(4)}(0)}{4!}x^4+…$

But that it would only do so, given the following:

  1. $f(1)=1$
  2. $f(0)=0$
  3. $f'(0)=0$
  4. $f''(0)=1$
  5. $f^{(3)}(0)=2$
  6. $f^{(4)}(0)=3$

etc…

Is there a method for finding out what function, if one even exists, would yield this Maclaurin series? It would have to be a function for which each subsequent differentiation (evaluated at 0) results in only an incremental factor. I am having trouble imagining how that would be possible, but am curious to see if there's a way to find out.

Best Answer

One method that can be used for this kind of problem is to use the information in the Taylor series to generate a differential equation. Thanks to Zwim in this answer for introducing me to this method.

Finding the Maclaurin series

From the generic Maclaurin series formula, we have $$f(x)=\sum^\infty_{n=0} \frac{f^{(n)}(0)}{n!}x^n.$$

Next, we need to find an expression for those derivative terms.

$$ \begin{align} f(0)&=0 \\ f'(0)&=0\\ f''(0)&=1\\ f'''(0)&=2\\ f^{(4)}(0)&=3\\ ...\\ f^{(n)}(0)&=n-1\end{align}$$

Our full formula for $f(x)$, after plugging in the derivatives (note that our sum starts at $n=1$ because the constant term is zero): $$f(x)=\sum_{n=1}^\infty \frac{n-1}{n!}x^n$$

Finding the differential equation:

Begin by taking the derivative of $f$:

$$ f'(x)=\sum_{n=2}^\infty \frac{n-1}{(n-1)!}x^{n-1} $$

Reindexing:

$$ \begin{align} f'(x)&=\sum_{n=1}^\infty \frac{n}{n!}x^{n} \end {align} $$

Now, expressing $f$ in terms of $f'$:

$$ \begin{align} f(x) & =\sum_{n=1}^\infty \frac{n-1}{n!}x^n \\ &=\left(\sum_{n=1}^\infty \frac{n}{n!}x^n\right)-\left(\sum_{n=1}^\infty \frac{1}{n!}x^n\right) \\ &=f'(x)-e^x+1 \end{align} $$

(Note that the $e^x-1$ in the expression comes from starting the sum at $n=1$ instead of $n=0$ -- the constant term of the exponential Taylor series is missing.) We now have a first-order linear inhomogenous differential equation for $f$.

$$ f-\frac{df}{dx}=-e^x+1 $$

Solving and verifying:

This can be solved by a computer algebra program, by guessing and checking, or by the method of undetermined coefficients (which I was going to use explicitly in this answer, but I don't remember it well enough to explain it).

The answer we get is

$$f(x)=ce^x+xe^x+1.$$

Solving for our initial condition $f(0)=0$:

$$ \begin{align} 0 &= f(0)\\ 0 &= ce^0+0*e^0+1\\ 0 &= c + 1\\ c &= -1 \end{align} $$

Giving us a complete answer of

$$f(x)=-e^x + xe^x + 1.$$

Finally, repeated differentiation gives us the following sequence, verifying that this is indeed a solution to the original question and clarifying exactly why differentiation increments the function value by one.

$$\begin{alignat*}{2} f(x) &= -e^x+ xe^x+1, &f(0) = 0 \\ f'(x) &= xe^x, &f'(0) =0\\ f''(x) &= e^x + xe^x, &f''(0) =1\\ f'''(x) &= 2e^x + xe^x, &f'''(0) =2\\ f''''(x) &= 3e^x + xe^x, &f'''(0) =3\\ ... &... \end{alignat*}$$

Related Question