Textbook
For a real number, absolute value is defined by $|a|=a$ when $a\ge0$ and $|a|=-a$ when $a<0$. It is always nonnegative and equals zero only when $a=0$. Geometrically, it is the distance from point $a$ to zero.
Thus $|-4|=4$ and $|4|=4$. The distance between real numbers $a$ and $b$ is $|a-b|$. For $\varepsilon\ge0$, the condition $|a-b|\le\varepsilon$ bounds absolute error. The same single bars around a set denote cardinality: the argument’s type determines the symbol’s meaning.
The definition gives $|a|=|-a|$: reflection across zero preserves distance. Absolute value therefore cannot recover the original sign. For $r>0$, the equation $|a|=r$ has two real solutions, $a=r$ and $a=-r$; for $r=0$ it has one. Likewise, $|a-b|\le\varepsilon$ is equivalent to $b-\varepsilon\le a\le b+\varepsilon$: a distance bound describes an entire interval of admissible values.
Definitions and further reading: Mathematics for Machine Learning.
In plain language
Absolute value keeps the size of a displacement and removes its direction: four steps left and four steps right travel equally far from zero. Negating a negative input produces a nonnegative distance, while a positive input needs no change. Two houses four kilometres away on opposite sides of a road have equal distances but different addresses. A route also needs a direction; a distance measurement was not hired as a signpost.
Example
The illustrative inputs −4, 0, and 4 show all branches. The negative input changes sign, zero stays zero, and the positive input is unchanged.
Absolute Value: Distance From Zero
Left of zero
For −4, the negative-input branch applies.
Step 1 of 3: Left of zero
Read all steps
Left of zero
For −4, the negative-input branch applies.
- State
- −4current4current
At zero
Zero has no distance from itself.
- State
- 0current0current
Right of zero
The positive value stays unchanged.
- State
- 4current4current
The steps distinguish each input from its result: −4 and 4 remain different numbers even though both produce the same four. Zero tests where the definition’s branches meet; the nonnegative branch already includes it. If expanding an absolute value gives a negative answer, the selected branch and calculation need checking. None of these cases permits that result, regardless of the original input’s sign.
Related concepts: Approximation error, Vector norms.