User:Egm6341.s10.Team4.andy/HW1

= Problem 1: Limits=

Given
Refer Lecture slide 2-1 for problem statement


 * {| style="width:70%" border="0" align="center"



f(x) = \frac{e^x - 1}{x} $$ $$
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (1)


 * }.
 * }.

Find
1. Find


 * {| style="width:70%" border="0" align="center"



\lim_{x \rightarrow 0}f(x) $$
 * $$\displaystyle


 * }.
 * }.

2. Plot
 * {| style="width:70%" border="0" align="center"



f(x),\ x\in[0,1] $$
 * $$\displaystyle


 * }.
 * }.

Solution
1. Limit

The Taylor series expansion for $$\displaystyle e^x $$ is given by,


 * {| style="width:70%" border="0" align="center"



\begin{align} e^x &= \sum_{i=0}^n \frac{x^i}{i!} \\ &= 1 + \sum_{i=1}^n \frac{x^i}{i!} \end{align} $$
 * $$\displaystyle


 * }.
 * }.

Dividing throughout by x,


 * {| style="width:70%" border="0" align="center"




 * $$\displaystyle

\Rightarrow \frac{e^x - 1}{x} = \sum_{i=1}^n \frac{x^{i-1}}{i!}

$$


 * }.
 * }.

which is equal to $$\displaystyle f(x)$$ in Equation(1).


 * {| style="width:70%" border="0" align="center"



\begin{align} \Rightarrow f(x) &= \frac{e^x - 1}{x} \\ &= \sum_{i=1}^n \frac{x^{i-1}}{i!} &= \frac{x^0}{1!} + \frac{x^1}{2!} + \frac{x^2}{3!} + \cdots \end{align} $$
 * $$\displaystyle


 * }.
 * }.

Applying limits on both sides,


 * {| style="width:70%" border="0" align="center"




 * $$\displaystyle

\Rightarrow \lim_{x \rightarrow 0}f(x) = \frac{0^0}{1!} + \cancelto{0}{\frac{0^1}{2!}} + \cancelto{0}{\frac{0^2}{3!}} + \cdots

$$


 * }.
 * }.

Hence,


 * {| style="width:70%" border="0" align="center"

$$\displaystyle \Rightarrow \lim_{x \rightarrow 0}f(x) = 1 $$ $$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle \longrightarrow (2)


 * style= |


 * }.
 * }.

2. Plot convergence of $$\displaystyle f(x) $$ .

To visualize the limit as in Equation (2), $$\displaystyle f(x) \to 1 \ as\ x \to 0 $$, two plots are provided below one with $$\displaystyle n = 10 $$ in the Taylor series, & with 10 points on x-axis scale, and another with $$\displaystyle n = 100 $$, & with 100 points on x-axis scale.

Matlab Code:

Plots:

.

= Problem 2: Taylor Series Terms =

Given
Refer Lecture slide 2-3 for problem statement.

From lecture slide 2-2, for a continuous function $$\displaystyle f(x) $$, the Taylor series is given by


 * {| style="width:100%" border="0" align="left"

f(x)= p_n(x) + R_{n+1}(x) $$
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.

such that $$\displaystyle f^{n+1}(x) $$ exists and continuous,


 * {| style="width:100%" border="0" align="left"

f^{n+1}(x) := \frac{d^{n+1}}{dx^{n+1}} f(x) $$
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.

where,


 * {| style="width:100%" border="0" align="left"

p_n(x):= f(x_0) + \frac{(x-x_0)}{1!} f^1(x_0) + \cdots + \frac{(x-x_0)^n}{n!} f^n(x_0) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (1)
 * }.
 * }.

and,


 * {| style="width:100%" border="0" align="left"

R_{n+1}(x):= \frac{1}{n!} \int_{x_0}^{x}(x-t)^nf^{n+1}(t)dt $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (2)
 * }.
 * }.

Find
To find $$\displaystyle p_n(x) $$ and $$\displaystyle R_{n+1}(x) $$ for $$\displaystyle e^x $$.

