Differentiating Exponential and Logarithmic Functions

Differentiating Exponential and Logarithmic Functions#

Differentiaing Exponentials#

The exponential function \(e^x\), when differentiated, gives itself. This is shown as the rule below:

\[ \textrm{If }y=e^x\textrm{, then }\frac{dy}{dx} = e^x \]

We can also differentiate when the \(x\) has a coefficient, for example \(y=e^{4x}\), and also when the exponential is multiplied by a constant, for example \(y=3e^x\). We combined these into the rule below:

\[ \textrm{If }y=ae^{bx}\textrm{, then }\frac{dy}{dx} = a\times b\times e^{bx} \]

Example

Differentiate the following with respect to \(x\):

  1. \(y=e^2x\)

  2. \(y=8\exp{\left(-\frac{x}{3}\right)}\)

Solution:

  1. Using the rule:

\[ \textrm{If }y=ae^{bx}\textrm{, then }\frac{dy}{dx} = a\times b\times e^{bx} \]

note \(y=e^2x\), so \(a=1\) and \(b=2\), hence \(\frac{dy}{dx}=2e^{2x}\).

  1. Using the rule:

\[ \textrm{If }y=ae^{bx}\textrm{, then }\frac{dy}{dx} = a\times b\times e^{bx} \]

note \(y=8\exp{\left(-\frac{x}{3}\right)}\), so \(a=8\) and \(b=-\frac{1}{3}\), hence

\[ \frac{dy}{dx}=8\times -\frac{1}{3}\times \exp{\left(-\frac{x}{3}\right)} = -\frac{8}{3}\exp{\left(-\frac{x}{3}\right)}. \]

We can check these results with sympy.

from sympy import symbols, diff, exp

x = symbols('x') 

diff(exp(2 * x))
\[\displaystyle 2 e^{2 x}\]
diff(8 * exp(-x / 3))
\[\displaystyle - \frac{8 e^{- \frac{x}{3}}}{3}\]

Differentiating Logarithms#

We differentiate logarithmic functions using the rule shown below:

\[ \textrm{If }y=\ln{(x)}\textrm{, then }\frac{dy}{dx} = \frac{1}{x} \]

We can differentiate when the \(x\) has a coefficient, for example \(y=\ln{(4x)}\), and also when the logarithmic function has a coefficient, for example \(y=3\ln{(x)}\). We combine these into the rules below:

\[ \textrm{If }y=a\ln{(bx)}\textrm{, then }\frac{dy}{dx} = \frac{a}{x} \]

Example

For \(y=a\ln{(bx)}\), find \(\frac{dy}{dx}\).

Solution: Using laws of logarithms, we can write \(y=a\ln{(bx)}\) as:

\[ y = a\left[\ln{(x)} + \ln{(b)}\right] \]

Now differentiating this as a sum gives:

\[ \frac{dy}{dx} = \frac{d}{dx}\left\{a\left[\ln{(x)} + \ln{(b)}\right]\right\} = a\frac{d}{dx}\left[\ln{(x)}\right] + a\frac{d}{dx}\left[\ln{(b)}\right] \]

Now, as \(\frac{d}{dx}\left[\ln{(x)}\right] = \frac{1}{x}\) and \(\frac{d}{dx}\left[\ln{(b)}\right] = 0\), as \(\ln{(b)}\) is a constant, so we have:

\[ \frac{dy}{dx} = \frac{a}{x} \]

Example

Differentiate:

  1. \(y = \ln{(3x)}\)

  2. \(y = -\frac{4}{5}\ln{\left(\frac{x}{2}\right)}\)

Solution:

  1. We use the rule:

\[ \textrm{If }y=a\ln{(bx)}\textrm{, then }\frac{dy}{dx} = \frac{a}{x} \]

Note that we have \(y=\ln{(3x)}\), so \(a=1\) and \(b=3\). Hence \(\frac{dy}{dx}=\frac{1}{x}\).

  1. We use the rule:

\[ \textrm{If }y=a\ln{(bx)}\textrm{, then }\frac{dy}{dx} = \frac{a}{x} \]

Note that we have \(y=-\frac{4}{5}\ln{\left(\frac{x}{2}\right)}\), so \(a=-\frac{4}{5}\) and \(b=\frac{1}{2}\). Hence \(\frac{dy}{dx} = -\frac{4}{5}\times \frac{1}{x} = -\frac{4}{5x}\).


Again, sympy can be used to show this also.

from sympy import log

diff(log(3 * x))
\[\displaystyle \frac{1}{x}\]
diff(-4 / 5 * log(x / 2))
\[\displaystyle - \frac{0.8}{x}\]