## 170- Midterm 2

The exam is here.

Solutions follow.

Problem 1 asks us to compute

$\displaystyle \lim_{x\to0}\frac{\sin x}{e^x-1}$.

Since direct substitution is not possible (leading to $0/0$), we try a different approach.

Method 1: We use L’Hôpital’s rule. Recall that one of the versions of the rule states that if:

1. $\displaystyle \lim_{x\to a}f(x)=\lim_{x\to a}g(x)=0$, and
2. $\displaystyle \lim_{x\to a}\frac{f'(x)}{g'(x)}=A$, then

$\displaystyle \lim_{x\to a}\frac{f(x)}{g(x)}=A$ as well.

(There is another version of the rule, where in item 1. we have instead that $\displaystyle \lim_{x\to a}f(x)=\infty$ and $\displaystyle \lim_{x\to a}g(x)=\infty$, but we do not need this version here.)

Since $(\sin x)'=\cos x$ and $(e^x-1)'=e^x$, and

$\displaystyle \lim_{x\to 0}\frac{\cos x}{e^x}=\frac11=1,$

it follows that

$\displaystyle \lim_{x\to 0}\frac{\sin x}{e^x-1}=1$

as well.

Method 2: We use directly the definition of derivative. Recall that for any function $f$ and any $a$,

$\displaystyle f'(a)=\lim_{\Delta x\to 0}\frac{f(a+\Delta x)-f(a)}{\Delta x}.$

In particular, letting $a=0$ and $f(x)=e^x$, we have $f'(x)=e^x$ so $f'(0)=e^0=1$ and

$\displaystyle 1=f'(0)=\lim_{x\to 0}\frac{f(0+x)-f(0)}{x}=\lim_{x\to 0}\frac{e^x-1}{x}.$

(We have used $x$ instead of $\Delta x$, but of course the name of a variable does not matter.)

Similarly, in lecture we saw that

$\displaystyle \lim_{x\to 0}\frac{\sin x}{x}=1$.

