Quotient Rule

Quotient Rule#

A quotient looks like a fraction with one function being divided by another function, for example:

\[ y = \frac{x^3}{e^{3x}}. \]

When we have a function in the form of a quotient, we differentiate it using the quotient rule:

If the function \(f(x)\) is written as a quotient, so

\[ y = \frac{u(x)}{v(x)}\;\;\text{then}\;\;\frac{dy}{dx} = \frac{v\frac{du}{dx} - u\frac{dv}{dx}}{v^2} \]

So returning to \(y=\frac{x^3}{e^{3x}}\), we have \(u=x^3\) and \(v=e^{3x}\).

Hence \(\frac{du}{dx} = 3x^2\), \(\frac{dv}{dx} = 3e^{3x}\), and \(v^2 = e^{6x}\). Then substitute into the quotient rule,

\[\begin{split} \begin{aligned} \frac{dy}{dx} & = \frac{v\frac{du}{dx} - u\frac{dv}{dx}}{v^2} \\ & = \frac{e^{3x}3x^2 - x^33e^{3x}}{e^{6x}} \\ & = 3x^2e^{-3x}(1-x) \end{aligned} \end{split}\]

The quotient rule is, naturally, present in sympy.

from sympy import symbols, diff, exp, simplify

x = symbols('x')
simplify(diff((x ** 3) / (exp(3 * x))))
\[\displaystyle 3 x^{2} \left(1 - x\right) e^{- 3 x}\]

Example

Differentiate \(y = \frac{\sin(x)}{3\ln(x)}\).

Solution: Just like in the previous example, we have \(u\) to be the numerator and \(v\) to be the denominator of the fraction, so \(u = \sin(x)\) and \(v=3\ln(x)\). We can now differentiate these to get \(\frac{du}{dx} = \cos(x)\) and \(\frac{dv}{dx} = \frac{3}{x}\).

  • Using the quotient rule, we get that:

\[ \frac{dy}{dx} = \frac{v\frac{du}{dx} - u\frac{dv}{dx}}{v^2} \]
  • Substitute in what we have:

\[ \frac{dy}{dx} = \frac{3\ln(x) \times \cos(x) - \sin(x) \times \frac{3}{x}}{[3\ln(x)]^2} \]
  • We can simplify:

\[ \frac{dy}{dx} = \frac{3\ln(x)\cos(x) - \frac{3\sin(x)}{x}}{9\ln(x)^2} \]
  • A factor of 3 can be taken out:

\[ \frac{dy}{dx} = \frac{\ln(x) \cos(x) - \frac{\sin(x)}{x}}{3\ln(x)^2} \]

In Python,

from sympy import sin, log

simplify(diff(sin(x) / (3 * log(x))))
\[\displaystyle \frac{x \log{\left(x \right)} \cos{\left(x \right)} - \sin{\left(x \right)}}{3 x \log{\left(x \right)}^{2}}\]

Example

Differentiate \(y = \frac{x}{e^{2x}}\)

Solution: We have a function \(x\) divided by a function \(e^{2x}\), so to find the derivative the quotiet rule needs to be used. So \(u=x\) and \(v=e^{2x}\), and, therefore, \(\frac{du}{dx} = 1\) and \(\frac{dv}{dx} = 2e^{2x}\).

  • We can now employ the quotient rule to get:

\[ \frac{dy}{dx} = \frac{v\frac{du}{dx} - u\frac{dv}{dx}}{v^2} \]
  • Substitute what we know in:

\[ \frac{dy}{dx} = \frac{e^{2x} \times 1 - x \times 2e^{2x}}{(e^{2x})^2} \]
  • Simplifying this by taking a factor of \(e^{2x}\) out:

\[ \frac{dy}{dx} = \frac{e^{2x}(1-2x)}{(e^{2x})^2} \]
  • The \(e^{2x}\) on top cancels with one on the bottom:

\[ \frac{dy}{dx} = e^{-2x}(1-2x) \]

And again, in Python.

simplify(diff(x / (exp(2 * x))))
\[\displaystyle \left(1 - 2 x\right) e^{- 2 x}\]

Partial Pressures

During the reaction N2O4 ⇄ 2NO2, the partial pressure of N2O4 is given by the expression,

\[ p_{(\text{N}_2\text{O}_4)} = \frac{1-\zeta}{1+\zeta} \]

Find \(\frac{dp}{d\zeta}\).

Solution: We notice that \(p\) is the quotient of two functions involving \(\zeta\), this means that we should use the quotient rule when differentiating. So we have \(u=1-\zeta\) and \(v=1+\zeta\). Differentiating gives us \(\frac{du}{d\zeta} = -1\) and \frac{dv}{d\zeta} = 1$.

  • We than utilise the quotient rule to find that:

\[ \frac{dp}{d\zeta} = \frac{v\frac{du}{d\zeta} - u\frac{dv}{d\zeta}}{v^2} \]
  • So we first substitute:

\[ \frac{dp}{d\zeta} = \frac{(1 + \zeta) \times -1 - (1 - \zeta) \times 1}{(1 + \zeta)} \]
  • Expand the brackets:

\[ \frac{dp}{d\zeta} = \frac{-1 - \zeta - 1 + \zeta}{(1 + \zeta)} \]
  • Simplifying the numerator:

\[ \frac{dp}{d\zeta} = \frac{-2}{(1 + \zeta)} \]

Of course, Python can achieve this with the ζ symbol.

zeta = symbols('zeta')

simplify(diff((1 - zeta) / (1 + zeta)))
\[\displaystyle - \frac{2}{\left(\zeta + 1\right)^{2}}\]