practicecalculus
Algebraic functions

Absolute Value Function |x|: Graph, Derivative, Integral and Corner

The absolute value function |x|: its V-shaped graph, why it is continuous but not differentiable at 0, its derivative x/|x|, and its integral.

Algebraic functions Updated 3 min read

At a glance

f(x) = |x| = \begin{cases} x & x \ge 0 \\ -x & x < 0 \end{cases}
Domain
(-\infty, \infty)
Range
[0, \infty)
Derivative
\frac{x}{|x|}
Integral
\frac{x|x|}{2} + C
Not differentiable at
x = 0 (a corner)
Symmetry
Even: |-x| = |x|
On this page
  1. Formula
  2. Graph of |x|
  3. Key properties
  4. Derivative of |x|
  5. Integral of |x|
  6. Worked examples
  7. Common mistakes
  8. How it connects

The absolute value function f(x) = |x| gives the distance from x to 0 on the number line, so it removes any negative sign: |3| = 3 and |-3| = 3. Its V-shaped graph is the classic example of a function that is continuous everywhere but has a point where the derivative does not exist.

Formula

|x| = \begin{cases} x & x \ge 0 \\ -x & x < 0 \end{cases}

It is a piecewise function built from two linear functions. Equivalently, |x| = \sqrt{x^2}, which links it to the square root function.

Graph of |x|

Graph of the absolute value function y = |x|
The graph is a V with its vertex at the origin. The slope is -1 on the left and 1 on the right, so there is a corner at x = 0.

The general form y = a|x - h| + k is a V with vertex (h, k), opening up if a > 0 and down if a < 0, with side slopes \pm a.

Key properties

  • Domain all reals; range [0, \infty).
  • Even function: |-x| = |x|, symmetric about the y-axis.
  • Continuous everywhere, including at 0.
  • Absolute minimum of 0 at x = 0, which is a critical point because f'(0) does not exist.
  • Triangle inequality: |a + b| \le |a| + |b|.
  • Products split, sums do not: |ab| = |a||b|, but |a + b| is usually not |a| + |b|.

Derivative of |x|

For x \ne 0:

\frac{d}{dx}|x| = \frac{x}{|x|} = \begin{cases} 1 & x > 0 \\ -1 & x < 0 \end{cases}

At x = 0 the one-sided limits of the difference quotient are

\lim_{h \to 0^+}\frac{|h|}{h} = 1, \qquad \lim_{h \to 0^-}\frac{|h|}{h} = -1

They disagree, so f'(0) does not exist. This is the textbook case of when derivatives fail: a corner. With the chain rule, \frac{d}{dx}|g(x)| = \frac{g(x)}{|g(x)|}g'(x) wherever g(x) \ne 0.

Integral of |x|

\int |x|\,dx = \frac{x|x|}{2} + C

Check it piece by piece: for x > 0 it is \frac{x^2}{2}, with derivative x = |x|; for x < 0 it is -\frac{x^2}{2}, with derivative -x = |x|. For a definite integral, split at the point where the inside changes sign.

Worked examples

Example 1: definite integral. Evaluate \int_{-1}^{2}|x|\,dx by splitting at 0:

\int_{-1}^{0}(-x)\,dx + \int_{0}^{2}x\,dx = \frac{1}{2} + 2 = \frac{5}{2}

Geometrically, these are two triangles with areas \frac{1}{2} and 2.

Example 2: a shifted absolute value. g(x) = |x - 3| has derivative 1 for x > 3 and -1 for x < 3, and is not differentiable at x = 3.

Example 3: chain rule. For x \ne 2, \frac{d}{dx}|2x - 4| = \frac{2x - 4}{|2x - 4|} \cdot 2, which is 2 for x > 2 and -2 for x < 2.

Example 4: a limit. \lim_{x \to 0}\frac{|x|}{x} does not exist, because it is 1 from the right and -1 from the left.

Common mistakes

  1. Saying |x| is not continuous at 0. It is continuous; it is only not differentiable there.
  2. Writing |{-x}| = -|x|. Absolute value is never negative: |-x| = |x|.
  3. Integrating across 0 without splitting. \int_{-1}^{2}|x|\,dx is not \frac{2^2}{2} - \frac{(-1)^2}{2}.
  4. Forgetting it is a critical point. When looking for extrema, include points where the derivative does not exist, like the vertex of a V.

How it connects

Absolute values appear in \int \frac{1}{x}\,dx = \ln|x| + C, in the epsilon-delta definition of a limit, and in absolute convergence of series in convergence tests. For more on corners and other places where derivatives fail, see the continuity guide.

Practice it now

When derivatives fail

Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.

Practice this lesson

Frequently asked questions

What is the derivative of |x|?

For x \ne 0, \frac{d}{dx}|x| = \frac{x}{|x|}, which equals 1 when x > 0 and -1 when x < 0. At x = 0 the derivative does not exist.

Why is |x| not differentiable at 0?

The slope from the right is 1 and the slope from the left is -1. Since the one-sided limits of the difference quotient disagree, the derivative at 0 does not exist, and the graph shows a sharp corner.

Is the absolute value function continuous?

Yes. |x| is continuous at every real number, including 0, where both one-sided limits equal 0 = |0|. It shows that continuity does not imply differentiability.

What is the integral of |x|?

An antiderivative is \frac{x|x|}{2}, so \int |x|\,dx = \frac{x|x|}{2} + C. For definite integrals it is usually easier to split at 0, for example \int_{-1}^{2}|x|\,dx = \frac{1}{2} + 2 = \frac{5}{2}.

Written by the PracticeCalculus team

We build interactive calculus lessons and write every page to be clear and correct. Spotted something off? Tell us and we will fix it.