# Calculus: Derivatives II

## Product Rule

We have acquired the ability to take derivatives of simple functions, such as polynomials and exponentials. But what about more complicated functions, functions that are neither polynomials or exponentials, but perhaps a product of both? For example, how would one take the derivative of $y=xe^x$? One approach would be to resort back to the definition of the derivative in terms of limits and use the properties of limits to derive a customized answer. However, given the long process of computing simple derivatives in this manner, this approach is one to be avoided. Instead, it is much better to try to prove some general properties of derivatives and then apply them to specific situations.

The Product Rule is a general rule for taking the derivative of the product of two differentiable functions. Applying this general formula to specific situations will give us a shortcut around needing to touch limits at all. So, here goes nothing:

$\dfrac{d}{dx} f(x)g(x) = \lim\limits_{h \rightarrow 0}\dfrac{f(x+h)g(x+h) - f(x)g(x)}{h} \\$

At this point we will use a clever trick of adding and subtracting the same term from the numerator. This term is chosen intentionally. From there we factor out like terms:

$\dfrac{d}{dx} f(x)g(x) = \lim\limits_{h \rightarrow 0}\dfrac{f(x+h)g(x+h) + f(x+h)g(x) - f(x+h)g(x) - f(x)g(x)}{h} \\\dfrac{d}{dx} f(x)g(x) = \lim\limits_{h \rightarrow 0}\dfrac{f(x+h)(g(x+h)-g(x))}{h} + \lim\limits_{h \rightarrow 0} \dfrac{g(x)(f(x+h)-f(x))}{h} \\ \dfrac{d}{dx} f(x)g(x) = \lim\limits_{h \rightarrow 0}f(x+h)\dfrac{g(x+h)-g(x)}{h} + \lim\limits_{h \rightarrow 0} g(x)\dfrac{f(x+h)-f(x)}{h} \\ \dfrac{d}{dx} f(x)g(x) = \left(\lim\limits_{h \rightarrow 0}f(x+h)\right)\left(\lim\limits_{h \rightarrow 0}\dfrac{g(x+h)-g(x)}{h}\right) + \left(\lim\limits_{h \rightarrow 0} g(x)\right)\left(\lim\limits_{h \rightarrow 0}\dfrac{f(x+h)-f(x)}{h}\right) \\$

The second and fourth limits here are just the derivatives of $g(x)$ and $f(x)$, respectively, and the other two are simply the original functions:

$\dfrac{d}{dx} f(x)g(x) = f(x)g'(x) + g(x)f'(x) \\$

The derivative of the product of two functions turns out to be quite simple! Simply multiply one function by the derivative of the other, the sum with the reverse.

## Problems

1. Differentiate with respect to $x$: $y= 2xe^x$

$\dfrac{d}{dx}y = \dfrac{d}{dx}2xe^x \\ \dfrac{dy}{dx} = \left(\dfrac{d}{dx}2x\right)e^x + 2x\left(\dfrac{d}{dx}e^x\right) \\ \dfrac{dy}{dx} = \left(2\right)e^x + 2x\left(e^x\right) \\ \dfrac{dy}{dx} = 2e^x + 2xe^x \\ \dfrac{dy}{dx} = (2x+2)e^x \\$
2. Differentiate with respect to $x$: $y= \sin(x)\cos(x)$

$\dfrac{d}{dx}y = \dfrac{d}{dx}\sin(x)\cos(x) \\ \dfrac{dy}{dx} = \left(\dfrac{d}{dx}\sin(x)\right)\cos(x) + \sin(x)\left(\dfrac{d}{dx}\cos(x)\right) \\ \dfrac{dy}{dx} = (\cos(x))\cos(x) + \sin(x)(-\sin(x)) \\ \dfrac{dy}{dx} = \cos^2(x) - \sin^2(x) \\$
3. Differentiate with respect to $x$: $y= 2x^4\tan(x)\ln(x)$

$\dfrac{d}{dx}y = \dfrac{d}{dx}2x^4\tan(x)\ln(x) \\ \dfrac{dy}{dx} = \left(\dfrac{d}{dx}2x^4\right)\tan(x)\ln(x) + 2x^4\left(\dfrac{d}{dx}\tan(x)\right)\ln(x) + 2x^4\tan(x)\left(\dfrac{d}{dx}\ln(x)\right)\\ \dfrac{dy}{dx} = \left(8x^3\right)\tan(x)\ln(x) + 2x^4\left(\sec^2(x)\right)\ln(x) + 2x^4\tan(x)\left(\dfrac{1}{x}\right)\\ \dfrac{dy}{dx} = 8x^3\tan(x)\ln(x) + 2x^4\sec^2(x)\ln(x) + 2x^3\tan(x)\\$
4. Differentiate with respect to $x$ using the Product Rule: $y= x^2$

