# McLaurin series expansion to evaluate a function

I have a maths assignment due for college based on the McLaurin series and don't understand how to do it. I need to use a McLaurin series expansion to evaluate a function. The function is the solution this differential equation: $$\frac{d^2f}{dx^2} + 5\frac{df}{dx} + 4f = 0,$$ with $df/dx(0) = 0$ and $f(0) = 2$ Can you please help me make a start with this and I will get back to you with any progress I make. Thank you.

Method 1: $$f(x)=f(0)+\frac{f'(0)}{1!}x+\frac{f''(0)}{2!}x^2+\frac{f^{(3)}(0)}{3!}x^3+\cdots$$

You have: $$f(0)=2$$ $$f'(0)=0$$

Replacing that in your differential equation:

$$f''(0) + 5f'(0) + 4f(0) = 0$$ $$f''(0)+5\cdot 0 +4\cdot 2=0$$

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

If you take the derivative of your differential equation:

$$\frac{d^3f}{dx^3} + 5\frac{df^2}{dx^2} + 4\frac{df}{dx} = 0,$$

And evaluating in $0$:

$$\frac{d^3f}{dx^3}(0) + 5f''(0) + 4f'(0) = 0,$$ $$\frac{d^3f}{dx^3}(0)=40$$

In general you can derivate $n$ times to obtain:

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

Which can be evaluated in $0$ to obtain a relationship between the derivatives at $x=0$:

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

Method 2:

Call

$$a_n=f^{(n)}(0)$$

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

Replacing in the differential equation:

$$\frac{d^2f}{dx^2} + 5\frac{df}{dx} + 4f = 0,$$ $$\sum_{n=0}^{\infty} (a_{n+2}+5a_{n+1}+4a_{n}) x^n=0$$

Therefore you have the recurrence relation:

$$a_{n+2}+5a_{n+1}+4a_{n}=0$$ $$a_{0}=2$$ $$a_{1}=0$$

Note: if you are not able to solve the relationship between the coefficients just show a few terms. The recurrence solution is (using wolfram alpha I'm not an expert on this):

$$f^{(n)}(0) = -\frac{2}{3} (-1)^n (4^n-4)$$

• Using Method 1 would I be correct in saying that the next step would be f′′′′(0) + 5f′′′(0) + 4f′′(0) = 0 giving f′′′′(0) + 5.40 + 4.-8 = 0 which gives f′′′′(0) = -168 ? Commented Dec 20, 2014 at 5:53
• @user202149 yes it's correct Commented Dec 20, 2014 at 9:32
• Thanks so much for your help rlartiga, much appreciated. Does the process just continue in this fashion and if so, how far do I need to keep going? Also, could you give an example of what happens if you put in a particular value for the argument x? Do you just place it in each part of the series formula for x, x^2 and so on? And then multiply it by the derivative value/factorial value? Commented Dec 20, 2014 at 19:29
• yes, you just replace. The ideal is solve the recurrence relation (i.e. find the pattern of the coefficients) Commented Dec 20, 2014 at 19:32
• One last thing, is f′(0) always equal to 0 and f(0) always equal to 2 and what's their relevance in the expansion i.e. why choose those 2 values, can different values be used? Commented Dec 20, 2014 at 19:40