Absolute value: nonnegativity, the zero case and |a−b|=|b−a| from the piecewise definition

On this page
  1. Goal and scope
  2. Givens and symbols
  3. Rules and sources
  4. Main derivation
  5. Substeps and lemmas
  6. Reverse audits
  7. Error controls and negative controls
  8. Result and limitations
  9. Verification and source binding

← Guide index · Original MKO

derivation-mko-absolute-value-01 · production-20261019-adopted-96

Goal and scope

Using only the piecewise definition (|x|=x when x≥0, |x|=−x when x<0) together with the order and addition of the reals, prove for all reals x, a, b: (1) |x|≥0; (2) |x|=0 ⇔ x=0; (3) |−x|=|x|; (4) |a−b|=|b−a|. Then compute |−3|, |2−7| and |7−2|, and show that '|x|=x for every x' is false.

Inside the MKO's scope: the real numbers with their standard linear order and additive inverses (assumption a1), and the piecewise function A(x)=|x|. Every property is derived from the piecewise definition, without using ready-made absolute-value rules. It does not treat the triangle inequality, solving inequalities, the complex modulus or norms (the MKO says these come later), and does not change the canonical MKO or its English edition.

Givens and symbols

  • order_basics
  • add_inverse
  • add_assoc
  • add_comm
  • add_zero
  • numeric_evaluation
  • G1 — x, a and b are real numbers; ℝ has its standard linear order and additive inverses (MKO assumption a1).
  • G2 — Definition: if x≥0 then |x|=x; if x<0 then |x|=−x.
  • |x| — the absolute value A(x) of x
  • -x — the additive inverse of x
  • a,\ b — two reals on the number line
  • |a-b| — the distance between a and b

Rules and sources

  • order_basics · prerequisite — Order of the reals: exactly one of u<v, u=v, u>v holds; u<v and v<w give u<w; u<v gives u+w<v+w; u<v and w>0 give uw<vw; u<v and w<0 give uw>vw.
  • add_inverse · prerequisite — Additive inverse: every u has −u with u+(−u)=0; u−v means u+(−v).
  • add_assoc · prerequisite — Associativity of addition: (u+v)+w=u+(v+w).
  • add_comm · prerequisite — Commutativity of addition: u+v=v+u.
  • add_zero · prerequisite — Additive identity: u+0=u.
  • numeric_evaluation · prerequisite — Exact evaluation of an explicit integer or rational expression; independently recomputable.
  • def_unfold · prerequisite — Unfolding a definition: replacing a defined term by its definition (or folding it back) does not change whether a statement is true.
  • eq_replace · prerequisite — Replacement of equals: an expression inside a statement may be replaced by an equal expression without changing whether the statement is true.
  • case_analysis · prerequisite — Proof by cases: if P∨Q holds and both P⇒R and Q⇒R are proved, then R holds. The cases must cover every possibility.
  • forall_intro · prerequisite — ∀-introduction (generalization): if a statement is proved for an arbitrary element x, with no extra assumption on x, it holds for every x in the domain.
  • contrapositive · prerequisite — Contrapositive: P⇒Q is equivalent to ¬Q⇒¬P. The converse Q⇒P is in general not equivalent to P⇒Q.
  • iff_intro · prerequisite — Biconditional: P⇔Q holds exactly when both P⇒Q and Q⇒P hold.
  • forall_elim · prerequisite — ∀-elimination (instantiation): if ∀x∈D, P(x) holds and a∈D, then P(a) holds.
  • quantifier_negation · prerequisite — Negating quantifiers: ¬(∀x, P(x)) is equivalent to ∃x, ¬P(x), and ¬(∃x, P(x)) is equivalent to ∀x, ¬P(x).
  • exists_intro · prerequisite — ∃-introduction: if some a∈D satisfies P(a), then ∃x∈D, P(x).
  • and_intro_elim · prerequisite — Conjunction: from P and Q infer P∧Q; from P∧Q infer P and infer Q.
  • mko_abs_def · cited — Define A:ℝ→ℝ by A(x)=x when x≥0 and A(x)=−x when x<0. Its customary notation is |x|, and |x|≥0. · mko-absolute-value
  • L_sign · lemma — For a real x: if x<0 then 0<−x, and if 0<x then −x<0.
  • L_inv_unique · lemma — For reals u, v: if u+v=0 then v=−u. In particular −(−x)=x and −0=0.

Main derivation

S01 · definition

Before

|x|

After

|x|=x\ \ (x\geq 0),\qquad |x|=-x\ \ (x<0)

Conditions: none

Rule: mko_abs_def · Uses: G1, G2, mko_abs_def

Leaf basis: mko_abs_def + order_basics

