Week 7 Discussion Notes

Table of Contents

Taylor Polynomials

Taylor polynomials are a generalization of the tangent line. If f(x)f\p{x} is a differentiable function, then the tangent line to ff at x=ax = a is given by

L(x)=f(a)+f(a)(xa).L\p{x} = f\p{a} + f'\p{a}\p{x - a}.

By definition, it's the linear function which passes through the point (a,f(a))\p{a, f\p{a}} and has slope f(a)f'\p{a} or equivalently, the linear function L(x)L\p{x} such that

L(a)=f(a)L(a)=f(a).\begin{aligned} L\p{a} &= f\p{a} \\ L'\p{a} &= f'\p{a}. \end{aligned}

This leads to the following definition:

Definition (Taylor polynomials)

Let f(x)f\p{x} be a function. The nn-th Taylor polynomial of ff centered at x=ax = a, which we denote Tnf(x)T_nf\p{x}, is the unique nn-th degree polynomial whose derivatives agree with ff at x=ax = a:

Tnf(a)=f(a)(Tnf)(a)=f(a)(Tnf)(a)=f(a)(Tnf)(n)=f(n)(a).\begin{aligned} T_nf\p{a} &= f\p{a} \\ \p{T_nf}'\p{a} &= f'\p{a} \\ \p{T_nf}''\p{a} &= f''\p{a} \\ &\hspace{5.5pt}\vdots \\ \p{T_nf}^{\p{n}} &= f^{\p{n}}\p{a}. \end{aligned}

Here, f(n)(a)f^{\p{n}}\p{a} is the nn-th derivative of ff at x=ax = a.

From the definition, we can derive the formula for the Taylor polynomial:

Proposition

The nn-th Taylor polynomial of ff centered at x=ax = a is given by the formula

Tnf(x)=k=0nf(n)(a)n!(xa)n=f(a)+f(a)(xa)+f(a)2!(xa)2++f(n)(a)n!(xa)n.\begin{aligned} T_nf\p{x} &= \sum_{k=0}^n \frac{f^{\p{n}}\p{a}}{n!} \p{x - a}^n \\ &= f\p{a} + f'\p{a}\p{x - a} + \frac{f''\p{a}}{2!}\p{x - a}^2 + \cdots + \frac{f^{\p{n}}\p{a}}{n!}\p{x - a}^n. \end{aligned}

Here, n!=n(n1)(n2)21n! = n\p{n - 1}\p{n - 2} \cdots 2 \cdot 1 is the factorial of nn, and note that 0!=10! = 1.

Example 1.

The fourth degree Taylor polynomial of ff centered at 22 is T4f(x)=1+(x2)+7(x2)24(x2)3+(x2)4T_4f\p{x} = 1 + \p{x - 2} + 7\p{x - 2}^2 - 4\p{x - 2}^3 + \p{x - 2}^4. Determine f(3)(2)f^{\p{3}}\p{2}.

Solution.

Compare T4f(x)T_4f\p{x} with the formula above:

T4f(x)=1+(x2)+7(x2)24(x2)3+(x2)4=f(2)+f(2)(x2)+f(2)2(x2)+f(3)(2)6(x2)3+f(4)(2)24(x2)4.\begin{aligned} T_4f\p{x} &= 1 + \p{x - 2} + 7\p{x - 2}^2 - 4\p{x - 2}^3 + \p{x - 2}^4 \\ &= f\p{2} + f'\p{2}\p{x - 2} + \frac{f''\p{2}}{2}\p{x - 2} + \frac{f^{\p{3}}\p{2}}{6}\p{x - 2}^3 + \frac{f^{\p{4}}\p{2}}{24}\p{x - 2}^4. \end{aligned}

These have to be the same, so the coefficients of (x2)3\p{x - 2}^3 are the same, i.e.,

4=f(3)(2)6    f(3)(2)=24.-4 = \frac{f^{\p{3}}\p{2}}{6} \implies f^{\p{3}}\p{2} = \boxed{-24}.
Example 2.

The fourth degree Taylor polynomial of ff centered at x=1x = 1 is T3f(x)=1+2xx2+7x3x4T_3f\p{x} = 1 + 2x - x^2 + 7x^3 - x^4. Find f(1)f''\p{1}.

