# Understanding the Maclaurin Series

So I have been using the following link to try to understand the Maclaurin Series: Link. I was given an explanation in class, but it didn't explain things enough, so I have tried Khan Academy.

I understand that a Maclaurin series is approximating another function using a polynomial. However, I don't understand the form that is used in both the Khan Academy video, and the explanation my teacher gave me:

So the definition with the a terms is what I learned from my math class, and the one with the f(0) terms is from the Khan academy video.

So focusing on the second one, I have a few questions: Why do the factors and x powers correspond to integrating? For instance, if you look at the third term with x^2 and 1/2, then look at the second term, which multiples by 1/3, it seems like the process of integrating (or anti differentiating, whichever you prefer). Why is that?

Also, is there some intuitive explanation for why we use derivatives in the first place? Why does that, of all things, help us approximate or mimic a function?

I appreciate any help, as I am still grappling with this topic. Thanks!

• – Mauro ALLEGRANZA Oct 26 '18 at 12:59
• @Raptor PERFECT: This video gives me a perfect visualization and explanation of what is happening. If you post this as a solution I will gladly mark it as the answer and upvote. It is the only answer on this thread that really made sense. Thank you!! – Addison Oct 26 '18 at 15:00

There is an excellent YouTuber named 3Blue1Brown who you may have seen on advertisements in this very site. His goal is for "explanations to be driven by animations and for difficult problems to be made simple with changes in perspective."

Here you can find the video he made on the Taylor Series Expansion. I am also learning it right now and it is actually very helpful. Try to check his other videos to intuitively understand the quaternions, the Basel problem, eigenvectors and eigenvalues, etc.

Note: This is by no means a paid advertisement, I am simply a huge fan and he has helped a lot of people understand and love mathematics, including me.

Is there some intuitive explanation for why we use derivatives in the first place? Why does that, of all things, help us approximate or mimic a function?

The derivative $$f'(0)$$ is the slope of the tangent line to the graph of $$f$$ at $$0$$. The tangent line is the graph of the linear function which best approximates $$f$$ near $$0$$. In other words, $$\lim_{x\to 0} \frac{f(x) - (f(0) + mx)}{x} = 0 \iff f'(0) = m$$ If you iterate this process, you'll find that the quadratic function $$q(x) = f(0) + f'(0)x + \frac{1}{2}f''(0) x^2$$ is the quadratic function that best approximates $$f$$ near $$0$$, in the sense that $$\lim_{x\to 0} \frac{f(x) - q(x)}{x^2} = 0$$ And so on.

Why do the factors and x powers correspond to integrating? For instance, if you look at the third term with $$x^2$$ and $$1/2$$, then look at the second term, which multiples by $$1/3$$, it seems like the process of integrating (or anti differentiating, whichever you prefer). Why is that?

