Category: Functions Level: 201
|x| = -x (x < 0), x (x ≥ 0)
The absolute value is two lines glued at the origin. Keep the right half of y = x and the left half of y = −x, and the V shape appears.
Start with y = x and y = −x. Each one is a full line, and each one is wrong half the time.
y = x, y = -x
For x ≥ 0 the number is already positive, so |x| = x. Keep that half and drop the rest.
|3| = 3
For x < 0 the minus sign flips a negative into a positive: −(−3) = 3. Keep the left half of y = −x.
|-3| = -(-3) = 3
The two halves meet at the origin, the corner of the V. The graph never dips below the x-axis, because distance from zero is never negative.
|x| ≥ 0 for every x
cd svg-generator python3 -m svgmath render absolute-value-piecewise --out /tmp/absolute-value-piecewise
Source: svgmath/diagrams/function_families.py