Areas Between Curves

Let $y=f(x)$ and $y=g(x)$ be two continuous functions on a closed interval $[a,b]$ such that $f(x)\geq g(x)$ on $[a,b]$ as seen in Figure 1.

Figure 1

The area $A$ of the region between the curves $f(x)$ and $g(x)$ is \begin{align*}A&=\int_a^b f(x)dx-\int_a^b g(x)dx\\&=\int_a^b[f(x)-g(x)]dx\end{align*}

Example. Find the area of the region enclosed by the parabola $y=2-x^2$ and the line $y=-x$.

Solution. First we need to find the $x$-coordinates of the points at which the two curves meet. Set $2-x^2=-x$. Then the quadratic equation $x^2-x-2=0$ has two solutions $x=-1,2$. From Figure 2

Figure 2

we see that the area is \begin{align*}A&=\int_{-1}^2[(2-x^2)-(-x)]dx\\&=\int_{-1}^2(2+x-x^2)dx\\&=\frac{9}{2}\end{align*}

Example. Find the area of the region in the first quadrant that is bounded above by $y=\sqrt{x}$ and below by the $x$-axis and the line $y=x-2$.

Solution. To find the $x$-coordinates of the points at which $y=\sqrt{x}$ and $y=x-2$ meet, set $\sqrt{x}=x-2$. Squaring this equation, we obtain the quadratic equation $x^2-5x+4=0$ whose solutions are $x=-1$ and $x=4$. Since we are considering only the first quadrant $x=-1$ is not our concern. The bounded region is shown in Figure 3.

Figure 3

Note that on $[0,2]$ the part of the region is bounded by $y=\sqrt{x}$ and the $x$-axis and on $[2,4]$ the part of the reagion is bounded by $y=\sqrt{x}$ and $y=x-2$. Hence, the area is \begin{align*}A&=\int_0^2\sqrt{x}dx+\int_2^4[\sqrt{x}-(x-2)]dx\\&=\frac{10}{3}\end{align*}

If $x=f(y)$ and $x=g(y)$ are two continuous functions on a closed interval $[c,d]$ such that $f(y)\geq g(y)$ as seen in Figure 4,

Figure 4

then the area $A$ bounded by $f(y)$ and $g(y)$ is given by $$A=\int_c^d[f(y)-g(y)]dy$$

Example. Redo the previous example by integrating with respect to $y$.

