Okay, but what about [latex]\frac{d}{dx} x \cdot e^x[/latex]? Can we just take the derivative of each like this?
\begin{align*}
\frac{d}{dx} x \cdot e^x & = \left( \frac{d}{dx} x \right) \cdot \left( \frac{d}{dx} e^x \right) \\
& = 1 \cdot e^x = e^x
\end{align*}
Unfortunately, no. Just to be clear: the above calculation is false!
Think about [latex]\frac{d}{dx} x \cdot x[/latex]. We know [latex]\frac{d}{dx} x = 1[/latex], so therefore you might think
[latex]\frac{d}{dx} x \cdot x = 1 \cdot 1 = 1[/latex]
But we also know that [latex]\frac{d}{dx} x \cdot x = \frac{d}{dx} x^2 = 2x[/latex]. So what do we make of this? Well, we just have to give up on the idea of “taking the derivative of each” with products. Luckily, there is a rule called the product rule that works great:
[latex]\boxed{\cfrac{d}{dx} f \cdot g = f g' + g f'}[/latex]
The motto for this rule is “the first times the derivative of the second, plus the second times the derivative of the first.”
Where does this rule come from? Well, consider this picture:
Here we have a rectangle. The height is [latex]f[/latex], the width is [latex]g[/latex]. The area of the rectangle is [latex]f \cdot g[/latex]. If we were to make [latex]f[/latex] bigger by a little bit, by say [latex]\Delta f[/latex], and [latex]g[/latex] bigger by [latex]\Delta g[/latex], then the rectangle would become bigger too. We want to find out how quickly the area is increasing. So how quickly is it increasing? You can see in the picture we add three sections on: [latex]f \cdot \Delta g[/latex], [latex]g \cdot \Delta f[/latex], and [latex]\Delta f \cdot \Delta g[/latex]. If you think of [latex]\Delta f[/latex] and [latex]\Delta g[/latex] as being really small, though, the [latex]\Delta f \cdot \Delta g[/latex] terms is incredibly tiny — so tiny it does not affect the answer in the limit. Therefore, the new area is [latex]f \cdot \Delta g + g \cdot \Delta f[/latex]. This is where the product rule comes from — it’s how an area changes as you change each side length.
Let’s see this rule in action.
Product Rule with [latex]x e^x[/latex]
In this case, we can attack this using the product rule with [latex]{\color{blue} f = x}[/latex], and [latex]{\color{red} g = e^x}[/latex]. We can easily take the derivative of each part: [latex]{\color{blue} f' = 1}[/latex], and [latex]{\color{red} g' = e^x}[/latex]. Hence, using the formula [latex]\frac{d}{dx} {\color{blue} f} {\color{red} g} = {\color{blue} f} {\color{red} g'} + {\color{red} g} {\color{blue} f'}[/latex], we have
[latex]{\color{blue} f} {\color{red} g'} + {\color{red} g} {\color{blue} f'} = {\color{blue} x} {\color{red} e^x} + {\color{red} e^x} {\color{blue} (1)} = \boxed{x e^x + e^x}.[/latex]
Another Product Rule
We see [latex]{\color{red} f = x^2, f' = 2x}[/latex] and [latex]{\color{blue} g = \cos(x), g' = -\sin(x)}[/latex]. Hence, we have
\begin{align*}
\frac{d}{dx} {\color{red} x^2} {\color{blue} \cos(x)} & = {\color{red} f} {\color{blue} g’} + {\color{blue} g} {\color{red} f’} \\
& = {\color{red} x^2} {\color{blue} (-\sin(x))} + {\color{blue} \cos(x)} {\color{red} 2x} \\
& = \boxed{-2x^2 \sin(x) + 2x \cos(x)}.
\end{align*}
Product Rule with [latex]x \cdot x[/latex]
Using the power rule, we see [latex]\frac{d}{dx} x \cdot x = \frac{d}{dx} x^2 = 2x[/latex]. Using the product rule, we set [latex]f = x[/latex] and [latex]g = x[/latex]. In which case, [latex]f' = 1[/latex] and [latex]g' = 1[/latex]. Thus
[latex]f g' + g f' = (x)(1) + (x)(1) = \boxed{2x}.[/latex]
Hurray! The same answer! Isn’t it great when math just plain works.
Another Product Rule
We see [latex]f = \sqrt{x}[/latex], [latex]g = \ln(x)[/latex]. For [latex]f'[/latex], we rewrite [latex]f = x^{1/2}[/latex] and use the power rule to get [latex]f' = \frac{1}{2} x^{-1/2}[/latex], which is [latex]f' = \frac{1}{2 \sqrt{x}}[/latex]. As we saw in the exponents and logarithms section, [latex]g' = \frac{1}{x}[/latex]. Hence \begin{align*}
\frac{d}{dx} \sqrt{x} \ln(x) & = f g’ + g f’ \\
& = \sqrt{x} \frac{1}{x} + \ln(x) \frac{1}{2 \sqrt{x}} \\
& = \frac{\sqrt{x}}{x} + \frac{\ln(x)}{2 \sqrt{x}}
\end{align*}
Now if you want to be a bit fancy with the algebra, we can simplify [latex]\frac{\sqrt{x}}{x}[/latex] using rational exponents. It is equal to [latex]\frac{x^{1/2}}{x^1}[/latex], which is [latex]x^{1/2-1} = x^{-1/2}[/latex]. If we turn this back into a root, we get [latex]\frac{1}{\sqrt{x}}[/latex]. From here, we can find a common denominator and add the two fractions.\begin{align*}
\frac{d}{dx} \sqrt{x} \ln(x) & = \frac{1}{\sqrt{x}} + \frac{\ln(x)}{2 \sqrt{x}} \\
& = \frac{2}{2 \sqrt{x}} + \frac{\ln(x)}{2 \sqrt{x}} \\
& = \boxed{\frac{\ln(x) + 2}{2 \sqrt{x}}}.
\end{align*}
There you go.