Solution
Taking $$\displaystyle x_0 = 0 $$, Equation (1) for $$\displaystyle f(x) = e^x $$ becomes,


 * {| style="width:100%" border="0" align="left"

p_n(x)= e^0 + \frac{(x-0)}{1!} e^0 + \frac{(x-0)^2}{2!} e^0 + \cdots + \frac{(x-0)^n}{n!} e^0 $$
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.

which is,


 * {| style="width:100%" border="0" align="left"

$$\displaystyle p_n(x)= 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots + \frac{x^n}{n!} $$ $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style= |
 * $$\displaystyle \longrightarrow (3)


 * }.
 * }.

From Lecture slide 2-3, Equation(2) is given by,


 * {| style="width:100%" border="0" align="left"

R_{n+1}(x)= \frac{(x-x_0)^{n+1}}{(n+1)!} f^{n+1}(\xi) $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle \xi \in [x_0,x] $$
 * $$\displaystyle \longrightarrow (4)
 * }.
 * }.

For $$\displaystyle x_0 = 0 $$ and $$\displaystyle f(x) = e^x $$ Equation (4) becomes,


 * {| style="width:100%" border="0" align="left"

$$\displaystyle R_{n+1}(x)= \frac{x^{n+1}}{(n+1)!} e^\xi $$ $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style = |
 * $$\displaystyle \longrightarrow (5)
 * }.
 * }.

= Problem 3: Infinity Norms =

Given
Refer Lecture slide 3-3 for problem statement.


 * {| style="width:100%" border="0" align="left"

f(x)= sin x $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (1)
 * }.
 * }.


 * {| style="width:100%" border="0" align="left"

g(x)= sin (x-\frac{\pi}{2}) = -cos x $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (2)
 * }.
 * }.

Find
1. Plot $$\displaystyle f(x), g(x) $$ given $$\displaystyle x \in [0,\pi] $$.

2. Find $$\displaystyle \parallel f \parallel_{\infty}, \parallel g \parallel_{\infty}, \parallel f - g\parallel_{\infty} $$

Solution
1. 

Matlab Code:

Plot:

.

2.

The infinity norms are given as,


 * {| style="width:100%" border="0" align="left"

\parallel f \parallel_{\infty} = \underset{x}{max} |f| $$
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.

or


 * {| style="width:100%" border="0" align="left"

\parallel f - g\parallel_{\infty} = \underset{x}{max} |f - g| $$
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.

Min and Max Values from Matlab:

So, the infinity norms are given by,


 * {| style="width:100%" border="0" align="left"

$$\displaystyle \begin{align} \parallel f \parallel_{\infty} &= 1 \\ \parallel g \parallel_{\infty} &= 1 \\ \parallel f - g\parallel_{\infty} &= 1.414214 \end{align} $$
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style="width:35%; padding:10px; border:2px solid #8888aa" |
 * style = |


 * }.

= Problem 4: Integral Mean Value Theorem (IMVT)=

Given
From lecture slide [[media:Egm6341.s10.mtg2.pdf|2-4]], any function $$\displaystyle f(.) $$ continuous on $$\displaystyle [a,b] $$ with $$\displaystyle m = min(f(x)) $$ and $$\displaystyle M =  max(f(x)) $$,


 * {| style="width:70%" border="0" align="center"



m \le f(x) \le M $$ $$
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (1)


 * }
 * }

Find
Lecture Slide [[media:Egm6341.s10.mtg5.pdf|5-1]]:

1. Prove IMVT for non-negative $$\displaystyle W(.) \Rightarrow W \ge 0$$, given by:


 * {| style="width:70%" border="0" align="center"



\int_{a}^{b}W(x)f(x)dx = f(\xi)\int_{a}^{b}W(x)dx $$ $$
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (2)


 * }
 * }

where $$\displaystyle \xi \in [a,b] $$

2. Prove IMVT for non-zero $$\displaystyle W(.) \Rightarrow W \ne 0$$.

Solution
1. $$\displaystyle W(x) \ge 0$$ .

Equation (1),


 * {| style="width:70%" border="0" align="center"



m \le f(x) \le M $$
 * $$\displaystyle


 * }.
 * }.