State the piecewise definition from the MKO. By trichotomy each real x satisfies exactly one of x<0, x=0, x>0, and x≥0 means x>0 or x=0; so each x falls in exactly one branch, |x| has a single value, and A really is a function ℝ→ℝ. Which branch applies depends on the sign of the number x, not on whether a minus sign appears in an expression.

S02 · implies

Before

x\geq 0

After

|x|=x\geq 0

Conditions: x\geq 0

Rule: def_unfold · Uses: S01

Leaf basis: def_unfold

Case one: x≥0. The first branch gives |x|=x, and x≥0 is the assumption of this case, so |x|≥0.

S03 · implies

Before

x<0

After

|x|=-x>0

Conditions: x<0

Rule: L_sign · Uses: S01, L_sign

Leaf basis: def_unfold + order_basics + add_inverse

Case two: x<0. The second branch gives |x|=−x, and by Lemma L_sign, x<0 implies 0<−x. So in this case |x|>0. The expression −x carries a minus sign, but the number it names is positive.

S04 · implies

Before

x\geq 0\ \lor\ x<0

After

\forall x\in\mathbb{R}:\ |x|\geq 0

Conditions: none

Rule: case_analysis · Uses: S02, S03, order_basics

Leaf basis: case_analysis + order_basics + forall_intro

By trichotomy every real satisfies x≥0 or x<0; S02 gives |x|≥0 in the first case and S03 gives |x|>0, hence ≥0, in the second. Since x was arbitrary, |x|≥0 for every real x. This proves the clause '|x|≥0' of the MKO.

S05 · implies

Before

x\neq 0

After

|x|>0,\ \text{hence}\ |x|\neq 0;\ \text{so}\ |x|=0\Rightarrow x=0

Conditions: none

Rule: contrapositive · Uses: S02, S03, order_basics

Leaf basis: contrapositive + case_analysis + order_basics

Suppose x≠0; then x>0 or x<0. If x>0 then |x|=x>0 (S02); if x<0 then |x|=−x>0 (S03). In both cases |x|>0, so |x|≠0. This proves x≠0 ⇒ |x|≠0, whose contrapositive is |x|=0 ⇒ x=0.

S06 · implies

Before

x=0

After

|0|=0;\ \ \text{hence}\ |x|=0\Leftrightarrow x=0

Conditions: none

Rule: iff_intro · Uses: S01, S05

Leaf basis: iff_intro + def_unfold

Since 0≥0, the number 0 falls in the first branch and |0|=0, so x=0 ⇒ |x|=0. Together with S05 this gives |x|=0 ⇔ x=0: the absolute value vanishes only at 0.

S07 · implies

Before

x>0

After

|-x|=-(-x)=x=|x|

Conditions: x>0

Rule: def_unfold · Uses: S01, L_sign, L_inv_unique

Leaf basis: def_unfold + L_sign + L_inv_unique

Case x>0 of |−x|=|x|: by L_sign, −x<0, so the second branch applies to the number −x: |−x|=−(−x). By Lemma L_inv_unique, −(−x)=x, and for x>0, |x|=x. Hence |−x|=|x|.

S08 · implies

Before

x<0

After

|-x|=-x=|x|

Conditions: x<0

Rule: def_unfold · Uses: S01, L_sign

Leaf basis: def_unfold + L_sign

Case x<0: by L_sign, −x>0, so the first branch applies to −x: |−x|=−x. And for x<0, |x|=−x by the second branch. The two agree, so |−x|=|x|.

S09 · implies

Before

x>0\ \lor\ x<0\ \lor\ x=0

After

\forall x\in\mathbb{R}:\ |-x|=|x|

Conditions: none

Rule: case_analysis · Uses: S07, S08, L_inv_unique

Leaf basis: case_analysis + order_basics + forall_intro

The remaining case x=0: by L_inv_unique, −0=0, so |−0|=|0|. The three cases cover every real by trichotomy, so by proof by cases and generalization, |−x|=|x| for every real x.

S10 · implies

Before

(a-b)+(b-a)

After

(a-b)+(b-a)=0,\ \text{hence}\ b-a=-(a-b)

Conditions: none

Rule: L_inv_unique · Uses: L_inv_unique, add_assoc, add_comm, add_inverse, add_zero

Leaf basis: L_inv_unique + add_assoc + add_comm + add_inverse + add_zero

(a−b)+(b−a)=a+(−b)+b+(−a), which associativity and commutativity rearrange as (a+(−a))+(b+(−b))=0+0=0. By Lemma L_inv_unique with u=a−b and v=b−a, b−a=−(a−b).

S11 · implies

Before

|b-a|

After

|b-a|=|-(a-b)|=|a-b|

Conditions: none

Rule: forall_elim · Uses: S09, S10

