Tutorials › Real Analysis › Derivative of the Absolute Value

Differentiation · Tutorial 406 of 1000

Derivative of the Absolute Value

Learn why absolute value has a corner at zero, how to compute its derivative elsewhere, and when an absolute-value composition can still be differentiable at a zero.

Advanced 9 min read

What You'll Learn

  • Compute the derivative of the absolute-value function at every nonzero point
  • Prove that the absolute-value function is not differentiable at zero
  • Use local sign information to simplify difference quotients
  • Determine differentiability of the absolute value of a differentiable function at a zero
  • Distinguish a genuine corner from a zero where the inner function has zero derivative

The Absolute-Value Function and Its Difference Quotient

The Chain Rule gives the derivative of a composition when the outer function is differentiable at the value reached by the inner function. Absolute value makes this condition important: the function \(A(x)=|x|\) behaves linearly on either side of zero, but its behavior changes at zero. We will compute its derivative directly from the definition, then use the Chain Rule and a first-order approximation to examine compositions such as \(|u(x)|\).

Recall that the derivative at an interior point \(a\) is the limit of the difference quotient, provided that limit exists:

$$ A'(a)=\lim_{h\to0}\frac{A(a+h)-A(a)}{h}. $$

The formula \(|x|=x\) for \(x\geq0\) and \(|x|=-x\) for \(x<0\) suggests two different local behaviors. At a nonzero point, sufficiently small changes do not cross zero, so just one of these formulas applies. At zero, positive and negative increments give incompatible difference quotients.

Theorem (Derivative of the Absolute-Value Function): Define \(A:\mathbb{R}\to\mathbb{R}\) by \(A(x)=|x|\). At every \(a\ne0\), \(A\) is differentiable and $$ A'(a)= \begin{cases} 1,&a>0,\\ -1,&a<0. \end{cases} $$ The function \(A\) is not differentiable at \(a=0\).

Proof Away from Zero

Proof. First suppose \(a>0\). Choose \(h\) with \(0<|h|<a\). Then \(a+h\geq a-|h|>0\), so both \(a+h\) and \(a\) are positive. Therefore

$$ \frac{|a+h|-|a|}{h} = \frac{(a+h)-a}{h} =1. $$

