# Calculus B(2) HW1
- If you find any issue, please contact R08946015@ntu.edu.tw
- [Suggested Answer to HW2](https://hackmd.io/@noECCnOkTme5TAtLDO0-jA/Bk-G0-TQ_)

:::success
Q1. Find the Taylor polynomial $P_n(x)$ and the error term $R_n(x)$ of order $n$ for the exponential function $f(x)=e^x$ at $x=0$. Show that $\displaystyle \lim_{n\to \infty}R_n(1)=0$, so we have the following series expression for natural exponential $$e=1+1+\frac{1}{2!}+\frac{1}{3!}+\cdots$$
:::
First we have the derivatives of $f(x)$ to be
$$f^{\prime}(x)=e^x, f^{\prime\prime}(x)=e^x, \dots, f^{(n)}(x)=e^x$$ and
$$f^{\prime}(0)=1, f^{\prime\prime}(0)=1, \dots, f^{(n)}(0)=1$$
Hence **the $n$th-degree Taylor polynomial of $f(x)$ at $x=0$** is $$P_n(x) = \sum_{i=0}^{n} \frac{f^{(i)}(0)}{i!}x^i = 1 + \frac{x}{1!} + \frac{x^2}{2!}+\cdots+\frac{x^n}{n!}$$
By Mean Value Theorem(MVT), we have the error term to be
$$R_n(x)=f(x)-P_n(x)=\frac{f^{(n+1)}(c)}{(n+1)!}(x-0)^{n+1}=\frac{e^c\, x^{n+1}}{(n+1)!}$$ for some $c$ between $0$ and $x$.
When $x=1$, $c \in (0,1)$, then $e^c \in (1,e)$, thus we have
$$\lim_{n \to \infty}R_n(1) = \lim_{n \to \infty} \frac{e^c}{(n+1)!}=0$$
Finally, we have
$$e=f(1)=\lim_{n \to \infty}P_n(1) + \lim_{n \to \infty}R_n(1)=1 + 1 + \frac{1}{2!} + \frac{1}{3!} + \cdots$$
:::success
Q2. Determine the radius of convergence for the Taylor expansion of $f(x)=\cos(x)$ at $x=0$. [Hint: Use the alternating series test]
:::
We know that the Taylor expansion of $f(x)=\cos(x)$ at $x=0$ is
$$T(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \frac{x^6}{6!} + \cdots$$
Now rearrange the series, we have
$$T(x) = \sum_{n=0}^{\infty}\frac{(-1)^n}{(2n)!}x^{2n}$$
Remember that
:::info
**Alternating Series Test** If the alternating series
$$\sum_{n=1}^{\infty}(-1)^{n-1}b_n = b_1 - b_2 + b_3 - b_4 + \cdots \qquad (b_n > 0)$$ satisfies the conditions $$1. \ b_{n+1} \leqslant b_n \text{ for all } n \qquad 2. \ \lim_{n \to \infty} b_n = 0$$ then the series is convergent.
:::
In this case, we have $b_n=\dfrac{x^{2n}}{(2n)!}$ and $$\frac{b_{n+1}}{b_n} = \dfrac{x^{2n+2} / (2n+2)!}{x^{2n}/(2n)!}=\frac{x^2}{(2n+2)(2n+1)}$$
Now we fix $x=a$ where $a \in \Bbb R$, then we have $\displaystyle \frac{b_{n+1}}{b_n} = \frac{a^2}{(2n+2)(2n+1)} \leqslant 1$ for all $n \geqslant \frac{\sqrt{a^2+1}-2}{2}$.
Suppose that $m = \lceil\frac{\sqrt{a^2+1}-2}{2}\rceil$, without loss of generality, we can temporarily remove the first $m$ terms (since sum of first $m$ terms must be finite), hence the remain series would satisfy that $b_{n+1} \leqslant b_n$.
And [it's trivial to verify](https://math.stackexchange.com/questions/77550/prove-that-lim-limits-n-to-infty-fracxnn-0-x-in-bbb-r) that $$\lim_{n \to \infty} b_n = \lim_{n \to \infty} \dfrac{a^{2n}}{(2n)!}=0$$
Therefore the series would converge for any $x \in \Bbb R$, thus the radius of convergence is $\Bbb R$.
:::success
Q3. Determine the radius of convergence for the Taylor expansion of $f(x)=\sin^{-1}(x)$ at $x=0$. What is the coefficient of the $10$th term?
:::
First we have $$(\sin^{-1}(x))'=\frac{1}{\sqrt{1-x^2}}=(1 + (-x^2))^{-\frac{1}{2}}$$
Hence we can write the derivative as the form of binomial series
$$(\sin^{-1}(x))'=\sum_{n=0}^{\infty} {\frac{-1}{2} \choose n} (-x^2)^n = \sum_{n=0}^{\infty} {\frac{-1}{2} \choose n} (-1)^n x^{2n}$$
And we know that this binomial series must converge for $|-x^2| < 1$, i.e. $x \in (-1,1)$.
---
By integration, we have the Taylor expansion of $\sin^{-1}x$ to be
$$\int_{0}^{x} \left( \sum_{n=0}^{\infty} {\frac{-1}{2} \choose n} (-1)^n t^{2n} \right) dt = \sum_{n=0}^{\infty} {\frac{-1}{2} \choose n} \frac{(-1)^n}{2n+1} x^{2n+1}$$
The $10$th term is the term with $n=9$, then its coefficient is $${\frac{-1}{2} \choose 9} \frac{(-1)^9}{19}$$
:::info
**Combination**
$${k \choose n} = \frac{k(k-1)(k-2)\cdots(k-n+1)}{n!}$$
For example $${\frac{-1}{2} \choose 5} = \frac{\frac{-1}{2}\cdot\frac{-3}{2}\cdot\frac{-5}{2}\cdot\frac{-7}{2}\cdot\frac{-9}{2}}{1\cdot 2 \cdot 3 \cdot 4 \cdot 5} = -\frac{1 \cdot 3 \cdot 5 \cdot 7 \cdot 9}{2 \cdot 4 \cdot 6 \cdot 8 \cdot 10}$$
:::
<!-- [Method2]
$$\left|\frac{a_{n+1}}{a_n}\right| = \left| \frac{{\frac{-1}{2} \choose n+1} \frac{x^{2n+2}}{2n+3}}{{\frac{-1}{2} \choose n} \frac{x^{2n}}{2n+1}}\right| = \frac{2n+1}{2n+2}\frac{2n+1}{2n+3}x^2$$
Then
$$\lim_{n \to \infty} \left|\frac{a_{n+1}}{a_n}\right| = \lim_{n \to \infty} \frac{2n+1}{2n+2}\frac{2n+1}{2n+3}x^2 = x^2$$ -->
:::success
Q4. Show that for $x \in (-1,1]$,
$$\ln(1+x) = \sum_{j=0}^{\infty}(-1)^j \frac{x^{j+1}}{j+1}$$ Show that $\ln(2)$ can be approximated by $\sum_{j=0}^{n} \frac{(-1)^j}{j+1}=1 - \frac{1}{2} + \frac{1}{3} + \cdots + \frac{(-1)^j}{n+1}$ up to an error at most $\frac{1}{n+2}$
:::
First we have $$(\ln(1+x))'=\frac{1}{1+x}=\sum_{j=0}^{\infty}(-x)^{j}$$
By integration, we have the power expansion to be
$$\ln(1+x) = \int_{0}^{x} \left( \sum_{j=0}^{\infty}(-t)^{j} \right) dt = \sum_{j=0}^{\infty}\frac{(-1)^{j}x^{j+1}}{j+1}$$ for all $|x|<1$.
When $x=1$, the series $\sum_{j=0}^{\infty} \frac{(-1)^{j}}{j+1}$ satisfies the two condition of *Alternating Series Test*, then the series converge for $x=1$, therefore the expansion holds for $x \in (-1,1]$.
---
If we ignore the first $n+1$ terms, the remain terms, or say the error terms would be
\begin{split}
R_{n}(x) &= \int_{0}^{x} \left((-t)^{n+1} + (-t)^{n+2} + (-t)^{n+3} + \cdots \right) dt \\
&= \int_{0}^{x} \left( \sum_{j=0}^{\infty}(-t)^{j} \cdot (-t)^{n+1} \right) dt = \int_{0}^{x} \frac{t^{n+1}}{1+t} \, dt
\end{split}
then put $x=1$,
$$R_n(1) = \int_{0}^{1} \frac{t^{n+1}}{1+t} \, dt \leqslant \int_{0}^{1} t^{n+1} \, dt = \frac{1}{n+2}$$
###### tags: `(109)Calculus B` `Homework`