# MIT OCW Single Variable Calculus - Week 3

## Implicit differentiation

Implicit differentiation is a technique that allows you to differentiate functions that you may not have even been able to see.

$\frac{\delta}{\delta x}x^2 = ax^{a-1}$

So far we’ve covered the case where $$a$$ is an integer: $$a = 0, \pm 1, \pm 2, \ldots$$. Now we’re going to consider the case where $$a$$ is a rational number: $$a = \frac{m}{n}$$, where m & n are integers.

Example 1

\begin{align} y &= x^{\frac{m}{n}} \qquad \text{(1)} \\ y^n &= x^m \qquad \text{(2)} \end{align}

Now, we apply $$\frac{\delta}{\delta x}$$ to equation (2). We don’t apply to equation (1) because right now, we don’t know how to differentiate it. We do know how to differentiate (2).

\begin{align} \frac{\delta}{\delta x} y^n &= \frac{\delta}{\delta x}x^m \\ \left( \frac{\delta}{\delta y}y^n \right) \frac{\delta y}{\delta x} &= mx^{m-1} \qquad \text{(by the chain rule)} \\ ny^{n-1}\frac{\delta y}{\delta x} &= mx^{m-1} \\ \frac{\delta y}{\delta x} &= \frac{m x^{m – 1}}{n y^{n – 1}} \\ &= \frac{m}{n} \frac{x^{m-1}}{(x^\frac{m}{n})^{n-1}} \\ &= a x^{m-1-(n-1)\frac{m}{n}} \\ &= a x^{m-1-m+\frac{m}{n}} \\ &= a x^{-1 + \frac{m}{n}} \\ &= a x^{a-1} \end{align}

NOTE: THE CHAIN RULE WILL CAUSE YOU ISSUES

Example 2

$x^2 + y^2 = 1$

This is defining $$y$$ as a function of $$x$$ implictily. That means it can be arranged to express $$y$$ in terms of $$x$$.

Solving for y:

\begin{align} y^2 &= 1 – x^2 \\ y &= \pm \sqrt{1 – x^2} \\ y &= (1-x^2)^{\frac{1}{2}} \qquad \text{considering positive branch only} \\ y’ &= \frac{1}{2}(1 – x^2)^{-\frac{1}{2}}(-2x) \\ y’ &= (1 – x^2)^{-\frac{1}{2}}(-x) \\ y’ &= \frac{-x}{\sqrt{1 – x^2}} \end{align}

The above is the explicit differentiation.
Following is the implicit method:

\begin{align} \frac{\delta}{\delta x} (x^2 + y^2 &= 1) \\ 2x + 2yy’ &= 0 \qquad \text{(by the chain rule)} \\ y’ &= -\frac{2x}{2y} \\ y’ &= -\frac{x}{y} \\ \end{align}

The result of the explicit and implicit methods are the same, and the implicit is better than the explicit because it doesn’t differentiate between positive and negative values for $$y$$ and $$x$$.

Example 3

Consider the equation $$y^4 + xy^2 – 2 = 0$$.

We can solve it explicitly: (using the quadratic forumula )

\begin{align} y^2 &= \frac{-x \pm \sqrt{x^2 – 4(-2)}}{2} \\ y &= \pm \sqrt{\frac{-x \pm \sqrt{x^2+8}}{2}} \\ \end{align}

Notice the 4 different roots of the equation (because it’s to the 4th power).
It’s very complex and time consuming.

Compare this to the implicit method:

\begin{align} \frac{\delta}{\delta x}(y^4 + xy^2 -2 = 0) \\ 4y^3y’ + y^2 + x(2yy’) – 0 &= 0 \\ (4y^3 + 2xy)y’ + y^2 &= 0 \\ (4y^3 + 2xy)y’ &= -y^2 \\ y’ &= \frac{-y^2}{4y^3 + 2xy} \end{align}

To solve $$y’$$ in terms of x, we’d need to put the result of the explicit method (so far) into the implicit method. The two go hand in hand.
Although the implicit method hides the conplexity of solving a quartic equation, it still exists, and at some point, we’re going to have to deal with it. That means going through all possible 4 roots to find the answer.

## Inverse functions

The inverse of a function is the function that gets us back to our original arguments. For example:
$y = \sqrt{x} \text{for x \gt 0}, y^2 = x$
if we define these in terms of functions:
$f(x) = \sqrt{x}, g(y) = x, g(y) = y^2$

In general:
$\begin{array}{2,1} y = f(x), g(y) = x \\ g(f(x)) = x, g = f^{-1}, f = g^{-1} \end{array}$

Consider the case of graphing a function and it’s inverse. The inverse can be obtained by swapping the $$x$$ and $$y$$ values, which in effect is mirroring the function along the line $$x = y$$.

Implicit differentiation allows us to find the derivative of any inverse function, provided we know the derivative of the function.

Example 1:

Consider the function:

$y = tan^{-1}x$

which can be rearranged/simplified by taking $$tan$$ of each side:

$tan\;y = x$

This can be graphed as follows:

Recall that