Solution.

Be careful not to do this:

The coefficient of x2x^2 is 1-1, so

f(1)1!=1    f(1)=1.\frac{f''\p{1}}{1!} = -1 \implies f''\p{1} = -1.

The Taylor polynomial is centered at x=1x = 1, so you can't just compare coefficients because it's not in the right form: the formula tells you what the coefficients of (x1)k\p{x - 1}^k are, but in our problem, we don't have (x1)\p{x - 1} anywhere.

Instead, you need to use the definition of T3fT_3f, which says that (T3f)(1)=f(1)\p{T_3f}''\p{1} = f''\p{1}, so you need to calculate the second derivative of T3fT_3f at x=1x = 1.

(T3f)(x)=22x+21x24x3(T3f)(x)=2+42x12x2(T3f)(1)=2+4212    f(1)=28.\begin{aligned} \p{T_3f}'\p{x} &= 2 - 2x + 21x^2 - 4x^3 \\ \p{T_3f}''\p{x} &= -2 + 42x - 12x^2 \\ \p{T_3f}''\p{1} &= -2 + 42 - 12 \\ \implies f'\p{1} &= \boxed{28}. \\ \end{aligned}
Example 3.

Find the third degree Taylor polynomial of f(x)=sinxf\p{x} = \sin{x} centered at π\pi.

Solution.

For these types of problems, you just need to calculate the derivatives of ff and plug them into the formula:

f(x)=sinx    f(π)=0f(x)=cosx    f(π)=1f(x)=sinx    f(π)=0f(3)(x)=cosx    f(3)(π)=1\begin{aligned} f\p{x} = \sin{x} &\implies f\p{\pi} = 0 \\ f'\p{x} = \cos{x} &\implies f'\p{\pi} = -1 \\ f''\p{x} = -\sin{x} &\implies f''\p{\pi} = 0 \\ f^{\p{3}}\p{x} = -\cos{x} &\implies f^{\p{3}}\p{\pi} = 1 \end{aligned}

So you get

T3(x)=f(π)+f(π)(xπ)+f(π)2(xπ)2+f(3)(π)6(xπ)3=01(xπ)+0(xπ)2+16(xπ)3=(xπ)+16(xπ)3.\begin{aligned} T_3\p{x} &= f\p{\pi} + f'\p{\pi}\p{x - \pi} + \frac{f''\p{\pi}}{2}\p{x - \pi}^2 + \frac{f^{\p{3}}\p{\pi}}{6}\p{x - \pi}^3 \\ &= 0 - 1 \cdot \p{x - \pi} + 0 \cdot \p{x - \pi}^2 + \frac{1}{6}\p{x - \pi}^3 \\ &= \boxed{-\p{x - \pi} + \frac{1}{6}\p{x - \pi}^3}. \end{aligned}
Example 4.

Calculate the Maclaurin polynomials for f(x)=cosxf\p{x} = \cos{x}.

Solution.

A Maclaurin polynomial is another name for a Taylor polynomial centered at x=0x = 0.

Like in the previous example, we just need to find the derivatives of ff and plug them into the formula, but because the problem doesn't specify which order polynomial to find, we have to find a pattern for the general polynomial:

f(x)=cosx    f(0)=1f(x)=sinx    f(0)=0f(x)=cosx    f(0)=1f(3)(x)=sinx    f(3)(0)=0f(4)(x)=cosx    f(4)(0)=1\begin{aligned} f\p{x} = \cos{x} &\implies f\p{0} = 1 \\ f'\p{x} = -\sin{x} &\implies f'\p{0} = 0 \\ f''\p{x} = -\cos{x} &\implies f''\p{0} = -1 \\ f^{\p{3}}\p{x} = \sin{x} &\implies f^{\p{3}}\p{0} = 0 \\ f^{\p{4}}\p{x} = \cos{x} &\implies f^{\p{4}}\p{0} = 1 \\ &\hspace{11pt}\vdots \end{aligned}

So the derivatives repeat every 44 times and the pattern is 1,0,1,01, 0, -1, 0. From here, it's a good idea to write out a bunch of terms for the polynomials to figure out the pattern, and I recommend not multiplying out numbers:

Tnf(x)=f(0)+f(0)x+f(0)2!x2+f(3)(0)3!x3+f(4)(0)4!x4+f(5)(0)5!x5+f(6)(0)6!x6+=1+0xx22!+0x3+x44!+0x5x66!x6+=1x22!+x44!x66!x6+\begin{aligned} T_nf\p{x} &= f\p{0} + f'\p{0}x + \frac{f''\p{0}}{2!}x^2 + \frac{f^{\p{3}}\p{0}}{3!}x^3 + \frac{f^{\p{4}}\p{0}}{4!}x^4 + \frac{f^{\p{5}}\p{0}}{5!}x^5 + \frac{f^{\p{6}}\p{0}}{6!}x^6 + \cdots \\ &= 1 + 0 \cdot x - \frac{x^2}{2!} + 0 \cdot x^3 + \frac{x^4}{4!} + 0 \cdot x^5 - \frac{x^6}{6!} x^6 + \cdots \\ &= 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} x^6 + \cdots \end{aligned}

From here, the pattern shouldn't be too hard to pick out: it alternates, so there's going to be a (1)n\p{-1}^n term, and there are only even powers of xx, so the coefficients are of the form

(1)kx2k(2k)!.\p{-1}^k \frac{x^{2k}}{\p{2k}!}.

Also, because the odd terms are 00, you know that T2n1f=T2nfT_{2n-1}f = T_{2n}f, so to give the general formula for the Maclaurin polynomials, you only need to give the even order ones:

T2n1f(x)=T2nf(x)=k=0n(1)kx2k(2k)!\boxed{T_{2n-1}f\p{x} = T_{2n}f\p{x} = \sum_{k=0}^n \p{-1}^k \frac{x^{2k}}{\p{2k}!}}

Taylor Series

I didn't talk about this during discussion, but during office hours I ended up doing a couple of examples that I thought would be helpful for the midterm, so I decided to include one in the notes this week.

There are a couple of Taylor series expansions that you want to remember:

f(x)=T(x)11x=n=0xn=1+x+x2+x3+for x(1,1)ex=n=0xnn!=1+x+x22!+x33!+for xRsinx=n=0(1)nx2n+1(2n+1)!=xx33!+x55!x77!+for xRcosx=n=0(1)nx2n(2n)!=1x22!+x44!x66!+for xR\begin{array}{rcllll} \hline \\[-2ex] f\p{x} & = & T\p{x} \\[1ex] \hline \\[-2ex] \displaystyle\frac{1}{1 - x} & = & \displaystyle\sum_{n=0}^\infty x^n & = & \displaystyle 1 + x + x^2 + x^3 + \cdots & \text{for } x \in \p{-1, 1} \\[3ex] e^x & = & \displaystyle\sum_{n=0}^\infty \frac{x^n}{n!} & = & \displaystyle 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots & \text{for } x \in \R \\[3ex] \sin{x} & = & \displaystyle\sum_{n=0}^\infty \p{-1}^n\frac{x^{2n+1}}{\p{2n+1}!} & = & \displaystyle x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \cdots & \text{for } x \in \R \\[3ex] \cos{x} & = & \displaystyle\sum_{n=0}^\infty \p{-1}^n\frac{x^{2n}}{\p{2n}!} & = & \displaystyle 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \cdots & \text{for } x \in \R \\[3ex]\hline \end{array}
Example 5.

Find the Taylor series expansion for f(x)=x3ln(1+x2)f\p{x} = x^3\ln\p{1 + x^2} at x=0x = 0 and determine its interval of convergence.

Solution.

Usually, to do these problems, you don't want to take derivatives and find patterns. Instead, you want to relate your function to the common Taylor series expansions above using a combination of the following operations:

  1. Multiplying by CxkCx^k
  2. Plugging in CxkCx^k
  3. Differentiating
  4. Integrating

Then for our problem, if we can find the Taylor series for ln(1+x2)\ln\p{1 + x^2}, then we can just multiply by x3x^3 to get the one for ff. Similarly, if we can find it for ln(1+x)\ln\p{1 + x}, then we can just plug in x2x^2. So, to get ln(1+x)\ln\p{1 + x}, notice that

11+xdx=ln(1+x)+C.\int \frac{1}{1 + x} \,\diff{x} = \ln\p{1 + x} + C.