(This is another instance of the same idea: Letting $f(x)=\sin(x)$, we have $f'(x)=\cos x$ and

$\displaystyle \lim_{x\to 0}\frac{\sin x}{x}=\lim_{x\to0}\frac{f(x)-f(0)}{x}=f'(0)=1$

but the fact that $(\sin x)'=\cos x$ ultimately traces back to $\displaystyle \lim_{x\to 0}\frac{\sin x}{x}=1$ (see Section 4.3 in the textbook), so it is better to simply use this limit directly.)

We therefore have

$\displaystyle \lim_{x\to 0}\frac{\sin x}{e^x-1}=\lim_{x\to 0}\frac{\frac{\sin x}{x}}{\frac{e^x-1}{x}}=\frac11=1$.

(Naturally, this coincides with the answer obtained by the first method.)

Problem 2 asks to find $y'$ if $y$ is implicitly given by the equation

$y+x\sin(y)=0.$

We differentiate both sides of this identity, using the product rule and the chain rule in the computation of the left-hand side. We get:

$y'+\sin(y)+x\cos(y)\cdot y'=0'=0.$

We now solve this new equation for $y'$: $y'+x\cos(y)\cdot y'=-\sin y$ or $y'(1+x\cos y)=-\sin y$, or

$\displaystyle y'=-\frac{\sin y}{1+x\cos y}.$

In this particular equation, this method is essentially the only way to compute $y'$, since we cannot solve the equation directly and find a closed formula for $y$ as a function of $x$.

The graphs below show the set of points $(x,y)$ with $y+x\sin(y)=0$. Actually, plotting the graph is (computationally) harder than one would have anticipated. The first one is a poor rendering of the actual curve, and it was obtained with Maple 12 (there are Maple commands to improve the level of detail and get better versions, though). The second one is a bit better, and it was obtained with Grapher (but one still sees a few features that are mistakes introduced by the algorithms used to produce graph).

(Click on the graphs above to enlarge.)

By the way, note how the graph is most definitely not the graph of a function. For example, for the values of $x$ for which there is at least one $y\ne 0$ satisfying $y+x\sin(y)=0$, in fact there are at least two (except when $x=0$). This can be quickly checked: If $x,y\ne 0$ and $y+x\sin(y)=0$ then $(-y)+x\sin(-y)=0$ as well. Moreover, for any $x$, $y=0$ satisfies $y+x\sin(y)=0$. In order to make sense of $y'$, we must therefore restrict ourselves to an appropriate domain and range. As it is the case with the inverse trigonometric functions, we have several options in each case.

Problem 3 asks us to compute $(\cos(\ln x))'$.

This can be done directly using the chain rule, we get

$\displaystyle (\cos(\ln x))'=-\sin(\ln x)\cdot\frac 1x=-\frac{\sin(\ln x)}x.$

Problem 4 gives us the graph of $f(x)=x^x$ for $0\le x\le 1$:

(Click on the graph above to enlarge.)

The problem then asks to check that $f$ indeed has a unique minimum $(x_0,f(x_0))$ in the interval $0\le x\le 1$, and requires that we find it. Then, we must also verify that $f$ is concave up.

Note first that the value of $f(0)$ requires some explanation. One can check using L’Hôpital’s rule that $\displaystyle \lim_{x\to 0^+}x^x=1$, so it makes sense to adopt $1$ as the value of $f$ at 0. To see that the limit is indeed as indicated, note that $x^x=e^{x\ln x}$, so it is enough to check that $\displaystyle \lim_{x\to0^+}x\ln x=0$. Then,

$\displaystyle 1=e^0=e^{\lim_{x\to0^+}x\ln x}=\lim_{x\to 0^+}e^{x\ln x}=\lim_{x\to 0^+}x^x,$

where we can justify the third equality using that the function $e^x$ is continuous.

To compute $\displaystyle \lim_{x\to 0^+}x\ln x$, we use L’Hôpital’s rule, after rewriting $\displaystyle x\ln x=\frac{\ln x}{\frac 1x}$.

Note that $\displaystyle \lim_{x\to0^+}\ln x=-\infty$ and $\displaystyle \lim_{x\to0^+}\frac1x=+\infty$.

Now, $\displaystyle (\ln x)'=\frac1x$ and $\displaystyle \left(\frac1x\right)'=-\frac1{x^2}$, so

$\displaystyle \lim_{x\to0^+}\frac{(\ln x)'}{\left(\frac1x\right)'}=\lim_{x\to0^+}\frac{\frac1x}{-\frac1{x^2}}=\lim_{x\to0^+}-x=0$,

so

$\displaystyle \lim_{x\to 0^+}x\ln x=0$

as well.

To see that $f$ has a unique minimum, we study the $x$ for which $f'(x)=0$. We have that

$\displaystyle (x^x)'=(e^{x\ln x})'=e^{x\ln x}(1\cdot \ln x+x\frac1x)=x^x(1+\ln x)$.

Then $(x^x)'=0$ precisely when $x^x=0$ (which cannot happen if $x>0$, and at $x=0$ we have $f(0)=1$ anyway) or $1+\ln x=0,$ i.e., $\ln x=-1$ or $x=e^{-1}$.

Recall that $\ln x$ is strictly increasing, as can be seen from its graph or from its derivative being $1/x>0$:

It follows that if $x then $1+\ln x<0$ and $f(x)<0$ and if $x>e^{-1}$ then $1+\ln x>0$ and $f(x)>0$. Therefore, when $x=e^{-1}$ the function reaches its unique local (and therefore global) minimum in $0\le x\le 1$. We have $\displaystyle f(e^{-1})=(e^{-1})^{e^{-1}}=\frac1{e^{1/e}}$.

To determine the concavity of $f$, we examine its second derivative. Note that $f'(x)=(x^x)'=x^x(1+\ln x)$, so

$f''(x)=(x^x)'(1+\ln x)+x^x(1+\ln x)'=x^x(1+\ln x)^2+ x^x\cdot 1/x >0$ for all $x>0$, so $f$ is indeed concave up.

Problem 5 asks us to sketch the graph of $y=e^{-\sin(x)}$ for $0\le x\le 2\pi$. Since it is difficult to solve the equation $y''=0$, the graph of $y''$ is included below. The solutions to $y''=0$ are $x\approx 3.808$ and $x\approx 5.617$.

(Click the graph of $y''$ above to enlarge.)

First we look at extreme points of $y=f(x)$. For this, we need to consider $f(0), f(2\pi)$, and the solutions to $f'(x)=0$.

We have that $y'=e^{-\sin x}\cdot(-\cos x)$, so $y'=0$ precisely of $-\cos x=0$, i.e., $x=\pi/2$ or $x=3\pi/2$.

We have:

• $f(0)=e^{-0}=1$,
• $f(\pi/2)=e^{-1}$,
• $f(3\pi/2)=e^{-(-1)}=e$, and
• $f(2\pi)=1$,

so $x=0$ gives us a local maximum, $x=\pi/2$ gives us a local (in fact, global) minimum, $x=3\pi/2$ gives us a local (in fact, global) maximum, and $x=2\pi$ gives us a local minimum.

(This can also be checked by analyzing the sign of $f'$ in the intervals $0, $\pi/2, $3\pi/2, or by looking at the second derivative.)

To determine the concavity of $f$, we consider $f''$. The graph is already given to us. We have that $f''(x)>0$ if $0.

In particular, $f''(\pi/2)>0$, verifying our conclusion that $x=\pi/2$ is a local minimum.

It follows that $f$ is concave up in this interval. Also, we see that $f''(x)<0$ if $3.808.

In particular, $f''(3\pi/2)<0$, verifying our conclusion that $x=3\pi/2$ is a local maximum.

This $f$ is concave down in this interval, and we also have that $x=3.808$ is an inflexion point of $f$. Finally, $f''(x)>0$ for $5.617, so $f$ is concave up in this interval, and $x=5.617$ is another inflexion point.

Combining this with $f(x)>0$ for all $x$, $f(0)=1$, $0, $2.5, and $f(2\pi)=1$, we can now draw a rough sketch of the graph of $f$. The program Grapher was used to produce the image below. The lines in blue indicate the points where the concavity of $f$ changes.

(click the image to enlarge.)

We could of course have computed $f''$ directly. We have that $(e^{-\sin x})'=e^{-\sin x}\cdot(-\cos x)$, so

$(e^{-\sin x})''=(e^{-\sin x})'(-\cos x)+e^{-\sin x}(-\cos x)'$ $=e^{-\sin x}(\cos^2 x+\sin x)$.

To analyze the concavity of $f$, we need to find the zeros of $f$, i.e., we need to solve $e^{-\sin x}(\cos^2 x+\sin x)=0$.

Since $e^{-\sin x}>0$, we need

$(*)$ $\cos^2x+\sin x=0$.

This equation can be solved by combining it with

$(**)$ $\cos^2x+\sin^2x=1$.

We have, subtracting $(*)$ from $(**)$, that

$\sin^2 x-\sin x=1$, or $\sin^2 x-\sin x-1=0$.

This equation can be solved using the quadratic formula. We find that

$\displaystyle \sin x=\frac{1\pm\sqrt{1+4}}{2}=\frac{1\pm\sqrt5}2.$

But $\cos^2x+\sin x=0$, and $\cos^2x\ge0$, so $\sin x\le0$. This means that

$\displaystyle \sin x=\frac{1-\sqrt5}2.$

Unfortunately, there is no closed formula for the corresponding values of $x$ with $0\le x\le 2\pi$. Using a calculator one can easily verify that the two values of $x$ shown above are indeed the solutions to this equation.