Multiplying by non-negative $$\displaystyle W(x) $$,


 * {| style="width:70%" border="0" align="center"



\Rightarrow m W(x) \le W(x)f(x) \le M W(x) $$
 * $$\displaystyle


 * }.
 * }.

Integrating from a to b with respect to x,


 * {| style="width:70%" border="0" align="center"



\Rightarrow m \int_{a}^{b} W(x)dx \le \int_{a}^{b} W(x)f(x)dx \le M \int_{a}^{b} W(x)dx $$ $$
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (3)


 * }.
 * }.

Let the integral $$\displaystyle I $$ be,


 * {| style="width:70%" border="0" align="center"



I:=\int_{a}^{b} W(x)dx $$ $$
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (4)
 * }.
 * }.

For $$\displaystyle I = 0 $$, the non-strict inequality Equation (3) holds true. So, we will take the case when $$\displaystyle I > 0$$.

Dividing (4) throughout (3),


 * {| style="width:70%" border="0" align="center"



\Rightarrow m \le \frac{1}{I} \int_{a}^{b} W(x)f(x)dx \le M $$ $$
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (5)


 * }.
 * }.

From Lecture slide [[media:Egm6341.s10.mtg3.pdf|3-4]], we know that for every value in the closed interval $$\displaystyle [a,b] $$ there exists at least a value [need not be unique] $$\displaystyle \xi \in [a,b] $$ such that $$\displaystyle \zeta = f(\xi) = \frac{1}{b-a} \int_{a}^{b} f(x)dx$$, specifically for a continuous function $$\displaystyle f(x) $$.

With the same argument, there exists at least a value $$\displaystyle \xi_1 \in [a,b] $$ such that for a continuous function $$\displaystyle f(x) $$,


 * {| style="width:70%" border="0" align="center"



\Rightarrow \zeta_1 = f(\xi_1) = \frac{1}{I} \int_{a}^{b} W(x)f(x)dx $$ $$
 * $$\displaystyle
 * $$\displaystyle \longrightarrow (6)


 * }.
 * }.

Hence,


 * {| style="width:70%" border="0" align="center"



\Rightarrow f(\xi_1) I = \int_{a}^{b} W(x)f(x)dx $$
 * $$\displaystyle


 * }.
 * }.

proving Equation (2) for a non-negative $$\displaystyle W(x) $$,


 * {| style="width:70%" border="0" align="center"



$$\displaystyle \Rightarrow f(\xi_1) \int_{a}^{b} W(x)dx = \int_{a}^{b} W(x)f(x)dx $$ $$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * $$\displaystyle \longrightarrow (7)
 * style= |


 * }.
 * }.

2. $$\displaystyle W(x) \ne 0$$ .

For the case when $$\displaystyle W(x) > 0$$ the above proof holds.

Next we deal the case when $$\displaystyle W(x) < 0$$.

Multiplying Equation(1) by $$\displaystyle -W(x)$$ (this makes $$\displaystyle W(x) > 0$$ in the below equations),


 * {| style="width:70%" border="0" align="center"



\Rightarrow -m W(x) \ge -W(x)f(x) \ge -M W(x) $$
 * $$\displaystyle


 * }.
 * }.

Integrating from a to b with respect to x gives,


 * {| style="width:70%" border="0" align="center"



\Rightarrow -m \int_{a}^{b} W(x)dx \ge -\int_{a}^{b} W(x)f(x)dx \ge -M \int_{a}^{b} W(x)dx $$ $$
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle \longrightarrow (8)


 * }.
 * }.

Multiplying Equation(8) throughout by -1, we get Equation (3). Right from there, we can prove IMVT following the same procedure as explained above.

= Problem 5: IMVT Appication Example =

Given
The Integral Mean Value Theorem (IMVT) is given by,


 * {| style="width:70%" border="0" align="center"



\int_{a}^{b}W(x)f(x)dx = f(\xi)\int_{a}^{b}W(x)dx $$ $$
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle \longrightarrow (1)


 * }
 * }

where $$\displaystyle \xi \in [a,b] $$

Find
Refer Lecture slide [[media:Egm6341.s10.mtg5.pdf|5-1]] for problem statement.