Finally, we can get the Taylor series for 11+x\frac{1}{1 + x} by taking the geometric series and plugging in x-x:

11+x=11(x)=n=0(x)n=n=0(1)nxn\frac{1}{1 + x} = \frac{1}{1 - \p{-x}} = \sum_{n=0}^\infty \p{-x}^n = \sum_{n=0}^\infty \p{-1}^n x^n

When you have a convergent power series, you can integrate term-by-term, so we get

ln(1+x)+C=11+xdx=n=0(1)nxndx=n=0(1)nn+1xn+1.\begin{aligned} \ln\p{1 + x} + C &= \int \frac{1}{1 + x} \,\diff{x} \\ &= \sum_{n=0}^\infty \int \p{-1}^n x^n \,\diff{x} \\ &= \sum_{n=0}^\infty \frac{\p{-1}^n}{n + 1} x^{n+1}. \end{aligned}

To find CC, you can just plug in the center and solve for it. In our case, if we plug in x=0x = 0, we get

ln1+C=n=00    C=0.\ln{1} + C = \sum_{n=0}^\infty 0 \implies C = 0.

From here, we can plug in x2x^2 for xx:

ln(1+x2)=n=0(1)nn+1(x2)n+1=n=0(1)nn+1x2n+2\ln\p{1 + x^2} = \sum_{n=0}^\infty \frac{\p{-1}^n}{n + 1} \p{x^2}^{n+1} = \sum_{n=0}^\infty \frac{\p{-1}^n}{n + 1} x^{2n+2}

Finally, we can just multiply by x3x^3 to get

x3ln(1+x2)=x3n=0(1)nn+1x2n+2=n=0(1)nn+1x2n+5.x^3 \ln\p{1 + x^2} = x^3 \sum_{n=0}^\infty \frac{\p{-1}^n}{n + 1} x^{2n+2} = \sum_{n=0}^\infty \frac{\p{-1}^n}{n + 1} x^{2n+5}.

All the operations above don't change the radius of convergence, but the interval of convergence might change. This means the series still converges when x(1,1)x \in \p{-1, 1}, but even though the geometric series doesn't converge at the endpoints, it's possible that this new series does. In other words, you have to check the endpoints at the end to find the interval of convergence:

x=1x = -1:

n=0(1)nn+1(1)2n+5=n=0(1)nn+1(1)2n(1)5=n=0(1)nn+1,\begin{aligned} \sum_{n=0}^\infty \frac{\p{-1}^n}{n + 1} \p{-1}^{2n+5} &= \sum_{n=0}^\infty \frac{\p{-1}^n}{n + 1} \p{-1}^{2n} \p{-1}^5 \\ &= -\sum_{n=0}^\infty \frac{\p{-1}^n}{n + 1}, \end{aligned}

and this converges by the alternating series test.

x=1x = 1:

n=0(1)nn+112n+5=n=0(1)nn+1,\begin{aligned} \sum_{n=0}^\infty \frac{\p{-1}^n}{n + 1} 1^{2n+5} &= \sum_{n=0}^\infty \frac{\p{-1}^n}{n + 1}, \end{aligned}

and like the above, this converges by the alternating series test. Thus, our final answer is

x3ln(1+x2)=n=0(1)nn+1x2n+5for x[1,1].\boxed{ x^3 \ln\p{1 + x^2} = \sum_{n=0}^\infty \frac{\p{-1}^n}{n + 1} x^{2n+5} \quad\text{for } x \in \br{-1, 1} }.

Convergence Tests

Example 6.

Determine whether n=21(lnn)n\displaystyle \sum_{n=2}^\infty \frac{1}{\p{\ln{n}}^n} converges.

Solution.

Generally, you want to start with the divergence test, and then try the root or ratio test. The divergence test is inconclusive here, so now we need to decide between the root or ratio test. Because of the nn in the exponent, the root test should have an easier limit to calculate:

limnan1/n=limn1(lnn)n1/n=limn1lnn=0<1,\lim_{n\to\infty} \abs{a_n}^{1/n} = \lim_{n\to\infty} \abs{\frac{1}{\p{\ln{n}}^n}}^{1/n} = \lim_{n\to\infty} \frac{1}{\ln{n}} = 0 < 1,

