# MAT 221 Calculus I

## April 9, 2020

Today's Agenda:
1. Continuous Function
2. Intermediate Value Theorem
3. Exercises

# Product, Quotient and Power Rules

Several rules exist for finding the derivatives of functions with several components such as $x \space sin \space x$. With these rules and the chain rule, which will be explored later, any derivative of a function can be found (assuming they exist). There are five rules that help simplify the computation of derivatives, of which each will be explored in turn.

## Sum Rule

The most straightforward of the derivation rules is the sum rule, which is stated as:

$$ \text{The derivative of} \space u(x) + v(x) \space \text{is} \space \frac{d}{dx} (u + v) = \frac{du}{dx} + \frac{dv}{dx} $$

## Rule of Linearity

The sum rule can be considered a case of a larger concept called linearity. For example, linearity can be seen in the derivative of the function: $\frac{d}{dx}5x - cos x = 5 + sin \space x$ and all other similar functions. This rule is known as the Rule of Linearity and follows from [linear combinations](https://en.wikipedia.org/wiki/Linear_combination). Where $a$ and $b$ are real numbers, the rule is stated as the following:

$$ \text{The derivative of} \space au(x) + bv(x) \space \text{is} \space \frac{d}{dx}(au + bv) = a \frac{du}{dx} + b \frac{dv}{dx} $$

## Product Rule

The product rule helps deal with the frequently occurring situation of the product of two functions, such as $sin \space x + cos \space x$ and is stated as:

$$ \text{The deriative of the product of two functions,} \space u(x)v(x) \space \text{is} \space \frac{d}{dx}(uv) = u \frac{dv}{dx} + v \frac{du}{dx} $$.

The product rule can be extended to more than the product of two functions. For example, the derivative of the product of three functions would be:

$$ \frac{d}{dx} \space (uvw) = uv \frac{dw}{dx} + uw \frac{dv}{dx} + vw \frac{du}{dx} $$

## Reciprocal Rule

The reciprocal rule is more or less a case of the powerful quotient rule. The case of the reciprocal rule helps us find the derivative of $\frac{1}{v(x)}$ much easier. We can state the rule as the following:

$$\text{The derivative of the function} \space \frac{1}{v(x)} \space \text{is} \space \frac{d}{dx} \space \frac{1}{v(x)} = \frac{\frac{-dv}{dx}}{v^2}$$

## Quotient Rule

The quotient rule is an important derivation technique that allows us to more efficiently find the deriative of $\frac{u(x)}{v(x)}$. We can state the quotient rule as follows:

$$ \text{The derivative of} \space \frac{u(x)}{v(x)} \space \text{is} \space \frac{v \frac{du}{dx} - u \frac{dv}{dx}}{v^2} $$

Last but certainly not least is the power rule.

## Power Rule

The power rule gives us the ability to find the deriative of a function of the form $(u(x))^n$ and can be stated as:

$$ \text{The deriative of} \space \Big[u(x) \Big]^n \space \text{is} \space n \Big[u(x) \Big ]^{n-1} \frac{du}{dx} $$

Okay! With those rules stated and out of the way, we are now able to solve the vast majority of deriatives we will ever encounter! We test our hand at using the rules to calculate the deriative of several functions with the following examples.

## Examples

The examples presented here are borrowed from Gilbert Strang's amazing book [*Calculus*](https://ocw.mit.edu/ans7870/resources/Strang/Edited/Calculus/Calculus.pdf), which can be found for free in PDF form on the MIT OCW site. We also take advantage of the wonderful [SymPy](http://www.sympy.org/en/index.html) library for symbolic computation to check our answers to the example problems.

We import the functions from the SymPy library that we will require.


```python
from sympy import symbols, diff, sin, cos, simplify, init_printing
```

The `init_printing()` [function](http://docs.sympy.org/latest/tutorial/printing.html) is used to output the results of SymPy in LaTeX.


```python
init_printing()
```

First initialize a [symbol](http://docs.sympy.org/latest/modules/core.html#symbols) variable for $x$ to be used with SymPy's computation engine.


```python
x = symbols('x')
```

Example 1: Find the derivative of $(x + 1)(x - 1)$

We could factor and take the derivative of the resulting polynomial without having to use the product rule:

$$ (x + 1)(x - 1) = x^2 - x + x + 1 = x^2 + 1 $$

$$ \frac{d}{dx} x^2 + 1 = 2x $$

We can also find the deriative of the function with the product rule:

$$ \frac{d}{dx} (uv) = u \frac{dv}{dx} + v \frac{du}{dx} $$

$$ u = x + 1, \qquad v = x - 1 $$

$$ \frac{d}{dx} = (x + 1)(1) + (x - 1)(1) = 2x $$

Example 2: Find the derivative of $\frac{1}{1 + x} + \frac{1}{1 + sin \space x}$

Here we take advantage of the reciprocal rule, $\frac{d}{dx} \space \frac{1}{v(x)} = \frac{\frac{-dv}{dx}}{v^2}$. Starting with $\frac{1}{1 + x}$:

$$ \frac{d}{dx} \space \frac{1}{1 + x} = \frac{-1}{(1 + x)^2} $$


Then the second piece of the function, $\frac{1}{1 + sin \space x}$

$$ \frac{d}{dx} \space \frac{1}{1 + sin \space x} = \frac{-cos \space x}{(1 + sin \space x)^2} $$

Then putting the two pieces together gives us the derivative of the function:

$$ \frac{d}{dx} \frac{1}{1 + x} + \frac{1}{1 + sin \space x} = \frac{-1}{(1 + x)^2} - \frac{cos \space x}{(1 + sin \space x)^2} $$

We can verify this result using SymPy:


```python
diff(1 / (1 + x) + 1 / (1 + sin(x)))
```

Example 3: Find the derivative of $(x - 1)(x - 2)(x - 3)$

We can find the derivative using the product rule, $\frac{d}{dx} \space (uvw) = uv \frac{dw}{dx} + uw \frac{dv}{dx} + vw \frac{du}{dx}$

$$ u = (x - 1), \qquad v = (x - 2), \qquad w = (x - 3) $$

$$ \frac{d}{dx} (uvw) = (x - 1)(x - 2)(1) + (x - 1)(x - 2)(1) + (x - 2)(x - 3)(1) $$

Though not absolutely necessary, finish by factoring and simplifying the derivative.

$$ x^2 - 2x - x + 2 + x^2 - 3x - x + 3 + x^2 - 3x - 2x + 6 $$

$$ 3x^2 - 12x + 11 $$

Verifying with SymPy:


```python
diff((x - 1) * (x - 2) * (x - 3))
```

We can also check to see if our simplifying of the function was accurate using SymPy's `simplify` function.


```python
simplify(diff((x - 1) * (x - 2) * (x - 3)))
```

Example 4: Find the derivative of $\frac{x^3 + 1}{x + 1} + \frac{cos \space x}{sin \space x}$

Using the sum rule, we can find the derivatives of each piece and then add the derivatives together. Starting with $\frac{x^3 + 1}{x + 1}$, we apply the quotient rule:

$$ \frac{d}{dx} \space \frac{u(x)}{v(x)} = \frac{v \frac{du}{dx} - u \frac{dv}{dx}}{v^2} $$

$$ u = x^3 + 1, \qquad v = x + 1 $$

$$ \frac{d}{dx} \space \frac{x^3 + 1}{x + 1} = \frac{(x + 1)(3x^2) - (x^3 + 1)(1)}{(x + 1)^2} = 2x - 1 $$

We'll take the easy way out on factoring the above derivative and use SymPy:


```python
simplify(((x + 1) * (3 * x ** 2) - (x ** 3 + 1)) / (x + 1) ** 2)
```

Then we find the derivative of the second piece of the equation, $\frac{\cos{x}}{\sin{x}}$. Again, we take advantage of the quotient rule:

$$ u = \cos{x}, \qquad v = \sin{x} $$

$$ \frac{d}{dx} \frac{\cos{x}}{\sin{x}} = \frac{(\sin{x})(-\sin{x}) - (\cos{x})(\sin{x})}{(\sin{x})(\sin{x})} $$

$$ \frac{d}{dx} \frac{\cos{x}}{\sin{x}} = \frac{-\sin^2{x} - \cos^2{x}}{\sin^2{x}} $$ 

With the Pythagorean identity, $\sin^2{x} + \cos^2{x} = 1$, we can simplify the derivative to:

$$ -\frac{1}{\sin^2{x}} = -\csc^2{x} $$

Adding the two pieces of the equation together using the sum rule gives us the deriative:

$$ 2x - 1 - \frac{1}{\sin{x}} = 2x - 1 - \csc{x} $$

## References

Strang, G. (2010). Calculus. Wellesley, MA: Wellesley-Cambridge.

Pythagorean trigonometric identity. (2017, October 4). In Wikipedia, The Free Encyclopedia.
From https://en.wikipedia.org/w/index.php?title=Pythagorean_trigonometric_identity&oldid=803778637

91d0151e80505572c367a6628b35bb24f4153747
ipynb
Jupyter Notebook
Jupyter_Notes/.ipynb_checkpoints/Product_Quotient_and_PowerRules-checkpoint.ipynb
xiuquan0418/MAT221
bca0bd815a6c82325ebbacbfca3a15c4cbdc24f0
MIT
2020-05-07T07:18:11.000Z
2020-05-07T07:18:11.000Z
Jupyter_Notes/Product_Quotient_and_PowerRules.ipynb
xiuquan0418/MAT221
bca0bd815a6c82325ebbacbfca3a15c4cbdc24f0
MIT
Jupyter_Notes/Product_Quotient_and_PowerRules.ipynb
xiuquan0418/MAT221
bca0bd815a6c82325ebbacbfca3a15c4cbdc24f0
MIT
Qwen/Qwen-72B
1. YES
2. YES