# Calculating a Taylor Polynomial of a mystery function

I need to calculate a taylor polynomial for a function $f:\mathbb{R} \to \mathbb{R}$ where we know the following $$f\text{ }''(x)+f(x)=e^{-x} \text{ } \forall x$$ $$f(0)=0$$ $$f\text{ }'(0)=2$$

How would I even start?

-
You want to find the $n$-th derivative of $f(x)$ at $0$. Once you know all of those, you will know the series. Start from $f''(x)+f(x)=e^{-x}$. Put $x=0$. So $f''(0)+f(0)=e^{-0}$, and therefore $f''(0)=1$. Next, differentiate both sides of given equation. We get $f'''(x)+f'(x)=-e^{-x}$. Put $x=0$. We get $f'''(0)=-3$. Differentiate again. We get $f^(4)(x)+f''(x)=e^{-x}$. Put $x=0$. We get $f^{(4)}(0)=?$. Differentiate again. A pattern will become apparent, maybe. – André Nicolas Nov 30 '11 at 6:44
@Andre This was the most straightforward approach. Thanks! – pigishpig Dec 1 '11 at 22:50
Think about the procedure described by J.M. and Didier Piau. It is what you need to do in general. (The solve the DE then expand approach is ordinarily not feasible, so that answer is less relevant.) – André Nicolas Dec 2 '11 at 0:13

The Frobenius method for solving differential equations is easily done: assume an ansatz

$$f(x)=c_0+\sum_{k=1}^\infty c_k x^k$$

and you have the derivatives

\begin{align*} f^\prime(x)&=\sum_{k=1}^\infty k c_k x^{k-1}=c_1+\sum_{k=1}^\infty (k+1)c_{k+1} x^k\\ f^{\prime\prime}(x)&=\sum_{k=1}^\infty k(k+1)c_{k+1} x^{k-1} \end{align*}

From these, you have $c_0=0$ and $c_1=2$ (why?); a relation for the other $c_k$ can be derived by comparing the series coefficients of $f(x)+f^{\prime\prime}(x)$ with the coefficients of $\exp(-x)$.

-

We have the following

$$f''(x) + f(x) = e^{-x}$$ and $f(0) = 0$, $f'(0) = 2$.

And thus we need to find $f^{(n)}(0)$ to construct the Taylor series.

Note that we already have two values and can find $f''(0)$ since

$$f''(0) + f(0) = e^{-0}$$

$$f''(0) +0 = 1$$

$$f''(0) = 1$$

So now we differentiate the original equation and get:

$$f'''(x) + f'(x) = -e^{-x}$$

But since we know $f'(0) = 2$, then

$$f'''(0) + f'(0) = -e^{-0}$$

$$f'''(0) + 2 = -1$$

$$f'''(0) = -3$$

And we have our third value. Differentiating one more time gives

$$f^{IV}(x) + f''(x) = e^{-x}$$

So again we have

$$f^{IV}(0) + f''(0) =1$$

$$f^{IV}(0) + 1 =1$$

$$f^{IV}(0) =0$$

Using this twice more you'll get

$$f^{V}(0) =2$$ $$f^{VI}(0) =1$$ $$f^{VII}(0) =-3$$

In general the equation is saying that

$$f^{(2n+2)}(0) + f^{(2n)}(0) = 1$$

$$f^{(2n+1)}(0) + f^{(2n-1)}(0) = -1$$

which will allow you to get all values.

A little summary of the already known values:

$f(0) = 0$

$f'(0) = 2$

$f''(0) = 1$

$f'''(0) = -3$

$f^{IV}(0) = 0$

$f^{V}(0) = 2$

$f^{VI}(0) = 1$

$f^{VII}(0) = -3$

Do you see a pattern?

-

Hint: Assume that $$f(x)=\sum\limits_{n\geqslant0}a_n\frac{x^n}{n!},\qquad g(x)=\sum\limits_{n\geqslant0}b_n\frac{x^n}{n!},$$ and that $g=f''+f$. Then $$f''(x)=\sum\limits_{n\geqslant0}a_{n+2}\frac{x^n}{n!},$$ hence, for every $n\geqslant0$, $b_n$ is...

To do: Identify $b_n$ for every $n\geqslant0$ and translate the initial conditions on $f$ in terms of $a_0$ and $a_1$.

-

This is a 2nd order linear non-homogeneous ODE with solution $f(x)=\frac{-1}{2}\cos x + \frac{5}{2} \sin x + \frac{1}{2} e^{-x}$. With the Taylor series for $\sin(x),\cos(x),$ and $e^{-x}$ in hand, you should be able to compute the series for $f$ straightforwardly.

-
Great. Now, how did you obtain your explicit solution? – J. M. Dec 1 '11 at 5:40
@Adam Consider expanding a little if you don't want downvotes. – Pedro Tamaroff Feb 17 '12 at 3:52
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}