Leaf basis: forall_elim + eq_replace

By S10 replace b−a by the equal number −(a−b), then apply S09 with x=a−b: |−(a−b)|=|a−b|. So |a−b|=|b−a| for all reals a, b: the distance between two points of the number line does not change when the endpoints are swapped.

S12 · implies

Before

|-3|

After

|-3|=-(-3)=3

Conditions: -3<0

Rule: def_unfold · Uses: S01, L_inv_unique

Leaf basis: def_unfold + L_inv_unique + numeric_evaluation

−3<0, so the second branch applies: |−3|=−(−3)=3 (L_inv_unique). The result 3 is ≥0, as S04 requires.

S13 · implies

Before

|2-7|,\ |7-2|

After

|2-7|=|-5|=5,\ \ |7-2|=|5|=5

Conditions: none

Rule: def_unfold · Uses: S01, S11

Leaf basis: def_unfold + numeric_evaluation

First compute the number inside: 2−7=−5<0, so the second branch gives |−5|=−(−5)=5; 7−2=5≥0, so the first branch gives |5|=5. They agree, as S11 says for a=2 and b=7: 2 and 7 are 5 apart on the number line.

S14 · implies

Before

\forall x\in\mathbb{R}:\ |x|=x

After

\text{false, since}\ |-3|=3\neq -3

Conditions: none

Rule: quantifier_negation · Uses: S12

Leaf basis: quantifier_negation + exists_intro + order_basics

Counterexample: the negation of 'for every real x, |x|=x' is 'some x has |x|≠x'. The number x=−3 is such an x: |−3|=3, and 3>0>−3, so 3≠−3. This counterexample refutes the equality for all x, so |x|=x cannot be used unconditionally as a general rule; this step does not derive every equality case from one example.

S15 · implies

Before

S04,\ S06,\ S09,\ S11

After

|x|\geq 0,\ \ |x|=0\Leftrightarrow x=0,\ \ |-x|=|x|,\ \ |a-b|=|b-a|

Conditions: none

Rule: and_intro_elim · Uses: S04, S06, S09, S11

Leaf basis: and_intro_elim

The four goals are established by S04, S06, S09 and S11, all resting only on the piecewise definition and on the order and addition of the reals.

Substeps and lemmas

S03.1 · implies

Before

x<0

After

x+(-x)<0+(-x)

Conditions: none

Rule: order_basics · Uses: order_basics

Leaf basis: order_basics

By order_basics (u<v gives u+w<v+w), add w=−x to both sides. Likewise, adding −x to both sides of 0<x gives 0+(−x)<x+(−x), the second part of the lemma.

S03.2 · equivalent

Before

x+(-x)<0+(-x)

After

0<-x

Conditions: none

Rule: eq_replace · Uses: S03.1, add_inverse, add_zero, add_comm

Leaf basis: eq_replace + add_inverse + add_zero + add_comm

Simplify both sides: x+(−x)=0 (additive inverse) and 0+(−x)=(−x)+0=−x (commutativity and identity). The second part simplifies in the same way to −x<0. S03.1 and S03.2 together prove Lemma L_sign.

S07.1 · implies

Before

u+v=0

After

v=-u

Conditions: none

Rule: eq_replace · Uses: add_zero, add_inverse, add_assoc, add_comm

Leaf basis: eq_replace + add_zero + add_inverse + add_assoc + add_comm

v=v+0=v+(u+(−u))=(v+u)+(−u)=(u+v)+(−u)=0+(−u)=−u, using in turn the identity, inverses, associativity, commutativity, the hypothesis u+v=0, and the identity again. With u=−x and v=x: (−x)+x=0, so x=−(−x). With u=v=0: 0+0=0, so 0=−0. This sub-step proves Lemma L_inv_unique.