\begin{align} \frac{\delta}{\delta y} tan\;y &= \frac{\delta}{\delta y} \frac{sin\;y}{cos\;y} \\ &= \frac{1}{cos^2y} \end{align}

\begin{align} \frac{\delta}{\delta x} (tan\;y &= x) \\ (\frac{\delta}{\delta y} tan\;y)\frac{\delta y}{\delta x} &= 1 \\ \frac{1}{cos^2y} y’ &= 1 \\ y’ &= cos^2y \end{align}

Where we apply $$\frac{\delta}{\delta x}$$ to both sides (thats why the x turns into a 1). However, we wanted to find $$\frac{\delta}{\delta x}tan^{-1}x$$. We can simplify this by expressing $$cos\;y$$ in terms of it’s defining ratio:

which shows us the hypotenuse is $$\sqrt{1 + x^2}$$. This gives us:

\begin{align} cos\;y &= \frac{1}{\sqrt{1 + x^2}} \\ cos^2y &= \frac{1}{1 + x^2} \end{align}

and then we substitute in the above:

\begin{align} \frac{\delta}{\delta x}tan^{-1}x &= cos^2(tan^{-1}x) \\ &= \frac{1}{1 + x^2} \end{align}

Example 2:

\begin{align} y &= sin^{-1}x \\ sin y &= x \\ (cos\;y)y’ &= 1 \\ y’ &= \frac{1}{cos\;y} \\ y’ &= \frac{1}{\sqrt{1 – sin^2y}} \\ y’ &= \frac{1}{\sqrt{1 – x^2}} \\ \therefore \frac{\delta}{\delta x}sin^{-1}x &= \frac{1}{\sqrt{1 – x^2}} \end{align}

## Exponentials & Logarithms

First, lets review exponents.
Consider some base, $$a$$, such that $$a > 0$$. We know that $$a^0 = 0$$, $$a^1 = a$$, $$a^2 = a \times a$$. Generally:
$a^{x_1 + x_2} = a^{x_1}a^{x_2}$

This is known as the law of exponents. From this we can derive:
$(a^{x_1})^{x_2} = a^{x_1x_2}$

Likewise:
$a^{\frac{m}{n}} = \sqrt[n]{a^m}$

$$a^x$$ is defined for all x by continuity. We can calculate things like $$a^\pi$$ and $$a^{\sqrt{2}}$$ using the rules above.

Example graph of $$y = 2^x$$:

WThe ultimate goal is to be able to solve
$\frac{\delta}{\delta x}a^x$

We can begin by going back to first principles:
\begin{align} \frac{\delta}{\delta x}a^x &= \lim_{\Delta x \to 0} \frac{a^{x + \Delta x} – a^x}{\Delta x} \\ &= \lim_{\Delta x \to 0} \frac{a^x a^{\Delta x} – a^x}{\Delta x} \\ &= \lim_{\Delta x \to 0} a^x \frac{a^{\Delta x} – 1}{\Delta x} \\ &= a^x \lim_{\Delta x \to 0} \frac{a^{\Delta x} – 1}{\Delta x} \end{align}

We move the $$a^x$$ out of the limit, because as the limit tends to 0, $$a^x$$ is constant, and can be moved out of the limit.
Next, lets define a new variable, and express the above equation in a new way:
$M(a) = \lim_{\Delta x \to 0} \frac{a^{\Delta x} – 1}{\Delta x}$
so that
$\frac{\delta}{\delta x}a^x = M(a)a^x$

If we recall back to the start of the course, we can recognise that as the equation of a line, the tangent line. From here, we can work out the slope of $$a^x$$. First, plug in $$a = 0$$ to the above:
\begin{align} \left. \frac{\delta}{\delta x}a^x \right|_{x = 0} &= M(a)a^0 \\ &= M(a) \end{align}

So we can see that the slope of $$a^x$$ at $$x = 0$$ is $$M(a)$$. What is $$M(a)$$?
Solving $$M(a)$$ is difficult. Lets beg the question, and instead, define $$e$$ as the number such that $$M(e) = 1$$.
The consequences of having a number such as $$e$$ are as follows:
\begin{align} \frac{\delta}{\delta x}e^x &= M(e)e^x \\ &= e^x \end{align}
which is based on the above derivation.
Also note that $$M(e)$$ at $$x = 0$$ is 1. That is, the slope of the tangent line at $$x = 0$$ is 1.

How do we know that a number such as $$e$$ exists?

Without defining $$e$$, we can show graphically that it must exist.

Consider the graph of the function $$y = 2^x$$, and compare the tangent line at $$x = 0$$ ($$M(2)$$) to the secant line through the points $$(0,1), (1,2)$$:

Notice the slope of the line $$M(2)$$ is less than the secant.

Now compare the graph of the function $$y = 4^x$$ and compare $$M(4)$$ against the same secant:

Notice the slope of the line is greater than the secant.

This shows that somewhere between the bases of 2 and 4, there is a number where $$M(a) = 1$$.

To fit this concept together with where we left the derivation off, we need to use the natural log.
If $$y = e^x$$, then $$ln\;y = x$$. That is, the natural log is the inverse of $$e^x$$.

