# How do you differentiate f(x)=(x-3)^2+(-x-4)^2 using the sum rule?

May 19, 2017

$\frac{d}{\mathrm{dx}} \left[{\left(x - 3\right)}^{2} + {\left(- x - 4\right)}^{2}\right] = 4 x + 2$

#### Explanation:

The sum property for differentiating states: $\frac{d}{\mathrm{dx}} \left(f \left(x\right) + g \left(x\right)\right) = f ' \left(x\right) + g ' \left(x\right)$

We are basically differentiating twice if we split up the function into two separate functions:

If we let $f \left(x\right) = {\left(x - 3\right)}^{2}$ we can find its derivative by applying the chain rule: $\frac{d}{\mathrm{dx}} f \left(g \left(x\right)\right) = f ' \left(g \left(x\right)\right) \cdot g ' \left(x\right)$

Here, let $f \left(x\right) = {x}^{2}$ and $g \left(x\right) = x - 3$

It may be helpful to create a list that shows each function along with its derivative:

$f \left(x\right) = {x}^{2}$
$f ' \left(x\right) = 2 x$ (By the power rule)
$g \left(x\right) = x - 3$
$g ' \left(x\right) = 1$

Following up on the chain rule, we can substitute each corresponding piece into the chain rule. Thus,

$\frac{d}{\mathrm{dx}} f \left(g \left(x\right)\right) = f ' \left(g \left(x\right)\right) \cdot g ' \left(x\right)$

$\frac{d}{\mathrm{dx}} \left[{\left(x - 3\right)}^{2}\right] = 2 \left(x - 3\right) \cdot 1$

$\frac{d}{\mathrm{dx}} \left[{\left(x - 3\right)}^{2}\right] = 2 \left(x - 3\right)$ (In simplified form)

$\therefore f ' \left(x\right) = 2 \left(x - 3\right)$

*Note: You may have noticed that I wrote $2$ and not $2 x$ when I substituted for $f '$. That's because we place $\left(x - 3\right)$ in place of $x$, hence $2 \left(x - 3\right)$ and not $2 x \left(x - 3\right)$

We can now find the derivative of ${\left(- x - 4\right)}^{2}$

If we let $g \left(x\right) = {\left(- x - 4\right)}^{2}$ then by the same method used above:

let $g \left(x\right) = {x}^{2}$ and $h \left(x\right) = - x - 4$

$g \left(x\right) = {x}^{2}$
$g ' \left(x\right) = 2 x$ (By the power rule)
$h \left(x\right) = - x - 3$
$h ' \left(x\right) = - 1$

By the chain rule:

$\frac{d}{\mathrm{dx}} g \left(h \left(x\right)\right) = g ' \left(h \left(x\right)\right) \cdot h ' \left(x\right)$

*(Modified to use $g \left(x\right)$ and $h \left(x\right)$ but exactly the same thing as $f \left(x\right)$ and $g \left(x\right)$)

$\frac{d}{\mathrm{dx}} \left[{\left(- x - 4\right)}^{2}\right] = 2 \left(- x - 4\right) \cdot - 1$

$\frac{d}{\mathrm{dx}} \left[{\left(- x - 4\right)}^{2}\right] = - 2 \left(- x - 4\right)$ (Simplified)

$\therefore g ' \left(x\right) = - 2 \left(- x - 4\right)$

Now that we have found both derivatives separately we can combine them to answer the given question:

Once again, by the sum rule: $\frac{d}{\mathrm{dx}} \left(f \left(x\right) + g \left(x\right)\right) = f ' \left(x\right) + g ' \left(x\right)$

We know that:

$f ' \left(x\right) = 2 \left(x - 3\right)$

$g ' \left(x\right) = - 2 \left(- x - 4\right)$

$\therefore \frac{d}{\mathrm{dx}} \left[{\left(x - 3\right)}^{2} + {\left(- x - 4\right)}^{2}\right] = 2 \left(x - 3\right) + \left(- 2 \left(- x - 4\right)\right)$

$\therefore \frac{d}{\mathrm{dx}} \left[{\left(x - 3\right)}^{2} + {\left(- x - 4\right)}^{2}\right] = 2 \left(x - 3\right) - 2 \left(- x - 4\right)$

Finally, simplify by distributing and combing like terms:

$2 \left(x - 3\right) - 2 \left(- x - 4\right)$

$= 2 x - 6 + 2 x + 8$

$4 x + 2$

So our final answer can be expressed as:

$\frac{d}{\mathrm{dx}} \left[{\left(x - 3\right)}^{2} + {\left(- x - 4\right)}^{2}\right] = 4 x + 2$

It looks like a lot, but it really isn't, In essence when doing these types of problems...

1. Spilt up the function into two different functions
2. Find the derivative using the appropriate differentiation technique
3. Simplify and repeat for the other function