Why is $\max(x, x')$ equivalent to $\frac{1}{2}( x + x' + |x - x' |)$? Why is it that 
$$\max(x, x') = \frac{1}{2}( x + x' + |x - x'|)$$
is true? Is it supposed to be obvious? Because it seems to come out of thin air for me. Anyway, I've verified this by plotting it in matlab, so it works, but its hardly a satisfying proof/justification.
I've actually have been shown a proof but I am unable to internalize and understand it properly. I will provide it below:
$$\begin{align*}
\max(x, x') &= \max\left(x - \frac{1}{2}(x + x'),\; x' - \frac{1}{2}(x + x')\right) + \frac{1}{2}(x + x')\\\\
&=\max\left(\frac{1}{2}(x - x'), \frac{1}{2}(x' - x)\right) + \frac{1}{2}(x + x')\\\\
&=\max\left(\frac{1}{2}(x' - x), \frac{1}{2}(x - x')\right) + \frac{1}{2}(x + x')\\\\
&=\max\left(-\frac{1}{2}(x - x'), \frac{1}{2}(x - x')\right) + \frac{1}{2}(x + x')\\\\
&=\left| \frac{1}{2}(x - x')\right| + \frac{1}{2}(x + x') \\\\
&= \frac{1}{2}( x + x' + |x -x'| )
\end{align*}$$
The only line that remains a mystery for me is actually the first line. 
$$ \max(x, x') = \max\left(x - \frac{1}{2}(x + x'),\; x' - \frac{1}{2}(x + x')\right) + \frac{1}{2}(x + x') $$
After that everything seems to be simple algebra manipulations, except for the cool use of the identity
$$\left| \frac{1}{2}(x - x')\right| = \max\left(-\frac{1}{2}(x - x'), \frac{1}{2}(x - x')\right)$$ which makes sense to me.
If anyone has a good explanation of why that step is true, I'd be very thankful. Also, and maybe more importantly, that first step seems like magic to me, I have no idea where it came from and if someone has a good explanation for that too, that would be awesome. I'd like to understand this not only to see why its correct, but also to understand how one would have come up with such a result.
 A: You should visualize things on the real number line (Wikipedia link). The average of $x$ and $x'$, that is, the number
$$\frac{x+x'}{2}$$
is exactly halfway between $x$ and $x'$. The distance between $x$ and $x'$ on the number line is
$$|x-x'|$$
(regardless of which of $x$ and $x'$ is larger). Therefore, to get to the larger of the numbers $x$ and $x'$ – in other words, $\max(x,x')$ – we start at the midpoint of $x$ and $x'$ and then move "up" exactly half of the total distance between $x$ and $x'$:
$$\frac{x+x'}{2}+\frac{|x-x'|}{2}=\frac{1}{2}\left(x+x'+|x-x'|\right)$$
Similarly, if we instead moved "down" exactly half of the total distance between $x$ and $x'$, we'd arrive at the smaller of the two numbers, which explains why
$$\min(x,x')=\frac{1}{2}\left(x+x'-|x-x'|\right)$$

As for the first step in the proof you cited, what's being used is
$$\max(x,x')=\max(x+y,x'+y)-y$$
for any number $y$. Here's how I'd explain it: if I want to find the height of the taller of two people, I can either 


*

*measure their heights and take the larger number, or

*have them both stand on boxes of height $y$, measure their total heights with the boxes, take the larger of those two numbers, and then subtract the height of the box
A: If $x>x'$, then $\frac{1}{2}(x+x'+|x-x'|)=\frac{1}{2}(x+x'+(x-x')=\frac{1}{2}(2x)=x=max(x,x')$. If $x<x', |x-x'|=x'-x$ and the same argument works and if $x=x'$ the result is obvious. 
A: For determining the maximum of two arguments $x$, $x'$ we need the case distinction which of the two arguments is larger. 
For determining the absolute value of one argument $x$ one again needs a case distinction, here if the argument is negative or not.
So it is not that surprising that one can express the maximum in terms of the absolute value.
$$
\lvert x - x'\rvert =
\begin{cases}
x - x' & \mbox{for} & x - x' \ge 0 \iff x \ge x' \\
-(x - x') & \mbox{for} & x - x' < 0 \iff x < x' 
\end{cases}
$$
so
\begin{align}
x + x ' + \lvert x - x'\rvert 
&=
\begin{cases}
x + x' + x - x' & \mbox{for} & x \ge x' \\
x + x' - (x - x') & \mbox{for} & x < x' 
\end{cases} 
\\
&= 
\begin{cases}
2x & \mbox{for} & x \ge x' \\
2x' & \mbox{for} & x < x' 
\end{cases}
\end{align}
which gives
$$
\max(x,x') = \frac{x + x ' + \lvert x - x'\rvert}{2} 
$$
Similar one shows
$$
\min(x,x') = \frac{x + x ' - \lvert x - x'\rvert}{2} 
$$