These come out of the derivation of Taylor's formula, which is an iterated integration by parts process. Start with $$f(x) = f(0) + \int_0^x f'(t)\,dt$$ Let $$u = f'(t)$$ and $$v = x-t$$. Then $$du = f''(t)\,dt$$ and $$dv = -dt$$. So $$\int_0^x f'(t)\,dt = -\left.(x-t)f'(t)\right|^{t=x}_{t=0} + \int_0^x(x-t)f''(t)\,dt = xf'(0) + \int_0^x(x-t)f''(t)\,dt$$ Now let $$u=f''(t)$$ and $$dv=(x-t)\,dt$$. Then $$du = f'''(t)\,dt$$ and $$v = -\frac{1}{2}(x-t)^2$$. So \begin{align*} \int_0^x(x-t)f''(t)\,dt &= -\left.\frac{1}{2}(x-t)f''(t)\right|^{t=x}_{t=0} + \int_0^x\frac{1}{2}(x-t)^2f'''(t)\,dt \\&= \frac{1}{2}f''(0)x^2 + \int_0^x\frac{1}{2}(x-t)^2f'''(t)\,dt \end{align*} Maybe you can see where this is going. At each step in the integration by parts, we pop off another boundary term $$\frac{f^{(n)}(0)}{n!}x^n$$, and the leftover integral is $$\int_0^x \frac{(x-t)^n}{n!}f^{(n+1)}(t)\,dt$$.

Assume you have a function $$f(x)$$, which you want to approximate. As you mentioned, the first step is to write an infinite sum with unknown coefficients, which will be figured out. $$f(x) = c_0+c_1(x-a)+c_2(x-a)^2+c_3(x-a)^3+...$$ To find $$c_0$$, $$a$$ is set to be equal to $$x$$. $$f(a) = c_0+c_1(x-x)+c_2(x-x)^2+c_3(x-x)^3+...$$ Therefore, all terms including which included $$(x-a)$$ will now be $$(x-x)$$. All such terms will be ignored as they become $$0$$. $$c_0 = f(a)$$ You now look at the derivative of the function $$f(x)$$ so we can mimic the slope. Using the Power Rule for each and every term, you reach the following. $$f’(x) = c_1+2c_2(x-a)+3c_3(x-a)^2+...$$ To find $$c_1$$, $$a$$ is set to be equal to $$x$$. $$f’(a) = c_1+2c_2(x-x)+3c_3(x-x)^2+...$$ Once again, all terms which included $$(x-a)$$ will be canceled. $$f’(a) = c_1$$

You now want to look at the second derivative of the function $$f(x)$$ to mimic the rate at which the slope changes. $$f’’(x) = (1\cdot 2)c_2+(2\cdot 3)c_3(x-a)+...$$ To find $$c_1$$, $$a$$ is set to be equal to $$x$$. $$f’’(a) = (1\cdot 2)c_2+(2\cdot 3)c_3(x-x)+...$$ Once again, all terms which included $$(x-a)$$ will be canceled. This leaves you with $$2c_2$$. $$f’’(a) = (1\cdot 2)c_2 \implies c_2 = \frac{f’’(a)}{1\cdot 2}$$

Now that you get the idea, you repeat the same pattern to reach the polynomial. $$f’’’(a) = (1\cdot 2\cdot 3)c_3 \implies c_3 = \frac{f’’’(a)}{1\cdot 2\cdot 3}$$

$$f^n(a) = (n!)c_n \implies c_n = \frac{f^n(a)}{n!}$$

Therefore, you can rewrite the original polynomial with its coefficients.

$$f(x) = f(a) + f’(a)(x-a) + \frac{f’’(a)}{2!}(x-a)^2 + \frac{f’’’(a)}{3!}(x-a)^3+...$$

This general form is known as the Taylor Series. A McLaurin Series is any such series centered around $$a = 0$$.

Now, look at any term in the polynomial sequence. $$\frac{f^n(0)}{n!}(x)^n$$ We can notice the following pattern which you noted. (Use the Power Rule for fractions.)

$$\frac{d}{dx}\frac{f^n(0)}{n!}(x)^n = \frac{nf^n(0)}{n!}(x)^{n-1} = \frac{f^n(0)}{(n-1)!}(x)^{n-1}$$

Compare the derivative of this $$n^{th}$$ term with the term before it. $$\frac{f^{n-1}(0)}{(n-1)!}(x)^{n-1}$$

They both have the coefficient $$\frac{(x)^{n-1}}{(n-1)!}$$.

For integrating, the pattern is reversed. (Use the Power Rule for integrals.)

$$\int \frac{f^n(0)}{n!}(x)^n dx = \frac{f^n(0)}{(n+1)}(x)^{n+1}+C$$

Compare the integral of this $$n^{th}$$ term with the term after it.

$$\frac{f^{n+1}(0)}{(n+1)!}(x)^{n+1}$$

They both have the coefficient $$\frac{(x)^{n+1}}{(n+1)!}$$.

This answers your question about why the coefficient of the derivative of every term is the same as the coefficient of the term before it, and why the coefficient of the integral of every term is the same as the coefficient of the term after it.

Keep using $$f(x)=f(0)+\int_0^x f'(t) dt$$. For example, $$f(x)=f(0)+\int_0^x (f'(0)+\int_0^t f''(t')dt') dt=f(0)+f'(0)x+\int_0^x dt\int_0^t dt' f''(t').$$We can then rewrite $$f''(t')$$ as $$f''(0)+\int_0^{t'}f^{(3)}(t'')dt''$$, so the next term we pull outside the double integral above is $$f''(0)\int_0^x dt\int_0^t dt'$$. But $$\int_0^x dt\int_0^t dt'$$ integrates over the side-length-$$x$$ 2-dimensional hypercube (i.e. square), selecting the subset with coordinates in order, viz. $$0\le t'\le t\le x$$. Of course, this makes the integral $$\frac{1}{2!}x^2$$. Repeating this logic will give every term of the Maclaurin series.

Assume that the given function $$f(x)$$ and the polynomial $$p(x)$$ perfectly coincide in the neighborhood of $$x=0$$.

So the values coincide at $$0$$

$$p(0)=a_0=f(0).$$

Now we express that the values of the first derivatives coincide at $$x=0$$:

$$p'(0)=a_1=f'(0).$$

Continuing with higher order derivatives,

$$p''(0)=2a_2=f''(0), \\p'''(0)=3!a_3=f'''(0), \\p''''(0)=4!a_3=f''''(0), \\\cdots$$

This is the motivation for the formula.

The Taylor/Maclaurin theorem essentially says that if you know the value and the derivatives of a smooth function at a given point, you can extrapolate to nearby values and the function locally behaves like a polynomial.

The animation below shows successive approximations of $$\log(1+x)$$. Note that for $$x>1$$, Taylor doesn't work anymore (this is explained by the singularity at $$x=-1$$).