so by the root test, the series converges.

Example 7.

Determine whether n=116n34n5+4\displaystyle \sum_{n=1}^\infty \sqrt{\frac{16n^3}{4n^5 + 4}} converges.

Solution.

When you have a fraction, it's a good idea to figure out its limiting behavior. When nn is large, the 44 is insignificant, so you get the heuristic

16n34n5+416n34n5=4n2=2n.\sqrt{\frac{16n^3}{4n^5 + 4}} \approx \sqrt{\frac{16n^3}{4n^5}} = \sqrt{\frac{4}{n^2}} = \frac{2}{n}.

This tells to try the limit comparison test with bn=2nb_n = \frac{2}{n}:

limn16n34n5+42n=limn16n34n5+4n2=limn16n34n5+4n24=limn16n34n5+4n24=limn16n516n5+16=1616=1.\begin{aligned} \lim_{n\to\infty} \frac{\sqrt{\frac{16n^3}{4n^5 + 4}}}{\frac{2}{n}} &= \lim_{n\to\infty} \sqrt{\frac{16n^3}{4n^5 + 4}} \cdot \frac{n}{2} \\ &= \lim_{n\to\infty} \sqrt{\frac{16n^3}{4n^5 + 4}} \cdot \sqrt{\frac{n^2}{4}} \\ &= \lim_{n\to\infty} \sqrt{\frac{16n^3}{4n^5 + 4} \cdot \frac{n^2}{4}} \\ &= \lim_{n\to\infty} \sqrt{\frac{16n^5}{16n^5 + 16}} \\ &= \sqrt{\frac{16}{16}} \\ &= 1. \end{aligned}

n=11n\sum_{n=1}^\infty \frac{1}{n} diverges by the pp-test, and because 11 is between 00 and \infty, the limit comparison test tells you that n=116n34n5+4\sum_{n=1}^\infty \sqrt{\frac{16n^3}{4n^5 + 4}} also diverges.

Example 8.

Show that n=1lnnn2\displaystyle \sum_{n=1}^\infty \frac{\ln{n}}{n^2} converges by direct comparison.

Solution.

If you ever want to use direct comparison with a lnn\ln{n} somewhere, it's a good idea to use the following fact:

limnlnnna=0\lim_{n\to\infty} \frac{\ln{n}}{n^a} = 0

for any positive number aa. You can prove this by L'Hôpital's rule:

limnlnnna=limxlnxxa=limx1xaxa1=limx1axa=0.\lim_{n\to\infty} \frac{\ln{n}}{n^a} = \lim_{x\to\infty} \frac{\ln{x}}{x^a} = \lim_{x\to\infty} \frac{\frac{1}{x}}{ax^{a-1}} = \lim_{x\to\infty} \frac{1}{ax^a} = 0.

Since the limit is 00, this means that eventually, lnnna1\frac{\ln{n}}{n^a} \leq 1. To show that the series converges by direct comparison, we need to find something bigger whose sum converges. We know that eventually, the inequality

0lnnn2nan2=1n2a0 \leq \frac{\ln{n}}{n^2} \leq \frac{n^a}{n^2} = \frac{1}{n^{2-a}}

is true. For the sum of 1n2a\frac{1}{n^{2-a}} to converge, the pp-test tells us that we need 2a>12 - a > 1, or equivalently, we need a<1a < 1. Since aa needs to be positive, we can pick any aa such that 0<a<10 < a < 1, so we can use a=12a = \frac{1}{2}.

With this choice of aa, we know that there exists NN such that if nNn \geq N, then lnnn1/2\ln{n} \leq n^{1/2}, so

0lnnn2n1/2n2=1n3/20 \leq \frac{\ln{n}}{n^2} \leq \frac{n^{1/2}}{n^2} = \frac{1}{n^{3/2}}

if nNn \geq N. By the pp-test, n=N1n3/2\sum_{n=N}^\infty \frac{1}{n^{3/2}} converges, so by direct comparison, n=Nlnnn2\sum_{n=N}^\infty \frac{\ln{n}}{n^2} also converges. Thus, the entire series n=1lnnn2\sum_{n=1}^\infty \frac{\ln{n}}{n^2} converges.