# Derivatives Involving Absolute Value

Tutorial on how to find derivatives of functions in calculus (Differentiation) involving the absolute value.

## Derivative of an Absolute Value Function

Let \( f(x) = | u(x) | \).Note that \( |u(x)| = \sqrt {u^2(x)} \)

Use the chain rule of differentiation to find the derivative of \( f = | u(x) | = \sqrt {u^2(x)}\).

\( \dfrac{df}{dx} = \dfrac{df}{du} \dfrac{du}{dx} \)

\( \dfrac{df}{du} = \dfrac{1}{2} \dfrac{2 u }{\sqrt {u^2}} = \dfrac{u}{|u|} \)

Hence

\[ \large \color{red}{\dfrac{df}{dx} = \dfrac{du}{dx} \dfrac{u}{|u|}} \]

## Examples with Solutions

Example 1

Find the first derivative \( f \,'(x) \), if \( f(x) \) is given by
\[ f(x) = |x - 1| \]
__Solution to Example 1__

Let \( u = x - 1\) so that \( f(x) \) may be written as

\( f(x) = |u| = \sqrt{u^2} \)

Use the chain rule

\( f \, '(x) = \dfrac{df}{du} \dfrac{du}{dx} \)

\( f \, '(x) = (1/2) \dfrac{2u}{\sqrt{u^2}} \dfrac{du}{dx}\)

\( f \, '(x) = u \cdot \dfrac{u \, '}{|u|} \)

\( f \, '(x) = u \cdot \dfrac{1}{\sqrt{u^2}} = \dfrac{x-1}{|x-1|} \)

Note the following:

1) if \( x \gt 1 \), then \( |x - 1| = x - 1 \) and \( f \, '(x) = 1 \).

2) If \( x \lt 1 \), then \( |x - 1| = -(x - 1) \) and \( f \, '(x) = -1 \).

3) \( f \,'(x) \) does not exist at \( x = 1 \).

The graphs of \( f \) and its derivative \( f' \) are shown below and we see that it is not possible to have a tangent to the graph of \( f \) at \( x = 1 \) which explains the non existence of the derivative at \( x = 1 \).

Example 2

Find the first derivative of \( f \) given by
\[ f(x) = - x + 2 + |- x + 2| \]
__Solution to Example 2__

\( f(x) \) is made up of the sum of two functions. Let \( u = - x + 2 \) so that

\( f\,'(x) = -1 + u \, ' \dfrac {u}{|u|} = -1 + \dfrac{-1(-x+2)}{|-x+2|} \)

Simplify

\( f\,'(x) = - 1 - \dfrac{-x+2}{|-x+2|} \)

Note the following:

1) If \( x \lt 2 \), \( |- x + 2 | = - x + 2 \) and \( f \, '(x) = -2 \).

2) If \( x \gt 2 \), \( |- x + 2 | = -(- x + 2) \) and \( f \, '(x) = 0 \).

3) \( f \, '(x) \) does not exist at \( x = 2 \).

As an exercise, plot the graph of \( f \) and explain the results concerning \( f'(x) \) obtained above.

Example 3

Find the first derivative of \( f \) given by
\[ f(x) = \dfrac{x+1}{ |x^2 - 1| } \]
__Solution to Example 3__

\( f\,'(x) = \dfrac{1.|x^2 - 1|-(x+1)(2x)\dfrac{x^2 - 1}{|x^2 - 1|}}{|x^2 - 1|^2} \)

Split the fraction into two fractions and simplify the fraction on the left side

\( f\,'(x) = \dfrac{1}{|x^2-1|} - \dfrac{2x(x+1)(x^2-1)}{(x^2-1)^2|x^2-1|} \)

Simplify the fraction on the right side

\( f\,'(x) = \dfrac{1}{|x^2-1|} - \dfrac{2x}{(x-1)|x^2-1|} \)

Set the two fractions to the same denominator

\( f\,'(x) = \dfrac{x-1}{(x-1)|x^2-1|} - \dfrac{2x}{(x-1)|x^2-1|} \)

Add the two fractions and simplify

\( f\,'(x) = - \dfrac{x+1}{(x-1)|x^2-1|} \)

## Exercises with Answers

Find the first derivatives of these functions

Hint: In some of the questions below you might have to apply the chain rule more than once.

1. \( f(x) = |2x - 5| \)

2. \( g(x) = (x - 2)^2 + |x - 2| \)

3. \( h(x) = \left |\dfrac{x+1}{x-3} \right| \)

4. \( i(x) = \left | -2x^2 + 2x -1 \right| \)

5. \( j(x) = e^{|2x-1|} \)

6. \( k(x) = | \ln(-3x+1)| \)

7. \( l(x) = \sin |2x| \)

__Answers to above exercises:__

1. \( f \, '(x) = 2 \dfrac{2x-5}{|2x-5|} \)

2. \( g \, '(x) = 2 (x - 2) + \dfrac{x-2}{|x-2|} \)

3. \( h \, '(x) = -4 \left|\dfrac{x-3}{x+1}\right| \dfrac{x+1}{(x-3)^3} \)

4. \( i\,'(x) = \dfrac{\left(-2x^2+2x-1\right)\left(-4x+2\right)}{\left|-2x^2+2x-1\right|} \)

5. \( j\,'(x) = \dfrac{2e^{\left|2x-1\right|}\left(2x-1\right)}{\left|2x-1\right|} \)

6. \( k\,'(x) = -\dfrac{3\ln \left(-3x+1\right)}{\left|\ln \left(-3x+1\right)\right|\left(-3x+1\right)} \)

7. \( l\,'(x) = \dfrac{2x\cos \left(2\left|x\right|\right)}{\left|x\right|} \)