Taylor Series

This week, we’ll work out some Taylor Series expansions of popular functions.

. \[f(x) = 1 / (1-x)\] . \[f(x) = e ^ x\] . \[f(x) = ln(1 + x)\]

For each function, only consider its valid ranges as indicated in the notes when you are computing the Taylor Series expansion. Please submit your assignment as a R-Markdown document.

As per Taylor Series: Taylor series is a representation of a function as an infinite sum of terms that are calculated from the values of the function’s derivatives at a single point.

Taylor Series is defined as \(f(x) = \sum\limits_{n=0}^{\infty}\frac{f^{(n)}(c)}{n!}(x-c)^n\).

Question 1: \(f(x) = 1/(1-x)\)

Find different derivatives.

\(f^0(c) = \frac{1}{(1-c)}\)

\(f'(c) = \frac{1}{(1-c)^2}\)

\(f''(c) = \frac{2}{(1-c)^3}\)

\(f'''(c) = \frac{6}{(1-c)^4}\)

\(f''''(c) = \frac{24}{(1-c)^5}\)

As per definition,

\[ \begin{split} f(x) &= \frac{1}{(1-c)0!}(x-c)^0 + \frac{1}{(1-c)^2 1!}(x-c)^1 + \frac{2}{(1-c)^3 2!}(x-c)^2 + \frac{6}{(1-c)^4 3!}(x-c)^3 + \frac{24}{(1-c)^5 4!}(x-c)^4 + ... \\ &= \frac{1}{(1-c)} + \frac{1}{(1-c)^2}(x-c) + \frac{2!}{(1-c)^3 2!}(x-c)^2 + \frac{3!}{(1-c)^4 3!}(x-c)^3 + \frac{4!}{(1-c)^5 4!}(x-c)^4 + ... \\ &= \frac{1}{(1-c)} + \frac{1}{(1-c)^2}(x-c) + \frac{1}{(1-c)^3}(x-c)^2 + \frac{1}{(1-c)^4}(x-c)^3 + \frac{1}{(1-c)^5}(x-c)^4 + ... \\ &= \sum\limits_{n=0}^{\infty} \frac{1}{(1-c)^{n+1}}(x-c)^n \end{split} \]

Using Maclaurin Series \(f(x)\), \(c=0\), \(f(x) = \sum\limits_{n=0}^{\infty} x^n = 1 + x + x^2 + x^3 + x^4 + ...\).

The series will only converge if \(|x|<1\), the valid range is \((-1, 1)\).

Question 2: \(f(x) = e^x\)

Find different derivatives

\(f^0(c) = e^c\)

\(f'(c) = e^c\)

\(f''(c) = e^c\)

\(f'''(c) = e^c\)

\(f''''(c) = e^c\)

As per the definition,

\[ \begin{split} f(x) &= \frac{e^c}{0!}(x-c)^0 + \frac{e^c}{1!}(x-c)^1 + \frac{e^c}{2!}(x-c)^2 + \frac{e^c}{3!}(x-c)^3 + ...\\ &= e^c + e^c(x-c) + e^c\frac{(x-c)^2}{2!} + e^c\frac{(x-c)^3}{3!} + ...\\ &= e^c \sum\limits_{n=0}^{\infty} \frac{(x-c)^n}{n!} \end{split} \]

using Maclaurin Series \(f(x)\), \(c=0\), \(f(x) = \sum\limits_{n=0}^{\infty} \frac{x^n}{n!} = 1 + x + \frac{x^2}{2} + \frac{x^3}{6} + \frac{x^4}{24} + ...\).

Test Ratio :

\(\frac{a_{n+1}}{a_n} = \frac{x^{n+1}}{(n+1)!}\times\frac{n!}{x^n} = \frac{x \times x^n \times n!}{(n+1)\times n! \times x^n} = \frac{x}{n+1}\)

\(L = \lim\limits_{n\to\infty}\frac{x}{n+1} = 0\) and \(L<1\).

The series will converge for any \(x\), hence the valid range is \((-\infty, \infty)\).

Question 3: \(f(x) = ln(1+x)\)

Find different derivatives.

\(f^0(c) = ln(1+c)\)

\(f'(c) = \frac{1}{c+1}\)

\(f''(c) = -\frac{1}{(c+1)^2}\)

\(f'''(c) = \frac{2}{(c+1)^3}\)

\(f''''(c) = -\frac{6}{(c+1)^4}\)

As per the definition ,

\[ \begin{split} f(x) &= \frac{ln(1+c)}{0!}(x-c)^0 + \frac{1}{(c+1)1!}(x-c)^1 - \frac{1}{(c+1)^2 2!}(x-c)^2 + \frac{2}{(c+1)^3 3!}(x-c)^3 - \frac{6}{(c+1)^4 4!}(x-c)^4 + ...\\ &= ln(1+c) + \frac{1}{(c+1)}(x-c) - \frac{1!}{(c+1)^2 2\times1!}(x-c)^2 + \frac{2!}{(c+1)^3 3\times2!}(x-c)^3 - \frac{3!}{(c+1)^4 4\times3!}(x-c)^4 + ...\\ &= ln(1+c) + \frac{1}{(c+1)}(x-c) - \frac{1}{2(c+1)^2}(x-c)^2 + \frac{1}{3(c+1)^3}(x-c)^3 - \frac{1}{4(c+1)^4}(x-c)^4 + ...\\ &= ln(1+c) + \sum\limits_{n=1}^{\infty} (-1)^{n+1}\frac{(x-c)^n}{n(c+1)^n} \end{split} \]

Using Maclaurin Series of \(f(x)\), \(c=0\), \(f(x) = \sum\limits_{n=1}^{\infty} (-1)^{n+1}\frac{x^n}{n} = x - \frac{x^2}{2} + \frac{x^3}{3} - \frac{x^4}{4} + ...\).

Test Ratio :

\(\frac{a_{n+1}}{a_n} = \frac{(-1)^{n+1+1} x^{n+1}}{n+1}\times\frac{n}{(-1)^{n+1}x^n} = \frac{(-1)^{n+1}\times(-1)\times x \times x^n \times n}{(n+1)(-1)^{n+1}x^n} = \frac{-xn}{n+1}\)

\(L = \lim\limits_{n\to\infty}|\frac{-xn}{n+1}| = |x|\)

The series will converge if \(L<1\) or \(|x|<1\), the valid range is \((-1, 1)\).