From Lecture slide [[media:Egm6341.s10.mtg2.pdf|2-2]] the Remainder $$\displaystyle R_{n+1}(x)$$ of the Taylor series is given by,


 * {| style="width:70%" border="0" align="center"



R_{n+1}(x) := \frac{1}{n!} \int_{x_0}^{x} (x-t)^n f^{n+1}(t)dt $$ $$
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle \longrightarrow (2)


 * }.
 * }.

where $$\displaystyle f^{n+1}(t) $$ is the $$\displaystyle (n+1)^{th} $$ derivative of $$\displaystyle f(t) $$.

Using IMVT show that,


 * {| style="width:70%" border="0" align="center"



R_{n+1}(x) = \frac{(x-x_0)^{n+1}}{(n+1)!} f^{n+1}(\xi) $$ $$
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle \longrightarrow (3)


 * }.
 * }.

where $$\displaystyle \xi \in [x_0,x] $$.

Solution
Equation (2) is given by,


 * {| style="width:70%" border="0" align="center"



R_{n+1}(x) := \frac{1}{n!} \int_{x_0}^{x} \underbrace{(x-t)^n}_{W(t)} \underbrace{f^{n+1}(t)}_{g(t)}dt $$ $$
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle \longrightarrow (3)


 * }.
 * }.

Now, using IMVT we can pull out $$\displaystyle g(t) $$ valued at $$\displaystyle \xi $$ resulting in,


 * {| style="width:70%" border="0" align="center"



\Rightarrow R_{n+1}(x) = g(\xi)\frac{1}{n!} \int_{x_0}^{x} \underbrace{(x-t)^n}_{W(t)} dt $$ $$
 * $$\displaystyle
 * <p style="text-align:right;">$$\displaystyle \longrightarrow (4)


 * }.
 * }.

The integrand $$\displaystyle W(t) = (x-t)^n $$ is integrated from $$\displaystyle x_0 $$ to $$\displaystyle x $$. So, $$\displaystyle t \in [x_0,x]$$, which means $$\displaystyle (x-t) \ge 0$$. $$\displaystyle \Rightarrow W(t) \ge 0 $$.


 * {| style="width:70%" border="0" align="center"



\begin{align}
 * $$\displaystyle

\Rightarrow \int_{x_0}^{x} W(t)dt & = \int_{x_0}^{x} {(x-t)^n} dt \\ & = -\frac{1}{n+1} \left [ (x-t)^{n+1}\right]_{x0}^{x} \\ & = -\frac{1}{n+1} \left [ \cancelto{0}{(x-x)^{n+1}} - (x-x_0)^{n+1} \right ] \\ & = -\frac{1}{n+1} \left [- (x-x_0)^{n+1} \right ] \end{align} $$


 * }.
 * }.

So,


 * {| style="width:70%" border="0" align="center"




 * $$\displaystyle

\Rightarrow \int_{x_0}^{x} W(t)dt = \frac{(x-x_0)^{n+1}}{n+1}

$$ $$
 * <p style="text-align:right;">$$\displaystyle \longrightarrow (5)


 * }.
 * }.

Substituting (5) in (4),


 * {| style="width:70%" border="0" align="center"



\begin{align} \Rightarrow R_{n+1}(x) &= g(\xi)\frac{1}{n!} \frac{(x-x_0)^{n+1}}{n+1} \\ &= g(\xi)\frac{(x-x_0)^{n+1}}{(n+1)!} \\ &= f^{n+1}(\xi)\frac{(x-x_0)^{n+1}}{(n+1)!} \end{align} $$
 * $$\displaystyle


 * }.
 * }.

Hence Equation(3) is proved,


 * {| style="width:70%" border="0" align="center"

$$\displaystyle
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |

\Rightarrow R_{n+1}(x):= \frac{1}{n!} \int_{x_0}^{x} (x-t)^n f^{n+1}(t)dt = \frac{(x-x_0)^{n+1}}{(n+1)!} f^{n+1}(\xi)

$$ $$
 * <p style="text-align:right;">$$\displaystyle \longrightarrow (6)
 * style= |
 * }.
 * }.