3.2 Subtraction and Constants

In the preceding section we learned three fundamental differential laws, and we saw our first examples calculating the differential. In order to make more calculations, we'll need more differential laws! For example, we do not (yet) have a differential law for subtraction. If we try to take the differential of a function that uses subtraction, we'll get stuck.
But don't give up on subtraction just yet! By playing with the fundamental differential laws, we can deduce many new differential laws. In this section, we'll see several differential laws, including one for subtraction. Our goal for the remainder of this chapter is to find a differential law for each of the components we've studied.

Subtraction

To get at a differential law for subtraction, we'll start with something slightly simpler: a differential law for negation.
Law.
The differential law for negation states
\[ \begin{align} \diff (- u) &= - \diff u \end{align} \]
where \( u : \Number \) is a number.
Why?
We can rewrite negation as a product:
\[ \begin{align} - u &= -1 \mult u. \end{align} \]
We can then calculate.
\[ \begin{align} \diff (- u) &= \diff (-1 \mult u) = u \mult \diff (-1) + (-1) \mult \diff (u) = u \mult 0 + (-1) \mult \diff u = - \diff u \end{align} \]
The differential law for negation says that we may pull a negative sign out of a differential. We're now in a position to state and explain the differential law for subtraction.
Law.
The differential law for subtraction states
\[ \begin{align} \diff (u - v) &= \diff u - \diff v \end{align} \]
where \( u : \Number \) and \( v : \Number \) are numbers.
Why?
We can rewrite a subtraction as an addition with a negation.
\[ \begin{align} u - v &= u + (-v) \end{align} \]
This allows us to calculate,
\[ \begin{align} &\diff (u - v) = \diff (u + (-v)) = \diff u + \diff (-v) = \diff u + (- \diff v) = \diff u - \diff v. \end{align} \]
Let's see how we can use the differential law for subtraction.
Example.
Consider the function
\[ \begin{align} z &\depends (x, y) \\ z &= 2 x - 5 y. \end{align} \]
Let's compute the differential!
\[ \begin{align} \diff z &= \diff (2 x - 5 y) \\ &= \diff (2 x) - \diff (5 y) \\ &= (x \mult \diff (2) + 2 \mult \diff (x)) - (y \mult \diff (5) + 5 \mult \diff (y)) \\ &= 2 \mult \diff x - 5 \mult \diff y \end{align} \]

Constants

We've already seen a differential law for constants: the differential of any constant is zero. We use constants all of the time, and so it's worth the effort to learn a couple more differential laws that deal specifically with constants.
Laws.
Suppose \( u : \Number \) is a number and \( c : \Number \) is constant. The differential law for constant-adders states
\[ \begin{align} \diff (u + c) &= \diff u, \end{align} \]
and the differential law for constant-multipliers states
\[ \begin{align} \diff (c \mult u) &= c \mult \diff u. \end{align} \]
Why?
We'll check the constant-adder law first.
\[ \begin{align} \diff (u + c) &= \diff u + \diff c = \diff u + 0 = \diff u \end{align} \]
And now let's check the constant-multiplier law.
\[ \begin{align} \diff (c \mult u) &= u \mult \diff c + c \mult \diff u = u \mult 0 + c \mult \diff u = c \mult \diff u \end{align} \]
These laws are quite useful! They prune a few steps from a differential calculation that weren't actually going anywhere.
Example.
Let's calculate the differential of the function
\[ \begin{align} z &\depends x \\ z &= 7 x + 4. \end{align} \]
We'll calculate using our new differential laws.
\[ \begin{align} \diff z &= \diff (7 x + 4) \\ &= \diff (7 x) \\ &= 7 \mult \diff x \end{align} \]
We first apply the constant-adder law, and then we apply the constant-multiplier law.