Solution. The same region in Figure 3 can be considered as the region bounded by $x=y^2$ ($y\geq 0$ and $x=y+2$. Hence, $$A=\int_0^2[y+2-y^2]dy=\frac{10}{3}$$

Often the fastest way to find an area may be to combine calculus with geometry. The same region in Figure 3 can be viewed as in Figure 5.

Figure 5

The area of the right triangle in blue is $\frac{1}{2}\cdot 2\cdot 2=2$ hence, the area of the region is $$A=\int_0^4\sqrt{x}dx-2=\frac{10}{3}$$

Applications of Definite Integrals: Solids of Revolution (The Disk Method)

Disk Method

Consider the solid obtained by rotating a region bounded by the function $y=f(x)$ and the $x$-axis, $a\leq x\leq b$.

Figure 1

The cross section of the resulting sold at $x$ is a disk of radius $f(x)$ as seen in Figure 1 and so its area is $A(x)=\pi [f(x)]^2$. Hence the volume of the solid of revolution is \begin{equation}\label{eq:diskmethod}V=\pi\int_a^b [f(x)]^2dx\end{equation}

Example. The region between the curve $y=\sqrt{x}$, $0\leq x\leq 4$ and the $x$-axis is revolved about the $x$-axis. Find the volume of the resulting solid.

Solution. Figure 2 shows the region

Figure 2

and Figure 3 shows the resulting solid.

Figure 3

The volume $V$ is given by $$V=\pi\int_0^4[\sqrt{x}]^2dx=\pi\int_0^4 xdx=8\pi$$

Example. Find the volume of the solid generated by revolving the region bounded by $y=\sqrt{x}$ and the lines $y=1$, $x=4$ about the line $y=1$.

Solution. Figure 4 shows the region

Figure 4

and Figure 5 shows the resulting solid.

Figure 5

Note that the radius of the cross section at $x$ is $\sqrt{x}-1$ and so the volume is given by $$V=\pi\int_1^4[\sqrt{x}-1]^2dx=\frac{7}{6}\pi$$

Example. Find the volume of the solid obtained by revolving the region between the $y$-axis and the curve $x=\frac{2}{y}$, $1\leq y\leq 4$ about the $y$-axis.

Solution. Figure 6 shows the region

Figure 6

and Figure 7 shows the resulting solid.

Figure 7

The area of the cross section at $y$ is $A(y)=\pi\left(\frac{2}{y}\right)^2$. Hence the volume is $$V=\int_1^4 A(y)dy=\pi\int_1^4\left(\frac{2}{y}\right)^2dy=3\pi$$

 

Applications of Definite Integrals: Volumes by Slicing

Consider a solid each of which parallel cross sections has its area represented by the function $A(x)$, $a\leq x\leq b$. The volume element is then given by $dV=A(x)dx$. Hence the volume of the solid is obtained by the integral \begin{equation}\label{eq:volslice}V=\int_{x=a}^{x=b}dV=\int_a^b A(x)dx\end{equation}

Example. Find the volume of a pyramid whose base is a square with side $L$ and whose height is $h$.

Solution. See Figure 1.

Figure 1

We find the ratio $x$ to $h$ $\frac{x}{h}=\frac{\frac{s}{2}}{{\frac{L}{2}}}=\frac{s}{L}$. So we have $s=\frac{L}{h}x$. (Another observation is the line segment $\overline{OP}$ has slope $\frac{\frac{L}{2}}{h}=\frac{L}{2h}$ so the equation of line through $\overline{OP}$ is $y=\frac{L}{2h}x$ and for $y=\frac{s}{2}$ we get $s=\frac{L}{h}x$.) The area $A(x)$ of the cross section at $x$ is $A(x)=s^2=\frac{L^2}{h^2}x^2$. Hence $$V=\int_0^h A(x)dx=\frac{L^2}{h^2}\int_0^h x^2dx=\frac{1}{3}L^2h$$

Example. Show that the volume of a right circular cone whose circular base has radius $r$ and whose height is $h$ is $V=\frac{1}{3}\pi r^2h$.

Solution. Left as an exercise.

Example. Show that the volume of a sphere of radius $r$ is $V=\frac{4}{3}\pi r^3$.

Solution. See Figure 2.

Figure 2

$y=\sqrt{r^2-x^2}$ so $A(x)=\pi y^2=\pi (r^2-x^2)$. Hence the volume $V$ is \begin{align*}V&=\int_{-r}^r A(x)dx\\&=\int_{-r}^r \pi (r^2-x^2)dx\\&=2\pi\int_0^r (r^2-x^2)dx\\&=2\pi\left[r^2x-\frac{x^3}{3}\right]_0^r\\&=\frac{4}{3}\end{align*}

Example. Consider a solid with a circular base of radius 1 whose parallel cross secxtions perpendicular to the base are equilateral triangles. Find the volume of the solid.

Solution. See Figure 3.

Figure 3

From the picture we see that $$A(x)=\frac{1}{2}(2y)(\sqrt{3}y)=\sqrt{3}y^2=\sqrt{3}(1-x^2)$$ Hence the volume $V$ is given by $$V=\int_{-1}^1 A(x)dx=\sqrt{3}\int_{-1}^1(1-x^2)dx=2\sqrt{3}\int_0^1(1-x^2)dx=\frac{4\sqrt{3}}{3}$$

Example. A Curved wedge is cut from a cylinder of radius 3 by two planes. One plane is perpendicular to the axis of the cylinder. The other plane is crossing the first plane at a $45^\circ$ angle at the center of the cylinder.

Solution. See Figure 4.

Figure 4

The cross section at $x$ is the rectangle in blue. It’s area is $$A(x)=\mbox{length}\times\mbox{width}=2\sqrt{9-x^2}\times x=2x\sqrt{9-x^2}$$ Hence the volume $V$ is given by \begin{align*}V&=\int_0^3 2x\sqrt{9-x^2}dx\\&=-\int_9^0\sqrt{u}du\ (u=9-x^2)\\&=\int_0^9\sqrt{u}du\\&=\frac{2}{3}[u^{\frac{3}{2}}]_0^9\\&=18\end{align*}

Approximating Functions with Polynomials

Linear Approximation of $f(x)$ at $a$

As seen in differential calculus, when $x$ is near $a$ the function $f(x)$ can be approximated by the tangent line to $y=f(x)$ at $a$.  (For details see here.) \begin{equation}\label{eq:linapprox}T_1(x)=f(a)+f'(a)(x-a)\end{equation} Note that $T_1(a)=f(a)$ and $T_1′(a)=f'(a)$.

Quadratic Approximation of $f(x)$ at $a$

If the graph of $y=f(x)$ is curved a lot near $a$, a polynomial of higher degree may be preferred for a better approximation, for instance a quadratic polynomial. Let us call such polynomial $T_2(x)$. We require that $T_2(x)$ satisfies $T_2(a)=f(a)$, $T_2′(a)=f'(a)$ and $T_2^{\prime\prime}(a)=f^{\prime\prime}(a)$. We can find $T_2(x)$ be setting $$T_2(x)=f(a)+f'(a)(x-a)+cf^{\prime\prime}(a)(x-a)^2$$ Then the condition $T_2^{\prime\prime}(a)=f^{\prime\prime}(a)$ implies that $c=\frac{1}{2}$. Hence \begin{equation}\label{eq:quadapprox}T_2(x)=f(a)+f'(a)(x-a)+\frac{f^{\prime\prime}(a)}{2!}(x-a)^2\end{equation} There is a reason for the appearance of the factorial notation in the leading coefficient.

Example. Approximation for $\ln x$.

  1. Find the linear approximation to $f(x)=\ln x$ at $a=1$.
  2. Find the quadratic approximation to $f(x)=\ln x$ at $a=1$.
  3. Use these approximations to estimate the value of $\ln(1.05)$.

Solution. $f'(x)=\frac{1}{x}$ and $f^{\prime\prime}(x)=-\frac{1}{x^2}$. So

  1. $T_1(x)=x-1$ and
  2. $T_2(x)=(x-1)-\frac{1}{2}(x-1)^2$.
  3. $T_1(1.05)=0.05$ and $T_2(1.05)=0.04875$. For comparison, the actual value of $\ln(1.05)$ is $0.04879016417\cdots$.

The graphs of y=ln(x) (in black), T_1(x)=x-1 (in blue) and T_2(x)=(x-1)-(x-2)^2/2 (in red)

The $n$-th Order Approximation of $f(x)$ at $a$

The $n$-th order approximation is given by the Taylor polynomial $T_n(x)$ centered at $a$ \begin{equation}\label{eq:taylorpolynomial}T_n(x)=f(a)+\frac{f'(a)}{1!}(x-a)+\frac{f^{\prime\prime}(a)}{2!}(x-a)^2+\cdots+\frac{f^{(n)}(a)}{n!}(x-a)^n\end{equation}

Example. Find the Taylor polynomials $T_1,T_2,\cdots,T_7$ for $f(x)=\sin x$ at $a=0$.

Solution. $T_1(x)=T_2(x)=x$, $T_3(x)=T_4(x)=x-\frac{x^3}{3!}$, $T_5(x)=T_6(x)=x-\frac{x^3}{3!}+\frac{x^5}{5!}$, $T_7(x)=x-\frac{x^3}{3!}+\frac{x^5}{5!}-\frac{x^7}{7!}$.

Example. Use Taylor polynomials of order $n=0,1,2,3$ to approximate $\sqrt{18}$.

Solution. There are two things we need to choose $f(x)$ and $a$. Obviously the function we need to use is $f(x)=\sqrt{x}$. How do we choose $a$ then? There are two things to consider for choosing a suitable $a$. One is $a$ has to be close to 18 and the other is $f(a)=\sqrt{a}$ is a number that can be calculated without a calculator. If we are allowed to use a calculator, the point of doing an approximation is moot. Besides, this is how people were able to calculate a number like $\sqrt{18}$ along time ago when calculators did not exist. In fact, calculators or computers cannot calculate the exact $\sqrt{18}$. What they can do is also approximations using the Taylor polynomials. With the two things in mind, the suitable choice for $a$ would be $a=16$. $f'(x)=\frac{1}{2\sqrt{x}}$, $f^{\prime\prime}(x)=-\frac{1}{4x\sqrt{x}}$, $f^{\prime\prime\prime}(x)=\frac{3}{8x^2\sqrt{x}}$. So, \begin{align*}T_0(x)&=\sqrt{16}=4\\T_1(x)&=4+\frac{1}{8}(x-16)\\T_2(x)&=4+\frac{1}{8}(x-16)-\frac{1}{512}(x-16)^2\\T_3(x)&=4+\frac{1}{8}(x-16)-\frac{1}{512}(x-16)^2+\frac{1}{16,384}(x-16)^3\end{align*} Hence, $T_0(18)=4$, $T_1(18)=4.25$, $T_2(18)=4.242188$, $T_3(18)=4.242676$. The actual value is $\sqrt{18}=4.242640686\cdots$.

When a function $f(x)$ is approximated by a Taylor polynomial $T_n(x)$, the error bound must also be taken into consideration because it can tell us about the accuracy of the approximation. The error is given by the remainder \begin{equation}\label{eq:remainder}R_n(x)=f(x)-T_n(x)\end{equation}

Theorem (Taylor’s Theorem). Let $f$ have continuous derivatives up to $f^{(n+1)}$ on an open interval $I$ containing $a$. Then for all $x$ in $I$, $$f(x)=T_n(x)+R_n(x),$$ where $T_n(x)$ is the $n$-th order Taylor polynomial for $f$ centered at $a$ and the remainder $R_n$ is \begin{equation}\label{eq:remainder2}R_n(x)=\frac{f^{(n+1)}(\xi)}{(n+1)!}(x-a)^{n+1}\end{equation} for some $\xi$ between $x$ and $a$.

Remark. Recall the Mean Value Theorem: If $f(x)$ is continuous on $[a,x]$ and is differentiable on $(a,x)$, then there exists $a<\xi<x$ such that $$\frac{f(x)-f(a)}{x-a}=f'(\xi)$$ or $$f(x)=f(a)+f'(\xi)(x-a)$$ Hence we see that the Taylor’s theorem is a generalization of the Mean Value Theorem.

\eqref{eq:remainder2} can be used to obtain the maximum error bound \begin{equation}\label{eq:errorbd}|R_n(x)|=|f(x)-T_n(x)|\leq M\frac{|x-a|^{n+1}}{(n+1)!}\end{equation}where $|f^{(n+1)}(\xi)|\leq M$ for all $\xi$ between $a$ and $x$.

Example.

  1. What is the maximum error possible in using the approximation $$\sin x\approx x-\frac{x^3}{3!}+\frac{x^5}{5!}$$ when $-0.3\leq x\leq 0.3$? Use this approximation to find $\sin 12^\circ$, correct to six decimal places.
  2. For what values of $x$ is this approximation accurate to within 0.00005?

Solution.

  1. Recall from the second example above $x-\frac{x^3}{3!}+\frac{x^5}{5!}=T_5(x)=T_6(x)$ but we regard it as $T_6(x)$. The reason is that the error $R_6$ is smaller than $R_5$. (This choice is also consistent with the alternating series estimate because $-\frac{x^7}{7!}$ comes after the term $\frac{x^5}{5!}$. See below.) Since $|f^{(7)}(\xi)|=|\cos(\xi)|\leq 1$ for all $\xi$ between 0 and $x$, from \eqref{eq:errorbd}, we have $|R_6(x)|\leq\frac{|x|^7}{7!}=\frac{|x|^7}{5040}$. Since $|x|\leq 0.3$, $|R_6|\leq\frac{(0.3)^7}{5040}\approx 4.3\times 10^{-8}$. Thus the maximum possible error is $4.3\times 10^{-8}$. Note that $T_6(x)$ is an alternating series, so it is actually easier to use the remainder estimate for alternating series $$|R_6|\leq a_7=\frac{|x|^7}{7!}=\frac{|x|^7}{5040}$$ \begin{align*}\sin 12^\circ&=\sin\left(\frac{12\pi}{180}\right)\\&=\sin\left(\frac{\pi}{15}\right)\\&\approx\frac{\pi}{15}-\frac{\left(\frac{\pi}{15}\right)^3}{3!}+\frac{\left(\frac{\pi}{15}\right)^5}{5!}\\&\approx 0.207911694\end{align*} Using the maximum possible error, $$\sin 12^\circ=T_6\left(\frac{\pi}{15}\right)+R_6=0.207911694+0.0000000043=0.207911737$$ So $\sin 12^\circ$ correct to six decimal places is 0.207911.
  2. $\frac{|x|^7}{5040}<0.00005$ so $|x|^7<0.00005\times 5045=0.252$. Hence, $|x|<(0.252)^{\frac{1}{7}}\approx 0.821$.

Example.

  1. Approximate $f(x)=\root 3\of{x}$ by a Taylor polynomial of order (degree) 2 at $a=8$.
  2. How accurate is this approximation when $7\leq x\leq 9$?

Solution.

  1. First we find the following derivatives. \begin{align*}f'(x)&=\frac{1}{3}x^{-\frac{2}{3}}\\f^{\prime\prime}(x)&=-\frac{2}{9}x^{-\frac{5}{3}}\\f^{\prime\prime\prime}(x)&=\frac{10}{27}x^{-\frac{8}{3}}\end{align*} Now $$\root 3\of{x}\approx T_2(x)=2+\frac{1}{12}(x-8)-\frac{1}{288}(x-8)^2$$
  2. Note that the Taylor polynomial is not alternating when $x<8$. So we use \eqref{eq:remainder2} instead for the remainder estimation.\begin{align*}R_2(x)&=\frac{f^{\prime\prime\prime}(\xi)}{3!}(x-8)^3\\&=\frac{10}{27}\xi^{-\frac{8}{3}}\frac{(x-8)^3}{3!}\\&=\frac{5}{81}\frac{(x-8)^3}{\xi^{\frac{8}{3}}}\end{align*} If $7\leq x\leq 9$,  $-1\leq x-8\leq 1$. Since $\xi>7$, $\xi^{\frac{8}{3}}>7^{\frac{8}{3}}>179$. Hence, $$|R_2(x)|\leq\frac{5}{81}\frac{|x-8|^3}{\xi^{\frac{8}{3}}}<\frac{5}{81}\cdot\frac{1}{179}\approx 0.00034485<0.0004$$

A Physical Application

In Einstein’s theory of special relativity, the mass of an object moving with velocity $v$ is \begin{equation}\label{eq:relmass}m=\frac{m_0}{\sqrt{1-\frac{v^2}{c^2}}}\end{equation} where $m_0$ is the mass of the object at rest and $c$ is the speed of light in vacuum spacetime. $m$ in \eqref{eq:relmass} is called the relativistic mass. The kinetic energy is the difference between its total energy and its energy at rest \begin{equation}\label{eq:kenergy}K=mc^2-m_0c^2\end{equation}

  1. Show that when $v\ll c$ (this means $v$ is very small compared with $c$), $K=\frac{1}{2}m_0v^2$.
  2. Use Taylor’s formula to estimate the difference in these expressions for $K$ when $|v|\leq 100$ m/s.

Solution.

  1. First note that \begin{align*}(1+x)^{-\frac{1}{2}}&=1-\frac{1}{2}x+\frac{\left(-\frac{1}{2}\right)\left(-\frac{3}{2}\right)}{2!}x^2+\frac{\left(-\frac{1}{2}\right)\left(-\frac{3}{2}\right)\left(-\frac{5}{2}\right)}{3!}x^3+\cdots\\&=1-\frac{1}{2}x+\frac{3}{8}x^2-\frac{5}{16}x^3+\cdots\end{align*} (For details on how to obtain this read my note on Taylor series here, especially under The Binomial Series.) Thus, \begin{align*}K&=\frac{m_0c^2}{\sqrt{1-\frac{v^2}{c^2}}}-m_0c^2\\&=m_0c^2\left[\left(1-\frac{v^2}{c^2}\right)^{-\frac{1}{2}}-1\right]\\&=m_0c^2\left[\left(1+\frac{1}{2}\frac{v^2}{c^2}+\frac{3}{8}\frac{v^4}{c^4}+\frac{5}{16}\frac{v^6}{c^6}+\cdots\right)-1\right]\\&=m_0c^2\left(\frac{1}{2}\frac{v^2}{c^2}+\frac{3}{8}\frac{v^4}{c^4}+\frac{5}{16}\frac{v^6}{c^6}+\cdots\right)\end{align*} Hence, if $v\ll c$ then $K\approx\frac{1}{2}m_0v^2$.
  2. $R_1(x)=\frac{f^{\prime\prime}(\xi)}{2!}x^2$ where $f(x)=m_0c^2[(1+x)^{-\frac{1}{2}}-1]$ with $x=-\frac{v^2}{c^2}$. $f^{\prime\prime}(x)=\frac{3}{4}m_0c^2(1+x)^{-\frac{5}{2}}$ so $R_1(x)=\frac{3m_0c^2}{8(1+\xi)^{\frac{5}{2}}}\cdot\frac{v^4}{c^4}$ where $-\frac{v^2}{c^2}<\xi<0$. With $c=3\times 10^8$ m/s and $|v|\leq 100$ m/s. we obtain \begin{align*}R_1(x)&\leq\frac{3m_0(9\times 10^{16})}{8\left(1-\frac{100^2}{c^2}\right)^{\frac{5}{2}}}\left(\frac{100}{c}\right)^4\\&<(4.17\times 10^{-10})m_0\end{align*}

Derivatives of Logarithmic and Exponential Functions

In this note, we study derivatives of logarithmic and exponential functions.

Derivatives of Logarithmic Functions

First recall that \begin{equation}\label{eq:euler}\lim_{t\to 0}(1+t)^{\frac{1}{t}}=e\end{equation}\begin{align*}\frac{d}{dx}\ln x&=\lim_{h\to 0}\frac{\ln(x+h)-\ln x}{h}\\&=\lim_{h\to 0}\frac{1}{h}\ln\left(\frac{x+h}{x}\right)\\&=\frac{1}{x}\lim_{h\to 0}\ln\left(1+\frac{h}{x}\right)^{\frac{x}{h}}\\&=\frac{1}{x}\lim_{t\to 0}\ln(1+t)^{\frac{1}{t}}\\&=\frac{1}{x}\end{align*} with $t=\frac{h}{x}$.\begin{equation}\label{eq:dln}\frac{d}{dx}\ln x=\frac{1}{x}\end{equation} Using the change of base formula $\log_ax=\frac{\ln x}{\ln a}$, we obtain \begin{equation}\label{eq:dlog}\frac{d}{dx}\log_ax=\frac{1}{x\ln a}\end{equation}

Derivatives of Exponential Functions

We can find the derivative of the natural exponential function $y=e^x$ using the relationship $x=\ln y$ and implicit differentiation. Differentiating $x=\ln y$ with respect to $x$ we obtain $1=\frac{1}{y}\frac{dy}{dx}$ i.e. $\frac{dy}{dx}=y=e^x$. Hence \begin{equation}\label{eq:dnatexp}\frac{d}{dx}e^x=e^x\end{equation} Note that $a^x=e^{x\ln a}$. So by the chain rule we find $$\frac{d}{dx}a^x=\frac{d}{dx}e^{x\ln a}=e^{x\ln a}\ln a=a^x\ln a$$ Hence\begin{equation}\label{label:dexp}\frac{d}{dx}a^x=a^x\ln a\end{equation}

The Power Rule (General Form)

Let us consider $x^n$ for any $x>0$ and any real number $n$. As we have seen above $x^n=e^{n\ln x}$ so by the chain rule $$\frac{d}{dx}x^n=\frac{d}{dx}e^{n\ln x}=e^{n\ln x}\frac{n}{x}=nx^{n-1}$$ This completes the proof of the general power rule.

Logarithmic Differentiation

The derivatives of functions involving products, quotients, and powers may be found more easily (quickly) by taking the natural logarithm of such functions before differentiating. This allows us to break a complicated function into simpler pieces using properties of the natural logarithm. This whole process, which is called logarithmic differentiation, makes differentiation much easier and quicker.

Example. Use logarithmic differentiation to find the derivative of $y=\frac{x\sqrt{x^2+1}}{(x+1)^{\frac{2}{3}}}$.

Solution. \begin{align*}\ln y&=\ln \frac{x\sqrt{x^2+1}}{(x+1)^{\frac{2}{3}}}\\&=\ln x+\frac{1}{2}\ln(x^2+1)-\frac{2}{3}\ln(x+1)\end{align*} Differentiating with respect to $x$, $$\frac{1}{y}\frac{dy}{dx}=\frac{1}{x}+\frac{x}{x^2+1}-\frac{2}{3(x+1)}$$ Therefore, $$\frac{dy}{dx}=\left[\frac{1}{x}+\frac{x}{x^2+1}-\frac{2}{3(x+1)}\right]\frac{x\sqrt{x^2+1}}{(x+1)^{\frac{2}{3}}}$$

Example. Let $y=x^x$, $x>0$. Find $\frac{dy}{dx}$.

Solution 1. $y=x^x=e^{x\ln x}$ and by the chain rule we obtain $$\frac{dy}{dx}=x^x(1+\ln x)$$

Solution 2. Use logarithmic differentiation. $\ln y=x\ln x$ and differentiating this with respect to $x$, we have $$\frac{1}{y}\frac{dy}{dx}=1+\ln x$$ Hence, $$\frac{dy}{dx}=x^x(1+\ln x)$$

Alternative Approach

In the earlier approach we started out with $e^x$ and regarded $\ln x$ as its inverse function. It can also be done the other way around, namely we first define $\ln x$ and regard $e^x$ as its inverse function. The natural logarithmic function $\ln x$ can be defined by \begin{equation}\label{eq:natlog}\ln x=\int_1^x\frac{1}{t}dt,\ x>0\end{equation} The number $x$ that satisfies the equation $\ln x=1$ is denoted by $e$. All properties of natural logarithm can be derived from definition \eqref{eq:natlog}. Also from definition \eqref{eq:natlog}, we obtain \eqref{eq:dln} by the Fundamental Theorem of Calculus. Using \eqref{eq:dln} one can show the limit $$\lim_{x\to 0}(1+x)^{\frac{1}{x}}=e$$

Proof. Let $f(x)=\ln x$. Then $f'(x)=\frac{1}{x}$ and so $f'(1)=1$. On the other hand, \begin{align*}f'(1)&=\lim_{x\to 0}\frac{f(1+x)-f(1)}{x}\\&=\lim_{x\to 0}\frac{\ln(1+x)}{x}\\&=\lim_{x\to 0}\ln(1+x)^{\frac{1}{x}}\\&=\ln[\lim_{x\to 0}(1+x)^{\frac{1}{x}}]\end{align*} Therefore, $$\lim_{x\to 0}(1+x)^{\frac{1}{x}}=e$$

Remark. By substituting $y=\frac{1}{x}$, $$e=\lim_{y\to\infty}\left(1+\frac{1}{y}\right)^y$$

Remark. An alternative definition of $e$ is as an infinite series $$e=1+\frac{1}{1!}+\frac{1}{2!}+\frac{1}{3!}+\cdots$$ For details see here.