The difference quotient is exactly \(1\) for every sufficiently small nonzero \(h\). Its limit as \(h\to0\) is therefore \(1\), so \(A'(a)=1\).

Now suppose \(a<0\). Choose \(h\) with \(0<|h|<-a\). Since \(a+|h|<0\), we have \(a+h\leq a+|h|<0\); also \(a<0\). Thus

$$ \frac{|a+h|-|a|}{h} = \frac{-(a+h)-(-a)}{h} = \frac{-h}{h} =-1. $$

Again, the difference quotient is constant for all sufficiently small nonzero \(h\), so its limit is \(-1\). This proves the derivative formula at every nonzero \(a\).

Why the Derivative Fails at Zero

At \(a=0\), the difference quotient for \(h\ne0\) is

$$ \frac{|0+h|-|0|}{h}=\frac{|h|}{h}. $$

For every \(h>0\), this quotient equals \(1\). For every \(h<0\), it equals \(-1\). To verify that there is no limit as \(h\to0\), take the sequences \(h_n=1/n\) and \(k_n=-1/n\), for positive integers \(n\). Both sequences consist of nonzero increments and tend to zero, but

$$ \frac{|h_n|}{h_n}=1 \qquad\text{and}\qquad \frac{|k_n|}{k_n}=-1 $$

for every \(n\). If the difference quotient had a limit, its values along both sequences would tend to that same limit. Since the two constant sequences of quotient values have different limits, the derivative at zero does not exist. \(\square\)

Worked Example: The Derivative at a Positive Point

Compute the derivative of \(A(x)=|x|\) at \(a=5\) from the definition. For \(0<|h|<5\), we have \(5+h>0\), and hence \(|5+h|=5+h\) and \(|5|=5\). The difference quotient is

$$ \frac{|5+h|-|5|}{h} = \frac{(5+h)-5}{h} = \frac{h}{h} =1. $$

Because this equality holds for every nonzero \(h\) with \(|h|<5\), the limit is \(1\). Thus \(A'(5)=1\). The calculation illustrates why it is useful to choose a neighborhood that stays on one side of zero.

Worked Example: The Derivative at a Negative Point

At \(a=-3\), take \(h\) with \(0<|h|<3\). Then \(-3+h<0\), so \(|-3+h|=-(-3+h)=3-h\), while \(|-3|=3\). Consequently,

$$ \frac{|-3+h|-|-3|}{h} = \frac{(3-h)-3}{h} = \frac{-h}{h} =-1. $$

The quotient is \(-1\) throughout this punctured neighborhood, and therefore \(A'(-3)=-1\). Notice that the derivative is the slope of the local linear formula \(-x\), not the value of the function at \(-3\).

Worked Example: Testing the Derivative at the Corner

At zero, use \(h_n=1/n\) and \(k_n=-1/n\). Substitution into the difference quotient gives

$$ \frac{|h_n|-|0|}{h_n} = \frac{1/n}{1/n} =1, \qquad \frac{|k_n|-|0|}{k_n} = \frac{1/n}{-1/n} =-1. $$

Both increment sequences approach zero, while the corresponding quotient values remain different. Hence the difference quotient cannot have a limit, and \(A'(0)\) does not exist. This is a direct application of the Sequential Criterion for the Derivative Limit from earlier in this course.

Absolute Values of Differentiable Functions

The result for \(A(x)=|x|\) gives a useful rule for compositions. If a differentiable function \(u\) satisfies \(u(a)\ne0\), then the value \(u(x)\) remains on the same side of zero for \(x\) sufficiently close to \(a\). In that neighborhood, the absolute value either leaves \(u\) unchanged or changes its sign. The Chain Rule also applies directly, since \(A\) is differentiable at \(u(a)\).

Theorem (Derivative of an Absolute-Value Composition Away from a Zero): Let \(I\) be an interval, let \(a\) be an interior point of \(I\), and suppose \(u:I\to\mathbb{R}\) is differentiable at \(a\). If \(u(a)\ne0\), then \(x\mapsto |u(x)|\) is differentiable at \(a\), and $$ \left.\frac{d}{dx}|u(x)|\right|_{x=a} = \begin{cases} u'(a),&u(a)>0,\\ -u'(a),&u(a)<0. \end{cases} $$

Proof. Define \(A(y)=|y|\). The function \(x\mapsto |u(x)|\) is \(A\circ u\). Because \(u(a)\ne0\), the theorem on the derivative of the absolute-value function shows that \(A\) is differentiable at \(u(a)\). The Chain Rule therefore gives

$$ (A\circ u)'(a)=A'(u(a))u'(a). $$

If \(u(a)>0\), then \(A'(u(a))=1\), giving \((A\circ u)'(a)=u'(a)\). If \(u(a)<0\), then \(A'(u(a))=-1\), giving \((A\circ u)'(a)=-u'(a)\). These are all the cases allowed by \(u(a)\ne0\), proving the formula. \(\square\)

At a point where \(u(a)=0\), the Chain Rule cannot be applied with \(A\) as the outer function, because \(A\) is not differentiable at \(0\). The composite may or may not be differentiable. Its behavior depends on the first-order change of \(u\) at \(a\).

Theorem (Differentiability at a Zero of the Inner Function): Let \(I\) be an interval, let \(a\) be an interior point of \(I\), and suppose \(u:I\to\mathbb{R}\) is differentiable at \(a\) with \(u(a)=0\). If \(u'(a)=0\), then \(x\mapsto |u(x)|\) is differentiable at \(a\) and its derivative is \(0\). If \(u'(a)\ne0\), then \(x\mapsto |u(x)|\) is not differentiable at \(a\).

Proof. Since \(u\) is differentiable at \(a\), the First-Order Approximation Characterization gives a remainder \(r(h)\) such that, for sufficiently small \(h\) with \(a+h\in I\),

$$ u(a+h)=u(a)+u'(a)h+r(h) =u'(a)h+r(h), \qquad \frac{r(h)}{h}\longrightarrow0. $$

First suppose \(u'(a)=0\). Then \(u(a+h)=r(h)\), and \(|u(a)|=0\). For every nonzero sufficiently small \(h\),

$$ \left| \frac{|u(a+h)|-|u(a)|}{h} \right| = \frac{|r(h)|}{|h|} = \left|\frac{r(h)}{h}\right| \longrightarrow0. $$

Thus the difference quotient for \(|u|\) tends to zero, so the composite is differentiable at \(a\) with derivative \(0\).

Now suppose \(u'(a)=c\ne0\). The first-order approximation implies

$$ \frac{u(a+h)}{h} = c+\frac{r(h)}{h} \longrightarrow c. $$

For positive increments \(h\), we have

$$ \frac{|u(a+h)|-|u(a)|}{h} = \left|\frac{u(a+h)}{h}\right| \longrightarrow |c|. $$

For negative increments \(h\), division by \(h\) reverses the sign relative to division by \(|h|\), so

$$ \frac{|u(a+h)|-|u(a)|}{h} = -\left|\frac{u(a+h)}{h}\right| \longrightarrow -|c|. $$

Because \(c\ne0\), the numbers \(|c|\) and \(-|c|\) are distinct. The difference quotient therefore cannot have a single limit as \(h\to0\). So \(|u|\) is not differentiable at \(a\). \(\square\)

Worked Example: A Genuine Corner in an Absolute-Value Composition

Consider \(F(x)=|x^2-9|\) at \(a=3\). Let \(u(x)=x^2-9\). Then \(u(3)=9-9=0\), and the Power Rule gives \(u'(x)=2x\), so \(u'(3)=6\ne0\). By the theorem for a zero of the inner function, \(F\) is not differentiable at \(3\).

The difference quotient also displays the conflict explicitly. Since \(u(3+h)=6h+h^2=h(6+h)\), for sufficiently small positive \(h\) we have \(6+h>0\), and

$$ \frac{|u(3+h)|-|u(3)|}{h} = \frac{|h(6+h)|}{h} =6+h \longrightarrow6. $$

For sufficiently small negative \(h\), \(6+h>0\) still holds, but \(|h|=-h\). Hence

$$ \frac{|u(3+h)|-|u(3)|}{h} = \frac{|h|(6+h)}{h} =-(6+h) \longrightarrow-6. $$

The two limits differ, confirming nondifferentiability.

Worked Example: A Zero Where the Absolute Value Is Differentiable

Consider \(G(x)=|(x-2)^2|\) at \(a=2\). Set \(u(x)=(x-2)^2\). Then \(u(2)=0\), and the Power Rule gives \(u'(x)=2(x-2)\), so \(u'(2)=0\). The theorem shows that \(G\) is differentiable at \(2\) with derivative \(0\).

In fact, \((x-2)^2\geq0\) for all \(x\), so \(G(x)=(x-2)^2\). Directly, for \(h\ne0\),

$$ \frac{G(2+h)-G(2)}{h} = \frac{|h^2|-0}{h} = \frac{h^2}{h} =h \longrightarrow0. $$

The inner function reaches zero without a nonzero first-order change, so taking absolute value does not create a corner at this point.

What to Check Before Applying the Chain Rule

The absolute-value function is continuous everywhere, but continuity alone does not ensure differentiability: its difference quotient fails to converge at zero. The Chain Rule requires differentiability of the outer function at the inner value, so it directly handles \(|u(x)|\) when \(u(a)\ne0\), but not when \(u(a)=0\). At a zero, inspect \(u'(a)\): if it is zero, the composite has derivative zero; if it is nonzero, the two directions give incompatible limits.

This distinction prevents two common errors. First, the formula \(A'(x)=1\) is valid only for \(x>0\), and the formula \(A'(x)=-1\) only for \(x<0\); neither supplies a derivative at zero. Second, the failure of the outer function to be differentiable at zero does not automatically imply failure of the composite. The inner function can approach that value with zero first-order change, as the last example demonstrates.

Check Your Understanding

Use the derivative definition and the results above to answer the following.

  1. Why can the difference quotient for \(A(x)=|x|\) be simplified to \(1\) near a positive point \(a\)?
  2. What two sequences of increments show that \(A\) is not differentiable at zero?
  3. If \(u(a)<0\) and \(u\) is differentiable at \(a\), what is the derivative of \(|u(x)|\) at \(a\)?
  4. Suppose \(u(a)=0\) and \(u'(a)=0\). What is the derivative of \(|u(x)|\) at \(a\), and what estimate proves it?
  5. For \(H(x)=|x^2-4|\), determine whether \(H\) is differentiable at \(a=2\), using the inner derivative.