y=∣x∣y = |x|

Graph of the Absolute Value Function y=∣x∣y = |x|

y=∣x∣y = |x| is the magnitude of xx with its sign removed, that is, its distance from the origin on the number line. It equals xx for x≥0x \geq 0 and −x-x for x<0x < 0, and it can also be written ∣x∣=x2|x| = \sqrt{x^2}.

Domain and range

The domain is all real numbers. Since the value is a distance it is never negative, so the range is y≥0y \geq 0.

  • The domain is all real numbers
  • The range is y≥0y \geq 0
  • The minimum is 00, attained at x=0x = 0
  • There is no inflection point

Symmetry

Since ∣−x∣=∣x∣|-x| = |x|, the function is even and its graph is symmetric about the yy-axis.

Shape of the graph

The graph is a V shape, formed by the part of the line y=xy = x with x≥0x \geq 0 joined to the part of the line y=−xy = -x with x<0x < 0, with the origin (0,0)(0, 0) as its vertex. It is made of two rays rather than a curve, so it bends nowhere and has no inflection point.

The corner at the origin

The derivative is 11 for x>0x > 0 and −1-1 for x<0x < 0.

Range of xxyySlope
x<0x < 0−x-x−1-1
x=0x = 000undefined
x>0x > 0xx11

At the origin the slope from the left is −1-1 and the slope from the right is 11; they disagree, so the function is not differentiable at x=0x = 0. It is the standard example of a function that is continuous everywhere yet fails to be differentiable somewhere. Where the parabola y=x2y = x^2 has a smooth valley at the origin, ∣x∣|x| has a sharp corner.

Solutions of the equation ∣x∣=a|x| = a

aaNumber of solutionsSolutions
a>0a > 022x=±ax = \pm a
a=0a = 011x=0x = 0
a<0a < 000none

Notable points

The graph passes through (±1,1)(\pm 1, 1), (±2,2)(\pm 2, 2) and (±3,3)(\pm 3, 3). The magnitude of the slope is 11 everywhere, so the value grows at a constant rate as you move away from the origin.

Relationships with other functions

It equals x2\sqrt{x^2}, and also max⁡(x,−x)\max(x, -x). Both ∣x∣|x| and x2x^2 are even, but x2x^2 flattens near the origin while ∣x∣|x| folds there with a constant slope. The distance to a point in the plane, x2+y2\sqrt{x^2 + y^2}, is the two-dimensional counterpart of this function.

Applications

It measures the size of an error without regard to sign.

  • In statistics, minimizing a sum of absolute values (the L1L^1 norm) gives a fit that is robust to outliers
  • The triangle inequality ∣a+b∣≤∣a∣+∣b∣|a + b| \leq |a| + |b| underpins every branch of mathematics that deals with distance
  • The ReLU of machine learning can be written max⁡(x,0)=x+∣x∣2\max(x, 0) = \dfrac{x + |x|}{2}, which is just the right half of the absolute value