$\dfrac{d}{dx}y = \dfrac{d}{dx}x^2 \\ \dfrac{dy}{dx} = \dfrac{d}{dx}\left(x \cdot x \right)\\ \dfrac{dy}{dx} = \left(\dfrac{d}{dx} x \right)x + x\left(\dfrac{d}{dx}x\right) \\ \dfrac{dy}{dx} = \left(1 \right)x + x\left(1 \right) \\ \dfrac{dy}{dx} = 2x \\$
5. Differentiate with respect to $x$ using the Product Rule: $y= x$

$\dfrac{d}{dx}y = \dfrac{d}{dx}x \\ \dfrac{dy}{dx} = \dfrac{d}{dx}\left(1 \cdot x \right) \\ \dfrac{dy}{dx} = \left(\dfrac{d}{dx} 1 \right)x + 1\left(\dfrac{d}{dx}x\right) \\ \dfrac{dy}{dx} = \left(0 \right)x + 1(1) \\ \dfrac{dy}{dx} = 1 \\$
6. Differentiate with respect to $x$: $y= x\ln(x)$

$\dfrac{d}{dx}y = \dfrac{d}{dx}x\ln(x) \\ \dfrac{dy}{dx} = \left(\dfrac{d}{dx} \ln(x) \right)x + \ln(x)\left(\dfrac{d}{dx}x\right) \\ \dfrac{dy}{dx} = \left(\dfrac{1}{x} \right)x + \ln(x)\left(1\right) \\ \dfrac{dy}{dx} = 1 + \ln(x)\\$
7. Differentiate with respect to $x$: $y= xg(x)$

$\dfrac{d}{dx}y = \dfrac{d}{dx}x g(x) \\ \dfrac{dy}{dx} = \left(\dfrac{d}{dx} g(x) \right)x + g(x)\left(\dfrac{d}{dx}x\right) \\ \dfrac{dy}{dx} = \left( g'(x) \right)x + g(x)\left(1\right) \\ \dfrac{dy}{dx} = g(x) + xg'(x)\\$
8. Differentiate with respect to $x$: $y= h(z)\tan(x)\sec(x)$

$\dfrac{d}{dx}y = \dfrac{d}{dx}h(z)\tan(x)\sin(x) \\ \dfrac{dy}{dx} = h(z)\dfrac{d}{dx}\tan(x)\sin(x) \\ \dfrac{dy}{dx} = h(z)\left( \left(\dfrac{d}{dx} \tan(x) \right)\sin(x) + \tan(x)\left(\dfrac{d}{dx}\sin(x)\right)\right) \\ \dfrac{dy}{dx} = h(z)\left( \sec^2(x) \sin(x) + \tan(x)\cos(x)\right) \\ \dfrac{dy}{dx} = h(z)\left( \tan(x)\sec(x) + \tan(x)\cos(x) \right) \\ \dfrac{dy}{dx} = h(z)\tan(x)\left( \sec(x) + \cos(x) \right) \\$
9. Differentiate with respect to $x$: $y= \prod\limits_{i} f_{i}(x)$ where $\left\{ f_i \right\}$ is an arbitrary sequence of functions.

This problem only looks difficult because of the notation. However, it is just the generalize product rule. The derivative is the sum of the products of the derivative of the $i$th element and the other functions. $$\dfrac{d}{dx}y = \dfrac{d}{dx}\prod\limits_{i } f_{i}(x) \\ \dfrac{dy}{dx} = \sum\limits_{i } \left( \left(\dfrac{d}{dx}f_{i}(x)\right)\prod\limits_{j \neq i } f_{j}(x) \right) \\ \dfrac{dy}{dx} = \sum\limits_{i } \left( f'_{i}(x)\prod\limits_{ j \neq i } f_{j}(x) \right) \\$$ If the set has 2 elements, it will look familiar: $$\dfrac{dy}{dx} = f'_{1}(x)f_{2}(x) + f'_{2}(x)f_{1}(x) \\$$ With 3 elements, the pattern should be easier to see: $$\dfrac{dy}{dx} = f'_{1}(x)f_{2}(x)f_{3}(x) + f'_{2}(x)f_{1}(x)f_{3}(x) + f'_{3}(x)f_{1}(x)f_{2}(x)\\$$

10. Differentiate with respect to $x$ using the Product Rule: $y= \dfrac{\ln(x)}{x}$

$\dfrac{d}{dx}y = \dfrac{d}{dx}\dfrac{\ln(x)}{x} \\ \dfrac{dy}{dx} = \dfrac{d}{dx}\dfrac{1}{x}\ln(x) \\ \dfrac{dy}{dx} = \left(\dfrac{d}{dx}\dfrac{1}{x}\right)\ln(x) + \dfrac{1}{x}\left(\dfrac{d}{dx}\ln(x)\right) \\ \dfrac{dy}{dx} = \left(\dfrac{-1}{x^2}\right)\ln(x) + \dfrac{1}{x}\left(\dfrac{1}{x}\right) \\ \dfrac{dy}{dx} = \dfrac{-1}{x^2}\ln(x) + \dfrac{1}{x^2} \\ \dfrac{dy}{dx} = \dfrac{-1}{x^2}(\ln(x)-1) \\ \dfrac{dy}{dx} = \dfrac{1-\ln(x)}{x^2} \\$