We now learn how to *differentiate sums of functions* as well as *functions multiplied by a constant*.

So far we have learnt how to *differentiate a function* made of one term, but more often than not *function* are
made by *adding, or subtracting* any *linear combination* of single terms.

By the end of this section we'll know how to differentiate:
\[\alpha f(x)+\beta g(x)\]
Where \(f(x)\) and \(g(x)\) are two functions and \(\alpha \) and \(\beta \) are two real numbers.

Given two *functions* \(f(x)\) and \(g(x)\), to *differentiate* their *sum*, or their *difference*, we *differentiate* each of their
terms as though they were on their own:
\[\begin{pmatrix} f(x) + g(x) \end{pmatrix}' = f'(x)+g'(x) \]
and
\[\begin{pmatrix} f(x) - g(x) \end{pmatrix}' = f'(x) - g'(x) \]

*Differentiate* each of the following *functions* with respect to \(x\):

- \(f(x)=4x^5+7x\)
- \(y=2x^3-2\sqrt{x}\)
- \(f(x)=\frac{3}{x} + x^4-7\)

Using the fact that *the derivative of any sum, or difference, of two functions equals to the sum, or difference, of the derivatives of those functions*,
we *differentiate* each of the following *treating each term as if it were on its own*.

- The derivative of \(f(x)=4x^5+7x\) is: \[\begin{aligned} f'(x) &= 5\times 4x^{5-1}+7x^{1-1} \\ &= 20x^4+7x^0 \\ f'(x) &= 20x^4+7 \end{aligned}\]
- Remembering that \(\begin{pmatrix} \sqrt{x} \end{pmatrix}' = \frac{1}{2\sqrt{x}}\), the derivative of \(y=2x^3-2\sqrt{x}\) is: \[\begin{aligned} \frac{dy}{dx} &= 3\times 2x^{3-1} - 2\times \frac{1}{2\sqrt{x}} \\ &= 6x^2-\frac{2}{2\sqrt{x}} \\ & = 6x^2 - \frac{1}{\sqrt{x}} \end{aligned}\]
- Remembering that \(\begin{pmatrix} \frac{1}{x} \end{pmatrix}' = - \frac{1}{x^2}\), we differentiate \(f(x) = \frac{3}{x^2} + x^4 - 7\) as follows: \[ f'(x) = -\frac{3}{x^2} + 4x^{4-1} - 0 = -\frac{3}{x^2} + 4x^{3} \]

Given a function \(f(x)\) and a scalar \(\alpha \in \mathbb{R}\) (a real number) the *derivative* of the *product* \(\alpha f(x)\) equals
to the *product* of \(\alpha \) and the *derivative* \(f'(x)\).

That's:
\[\begin{pmatrix} \alpha f(x) \end{pmatrix}' = \alpha f'(x)\]

Given two functions \(f(x)\) and \(g(x)\) as well as two scalars \(\alpha\) and \(\beta \) both in \(\mathbb{R}\), the derivative
of any linear combination of \(f(x)\) and \(g(x)\) equals to the same linear combination of their derivatives.

That's:
\[\begin{pmatrix} \alpha f(x) + \beta g(x) \end{pmatrix}' = \alpha f'(x) + \beta g'(x)\]

Given \(f(x)=x^3\), \(g(x)=\sqrt{x}\) and \(h(x) = \frac{1}{x^2}\), differentiate each of the following:

- \(3f(x)+4g(x)\)
- \(g(x)-6h(x)\)
- \(\frac{5}{6}f(x)+\frac{1}{8}h(x)-\frac{3}{4}g(x)\)

- Remembering that \(\frac{1}{x^2} = x^{-2}\) so \(\begin{pmatrix} \frac{1}{x^2} \end{pmatrix}'= -2x^{-2-1} = -2x^{-3}\), we differentiate as follows: \[\begin{aligned} \begin{pmatrix} 3f(x)+4g(x) \end{pmatrix}' &= 3f'(x) +4g'(x) \\ & = 3\times 3x^{3-1} + 4\times (-2)x^{-2-1} \\ & = 9x^2 - 8 x^{-3} \\ \begin{pmatrix} 3f(x)+4g(x) \end{pmatrix}' & = 9x^2-\frac{8}{x^3} \end{aligned}\]
- Remembering that \(\begin{pmatrix} \sqrt{x} \end{pmatrix}' = \frac{1}{2\sqrt{x}}\), we differentiate as follows: \[\begin{aligned} \begin{pmatrix} g(x)-6h(x) \end{pmatrix}' &= g'(x) - 6h'(x) \\ & = \frac{1}{2\sqrt{x}} - 6\times (-2)x^{-2-1} \\ & = \frac{1}{2\sqrt{x}} + 12x^{-3} \\ \begin{pmatrix} g(x)-6h(x) \end{pmatrix}' &= \frac{1}{2\sqrt{x}} + \frac{12}{x^3} \end{aligned}\]
- To differentiate \(\frac{5}{6}f(x)+\frac{1}{8}h(x)-\frac{3}{4}g(x)\), we use all that we have seen here to write: \[\begin{aligned} \begin{pmatrix} \frac{5}{6}f(x)+\frac{1}{8}h(x)-\frac{3}{4}g(x) \end{pmatrix}' &= \frac{5}{6}f'(x)+\frac{1}{8}h'(x)-\frac{3}{4}g'(x) \\ &= 3\times \frac{5}{6} x^{3-1} -2\times \frac{1}{8}x^{-2-1} - \frac{3}{4} \times \frac{1}{2}\sqrt{x} \\ & = \frac{15}{6}x^2-\frac{2}{8}x^{-3} - \frac{3}{8\sqrt{x}} \\ & = \frac{15}{6}x^2-\frac{1}{4}\frac{1}{x^3} - \frac{3}{8\sqrt{x}} \\ \begin{pmatrix} \frac{5}{6}f(x)+\frac{1}{8}h(x)-\frac{3}{4}g(x) \end{pmatrix}' & = \frac{5}{2}x^2-\frac{1}{4x^3} - \frac{3}{8\sqrt{x}} \end{aligned}\]