Reverse audits

  • S15 · sufficient_goal_reduction · S04, S06, S09, S11, and_intro_elim — Goal G: (1) to (4) together. Sufficient condition H: S04, S06, S09 and S11 each hold; H⇒G by conjunction introduction. H is proved forwards from the definition and G is never used as a premise; S12 to S14 are examples and a counterexample.
  • S14 · premise_audit · S12, quantifier_negation, order_basics — One counterexample suffices to refute a universal statement; nothing is claimed here about other values of x.
  • S13 · premise_audit · S01, S11, numeric_evaluation — The value of 2−7 must be found before choosing a branch; a minus sign in the expression may not simply be deleted.
  • S12 · premise_audit · S01, L_inv_unique, numeric_evaluation — The sign of −3 is decided before choosing the branch; N1 recomputes −(−3)=3.
  • S11 · premise_audit · S09, S10, forall_elim, eq_replace — S09 holds for every real, so x=a−b may be substituted; N6 is only a finite check for a, b from −6 to 6, not a proof.
  • S10 · premise_audit · L_inv_unique, add_assoc, add_comm, add_inverse — The rearrangement uses only associativity and commutativity of addition; N5 checks (a−b)+(b−a)=0 as a polynomial identity.
  • S09 · premise_audit · S07, S08, case_analysis, order_basics — All three cases must be handled; the case x>0 alone would not give the general statement.
  • S08 · premise_audit · S01, L_sign — The two unfoldings use different branches (the first for −x, the second for x), each chosen by the sign.
  • S07.1 · premise_audit · add_zero, add_inverse, add_assoc, add_comm, eq_replace — Each link is an identity for all reals or a replacement using the hypothesis u+v=0; the conclusion only says that the additive inverse is unique.
  • S07 · premise_audit · L_sign, L_inv_unique, S01 — The branch is chosen by the sign of the number −x, not of x; this is exactly where mistakes are easy.
  • S06 · premise_audit · S05, iff_intro, def_unfold — A biconditional needs both directions proved: ⇐ here and ⇒ in S05.
  • S05 · premise_audit · S02, S03, contrapositive, case_analysis — A contrapositive is equivalent to the original implication; this step gives one direction only, and the other is in S06.
  • S04 · premise_audit · S02, S03, case_analysis, forall_intro — Proof by cases needs the cases to cover every possibility; x≥0 and x<0 cover all reals by trichotomy.
  • S03.2 · inverse_equivalence · add_inverse, add_zero, add_comm, eq_replace — Only equal expressions are exchanged, so the truth of the inequality is unchanged and the step is two-way.
  • S03.1 · premise_audit · order_basics — Adding the same number to both sides keeps the direction of a strict inequality for every real w, with no side condition.
  • S03 · premise_audit · S01, L_sign — It needs the case assumption x<0 and the lemma, which is proved in S03.1 and S03.2.
  • S02 · premise_audit · S01, def_unfold — The first branch is used only when x≥0; nothing is claimed about |x|=x when x<0.
  • S01 · premise_audit · G2, mko_abs_def, order_basics — This step only states the definition; the branches are exclusive and cover every real because of trichotomy.

Error controls and negative controls

|x| is not always x

The first mistake named by the MKO is always writing |x| as x. |x|=x is only the branch for x≥0; for x<0, |x|=−x. Counterexample: at x=−3, |x|=3 while x=−3. Before using an absolute value, decide the sign of the number inside.

Absolute value is not a rule for deleting minus signs

The second mistake named by the MKO is treating the absolute value as deleting minus signs. Deleting the minus sign in |2−7| gives 2+7=9, but 2−7=−5 and |−5|=5. Likewise, for x=−2, |−x|=|2|=2, while deleting the minus sign would give x=−2. The definition looks at the sign of the value, not at how the symbols look.

|x| is never negative, and −x need not be negative

The third mistake named by the MKO is believing |x| can be negative. The second branch reads |x|=−x and looks negative, but it is used only when x<0, and by L_sign then −x>0; for example x=−3 gives −x=3. So S04 proves |x|≥0 for every real.

  • For every real x, |x|=x → reject — At x=−3, |x|=3≠−3.
  • |2−7|=2+7=9 → reject — 2−7=−5 and |−5|=5.
  • For every real x, |−x|=x → reject — At x=−2, |−x|=|2|=2≠−2; the correct statement is |−x|=|x|.
  • Some real x has |x|<0 → reject — S04 proves |x|≥0 for every real x.
  • Since a−b≠b−a when a≠b, |a−b| and |b−a| are in general different → reject — b−a=−(a−b) and |−x|=|x| (S11); for example |2−7|=|7−2|=5.

Result and limitations

From the piecewise definition: for all reals, |x|≥0; |x|=0 ⇔ x=0; |−x|=|x|; |a−b|=|b−a|. Examples: |−3|=3 and |2−7|=|7−2|=5; |x|=x fails at x=−3, so it is not a general rule.

  • N6 and N10 are finite checks at integer points (a, b from −6 to 6 and x from −10 to 10 respectively) and support only those points; the general statements come from the proofs in S04 and S11.

Verification and source binding

10 declared checks for this guide; only the listed expressions are covered.

  • source commit: b28a5edbd46279b1db2a3f3f48bb3f447e18899f
  • adopted source SHA-256: ca5b2649a099d99d3fc2f80cd2245c776c98a9a136217dfab0d702504caa791f
  • original source SHA-256: 34445117b994db885a5ef32034463f123a04ed40293eda3d29414fa6e7d493f6
  • Lean: NOT_RUN · independent AI: NOT_MEASURED

Same-source full JSON (formulas, ASTs, controls and revision log)