I am being told that $a + b + |a - b|$ is equal to $2\max(a,b)$.

What is the reasoning behind this?

  • 6
    $\begingroup$ Consider the two cases $a>b$ and $a\leq b$, and see what happens. $\endgroup$
    – Augustin
    Jan 30, 2016 at 12:24
  • 5
    $\begingroup$ Duplicate. $\endgroup$
    – Workaholic
    Jan 30, 2016 at 18:59

5 Answers 5


Intuitively, notice that $\frac{a + b}{2}$ is the midway point between $a$ and $b$, and $\frac{|a - b|}{2}$ is half the distance between the two numbers, so $$\frac{a + b}{2} + \frac{|a - b|}{2}$$ is the mid way point between the two points plus half of the distance between them, which brings you to the larger of the two numbers, thus $$\frac{a+b + |a-b|}{2} = \max(a,b).$$


By considering cases $a>b$ and $a\le b$, it's easy to see that $$ |a-b| = \max(a,b) - \min(a,b), \tag{$note\colon |a-b| = |b-a|$} $$ and $$ a+b = \max(a,b) + \min(a,b). $$ Now add them.


Adding $|a-b|$ to the smaller of the numbers makes it equal to the larger; then adding the original larger number yields twice that.


$$a+b+|a-b|=\begin{cases}a+b+a-b =2a & \text{when} \:a\ge b\\ a+b+b-a = 2b & \text{when} \:b>a\end{cases}$$

Hence we can say that $$a+b+|a-b|=2 \max(a,b)$$

  • $\begingroup$ @BrianO Corrected. Thanks for helping. $\endgroup$ Jan 30, 2016 at 12:45

The set $\{a,b\}$ will have maximum either $a$ or $b$. You can argue the equality you want to show by first assuming $b$ is the maximum (then do the same argument if $a$ is the maximum). So suppose $a < b$ (this same argument would work in reverse if $b < a$).

$|a - b|$ is the distance between $a$ and $b$, i.e., how many units you have to walk from the smaller, $a$, to get to the larger, $b$.

Now, if you take $a$ and add $|a - b|$, i.e., you add the number of units you need to get from $a$ to $b$, where do you end up? Well, at $b$ of course! So $a + |a - b| = b$, where $b$ is the maximum of $\{a,b\}$.

Ok, so $$\begin{split} a + b + |a - b| &= (a + |a - b|) + b \\ &= b + b \\ &= \max\{a, b\} + \max\{a, b\} \end{split}$$


Not the answer you're looking for? Browse other questions tagged .