A refresher on logarithms:
- $$ln(x_1x_2) = ln\;x_1 + ln\;x_2$$
- $$ln\;1 = 0$$
- $$ln\;e = 1$$

Next, we need to cover computing the derivative of a logarithm. Remember from implicit differentiation, we can compute the derivative of a function if we know the derivative of it’s inverse. That’s the rational behind finding the derivative.

First, lets define $$w = ln\;x$$. Using the above rules of $$ln$$ and $$e$$ we can show that:
\begin{align} e^w &= x \\ \frac{\delta}{\delta x}e^w &= \frac{\delta}{\delta x} x \\ &= 1 \\ (\frac{\delta}{\delta w}e^w)(\frac{\delta w}{\delta x}) &= 1 \\ e^w \frac{\delta w}{\delta x} &= 1 \\ \frac{\delta w}{\delta x} &= \frac{1}{e^w} \\ &= \frac{1}{x} \end{align}

See that $$\frac{\delta}{\delta w}e^w = e^w$$ based on the assumption that $$M(e) = 1$$.
For further info, check the lecture notes for this lecture.

Therefore we get:
$\frac{\delta}{\delta x}ln\;x = \frac{1}{x}$

To summarize, we have these two rates of change:
$\frac{\delta}{\delta x} e^x = e^x$
and
$\frac{\delta}{\delta x} ln\;x = \frac{1}{x}$

With these two derivatives in hand, we can return to the task of solving $$M(a)$$, and so differentiate $$a^x$$. There are two methods we can use to solve any exponential.

Method 1:

Convert the exponential to base $$e$$:
\begin{align} a^x &= (e^{ln\;a})^x \\ &= e^{x\;ln\;a} \end{align}
and then differentiate:
\begin{align} \frac{\delta}{\delta x}a^x &= \frac{\delta}{\delta x}e^{x\;ln\;a} \\ &= (ln\;a)e^{x\;ln\;a} &= (ln\;a)a^x \end{align}
and we can see therefore that $$M(a) = ln\;a$$.

The above works because of 2 things, and can be illustrated as follows:
$\frac{\delta}{\delta x}e^{3x} = 3e^{3x}$
The 3 is the derivative of $$3x$$, and is multiplied by the derivative of $$e^{3x}$$, which is $$e^{3x}$$.
The same is occuring above. $$ln\;a$$ is a constant, and so we differentiate out the $$x$$ and multiply it by the derivative of $$e$$, which is itself.

Method 2:

The second method involves logarithmic differentiation.

Sometimes it’s easier to differentiate the logarithm of a function instead of the function itself.
Lets assume some function $$u$$, and solve:
\begin{align} \frac{\delta}{\delta u} ln\;u &= \left(\frac{\delta ln\;u}{\delta u}\right)\left(\frac{\delta u}{\delta x}\right) \\ &= \frac{1}{u} \frac{\delta u}{\delta x} &= \frac{u’}{u} \end{align}
where we switch notation in the last step.

It’s easy to see where to go now from here to solve for $$a^x$$:
\begin{align} \frac{\delta}{\delta x} a^x \bigg| u = a^x \\ ln\;u &= x\;ln\;a \\ \frac{\delta}{\delta x} x\;ln\;a &= ln\;a \\ (a^x)’ &= (ln\;a)a^x \end{align}

Example 2 of method 2
An example of having moving exponents and a moving base.

Let’s consider the function:
$v = x^x$

Solve $$\frac{\delta}{\delta x} v$$ using logarithmic differentiation:
\begin{align} ln\;v &= x\;ln\;x \\ (ln\;v)’ &= ln\;x(x)’ + x(ln\;x)’ \\ &= ln\;x + x . \frac{1}{x} \\ &= ln\;x + 1 \\ \frac{v’}{v} &= ln\;x + 1 \\ v’ &= v(ln\;x + 1) \\ &= x^x(1 + ln\;x) \end{align}
Where on the second line, we apply the product rule.

Example 3

We’re going to evaluate:
$\lim_{n \to \infty}\left(1 + \frac{1}{n}\right)^n$
$ln \left( \left(1 + \frac{1}{n} \right)^n \right) = n\;ln\left(1 + \frac{1}{n}\right)$
here, we’re going to assign $$\Delta x = \frac{1}{n}$$, which makes $$n = \frac{1}{\Delta x}$$:
$n\;ln \left( 1 + \frac{1}{n} \right) = \frac{1}{\Delta x} (ln(1 + \Delta x) – ln\;1)$
here, we’re adding 0, in the form of $$ln\;1$$.
This results in an equation that matches the form of another equation we know:
\begin{align} \frac{ln(1 + \Delta x) – ln\;1}{\Delta x} &= \frac{\delta}{\delta x}ln\;x \quad \text{at x = 1} \\ &= \frac{1}{x} \quad \text{at x = 1} \\ &= 1 \end{align}
Now we can just work back:
\begin{align} \lim_{n \to \infty}\left( 1 + \frac{1}{n} \right)^n &= e^{\left[ ln \left[ lim_{n \to \infty} \left( 1 + \frac{1}{n} \right)^n \right] \right]} \\ &= e^1 \\ &= e \end{align}