# Derivatives of Quotients
## Quotient Rule
When we have a function that is a ratio of two functions, we can use *quotient rule* to take the derivative.
<span style = "background-color:lightblue"> **Quotient Rule (Prime Notation):** <br> <br> </span> If $f(x) = \displaystyle\frac{A}{B}$, then $f'(x) = \displaystyle\frac{A'B - AB'}{B^2}.$
<span style = "background-color:lightblue"> **Quotient Rule (Leibnitz Notation):** <br> <br> </span> If $y = \displaystyle\frac{A}{B}$, then $\displaystyle\frac{dy}{dx} = \displaystyle\frac{\displaystyle\frac{dA}{dx} B - A \displaystyle\frac{dB}{dx}}{B^2}$
---
## Demonstration
Here is a basic example of using quotient rule to find a derivative.
<iframe width="560" height="315" src="https://www.youtube.com/embed/jV_9zVkv1bs" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
---
## Exercises/Examples
<span style = "background-color:lightblue"> **Example 1.** </span> $f(x) = \displaystyle\frac{x^5}{2^x}$
:hammer: **Solution 1:** We set $A = x^5$ and $B = 2^x$.
We have $A' = 5x^4$ and $B' = \ln(2) 2^x$.
Plugging into the pattern above, we have
$$f'(x) = \displaystyle\frac{5x^4 2^x - x^5 \ln(2) 2^x}{(2^x)^2}$$
:butterfly: **Can We Simplify It?** Yes. We could factor out $2^x$ in the numerator to get
$$f'(x) = \displaystyle\frac{2^x (5x^4 - x^5 \ln(2))}{\left(2^x\right)^2}$$
:space_invader: **Is there another way to do it?** Using properties of exponents, we could rewrite $$f(x) = \displaystyle\frac{x^5}{2^x}$$
---
<span style = "background-color:lightblue"> **Example 2.** </span> $f(x) = x^4 - 3^{-x}$. What is $f'(x)$?
:hammer: **Solution:** We *don't* use quotient rule on $x^4$; we just use [power rule](https://www.khanacademy.org/math/old-ap-calculus-ab/ab-derivative-rules/ab-diff-negative-fraction-powers/a/power-rule-review) to get the derivative $4x^3$. To use *quotient rule* on $3^{-x}$, we need to rewrite it as a quotient. Using [properties of negative exponents](https://youtu.be/7a-zVVcpZgE), we rewrite $3^{-x}$ as $\displaystyle\frac{1}{3^x}$, where we use quotient rule with
$A = 1$ $B = 3^x$ $A' = 0$ $B' = \ln(3)3^x$. Plugging that into the Quotient Rule pattern gives
$\frac{d}{dx} \left( \frac{1}{3^x} \right) = \displaystyle\frac{0 \cdot 3^x - 1 \cdot \ln(3) 3^x}{(3^x)^2}$
**Final Answer:** $f'(x) = 4x^3 + \displaystyle\frac{0 \cdot 3^x - 1 \cdot \ln(3) 3^x}{(3^x)^2}$
:butterfly: **Can We Simplify It?** Yes! First $0 \cdot 3^x = 0$, which goes away to give
$$f'(x) = 4x^3 + \displaystyle\frac{-1 \cdot \ln(3) 3^x}{(3^x)^2} $$
We can cancel a $3^x$ in the numerator with the $(3^x)^2$ in the denominator to give
$f'(x) = 4x^3 + \frac{-\ln(3)}{3^x}$.
:space_invader: **Is there another way to do it?**
We *don't* use quotient rule on $x^4$; we just use [power rule](https://www.khanacademy.org/math/old-ap-calculus-ab/ab-derivative-rules/ab-diff-negative-fraction-powers/a/power-rule-review) to get the derivative $4x^3$. We can rewrite $3^{-x}$ as $\left( 3^{-1} \right)^x$ and take the derivative using [exponential rule](https://youtu.be/KVG8BTRKsOM) to get the derivative of $\left( 3^{-1} \right) \left(3^{-1}\right)^x$.
In symbols,
$\frac{d}{dx} \left( x^4 - 3^{-x} \right) = 4x^3 - \left( 3^{-1} \right) \left(3^{-1}\right)^x$
---
<span style = "background-color:lightblue"> **Example 3.** $f(x) = x^5 (x^2 + 1)^{-1}$ </span>
:hammer: **Solution:** Using [properties of negative exponents](https://www.studypug.com/algebra-help/negative-exponents) we can rewrite this function as $f(x) = \displaystyle\frac{x^5}{x^2 + 1}$. Now it's set up perfectly for Quotient Rule!

**Answer:** $f'(x) = \displaystyle\frac{5x^4(x^2 + 1) - x^2 \cdot 5^x}{(x^2 + 1)}^2$
:butterfly: **Can We Simplify It?** Yes, using the distributive property in the numerator, we can rewrite this as
$f'(x) = \displaystyle\frac{5x^6 + 5x^4 - 2x^6}{(x^2 + 1)^2}$
then rewrite one more time as
$f'(x) = \displaystyle\frac{3x^6 + 5x^4}{(x^2 + 1)^2.}$
:space_invader: **Is there another way to do it?** If you know [chain rule](https://www.youtube.com/watch?v=H-ybCx8gt-8), you can use that along with product rule here. Using quotient rule here is probably the simplest way.
:skull_and_crossbones: :skull_and_crossbones: :skull_and_crossbones: <span style = "color:red"> **Common Mistakes** </span> :skull_and_crossbones: :skull_and_crossbones: :skull_and_crossbones:
1. <span style = "color:red"> Do not </span> distribute the "$-1$" in the exponent to numerator $x^2 + 1$. That is not valid and does not work. :white_frowning_face:
2. <span style = "color:red"> Do not </span> cancel the $x^2$ in the denominator with the $x^5$ in the denominator. This is an [**anti-pattern**](https://matheducators.stackexchange.com/questions/11572/how-to-teach-students-when-they-can-and-cant-cancel-factors-in-a-fraction). :white_frowning_face:
---
<span style = "background-color:lightblue"> **Example 4.** $f(x) = 3^x \cdot 4^{-x}$ </span>
:hammer: **Solution:**

**Final Answer:** $f'(x) = \displaystyle\frac{\ln(3) 3^x 4^x - 3^x \ln(4) 4^x}{\left( 4^x \right)^2}$. :heavy_check_mark:
:butterfly: **Can We Simplify It?** Yes. First, Notice that we can use the [distributive property](https://www.khanacademy.org/math/4th-grade-foundations-engageny/4th-m3-engage-ny-foundations/4th-m3-te-foundations/a/distributive-property-explained) to factor out $4^x$ to get
$f'(x) = \displaystyle\frac{4^x \left( \ln(3)3^x - 3^x \right)}{\left(4^x \right)^2}$ and then cancel out the $4^x$.
This leaves us with $f'(x) = \displaystyle\frac{\ln(3) 3^x - \ln(4) 3^x}{4^x}$ :heavy_check_mark:
We could try to do more by factoring out $3^x$ to get
$f'(x) = \displaystyle\frac{3^x \left( \ln(3) - \ln(4) \right)}{4^x}$. :heavy_check_mark:
Then we could get $f'(x) = \displaystyle\frac{3^x}{4^x} \left( \ln(3) - \ln(4) \right)$. :heavy_check_mark:
We can rewrite $\displaystyle\frac{3^x}{4^x}$ as $\left( \displaystyle\frac{3}{4} \right)^x$, so we could also write
$f'(x) = \left( \displaystyle\frac{3}{4} \right)^x \left( \ln(3) - \ln(4) \right)$. :heavy_check_mark:
Finally, usingthe [four basic properties of logarithms](https://www.andrews.edu/~calkins/math/webtexts/numb17.htm), we can rewrite this as
$f'(x) = \left( \displaystyle\frac{3}{4} \right)^x \ln \left(\displaystyle\frac{3}{4} \right)$. :heavy_check_mark:
:space_invader: **Is there another way to do it?** It's actually *much* easier to use [properties of exponents]() to rewrite $\displaystyle\frac{3^x}{4^x}$ as $\left( \displaystyle\frac{3}{4} \right)^x$ and take the derivative using [exponential rule](https://youtu.be/AnfxV9NoXGM).
This gives $f'(x) = \ln\left(\displaystyle\frac{3}{4} \right) \left(\displaystyle\frac{3}{4}\right)^x$ immediately.
For a similar example, check out this problem:
<iframe width="560" height="315" src="https://www.youtube.com/embed/N1JUpVQUzLA?start=72" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
---
<span style = "background-color:lightblue"> **Example 5.** </span> $f(x) = \displaystyle\frac{x^2}{\sin(x)}$
:hammer: **Solution:**

:butterfly: **Can We Simplify It?** Not really.
:space_invader: **Is there another way to do it?** If you know [the derivative of csc(x)](https://www.youtube.com/watch?v=U1xR8i7T4FQ), it may help to rewrite $\displaystyle\frac{x^2}{\sin(x)} = x^2 \cdot \displaystyle\frac{1}{\sin(x)} = x^2 \sec(x).$ Then it's possible to use [Product Rule](https://en.wikipedia.org/wiki/Product_rule).
---
<span style = "background-color:lightblue"> **Example 6.** </span> $f(x) = \displaystyle\frac{x}{x^4}$
:hammer: **Solution:** If we're determined to use Quotient Rule, we can do it this way:

:butterfly: **Can We Simplify It?** Yes, quite a bit. Follow this line:
$f'(x) = \displaystyle\frac{1\cdot x^4 - x\cdot 4x^3}{\left(x^4\right)^2}$ <br>
$f'(x) = \displaystyle\frac{x^4 - 4x^4}{x^8}$<br>
$f'(x) = \displaystyle\frac{-3x^4}{x^8}$<br>
$f'(x) = \displaystyle\frac{-3}{x^4}$
:space_invader: **Is there another way to do it?** Simplify *first*.

<iframe width="560" height="315" src="https://www.youtube.com/embed/z0OCRapnKEo" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
---