2
$\begingroup$

How to prove this equation?

$$\max(|x_1-x_2|,|y_1-y_2|) = \frac{\left|x_1+y_1-x_2-y_2\right|+\left|x_1-y_1-(x_2-y_2)\right|}{2}$$

$\endgroup$

2 Answers 2

3
$\begingroup$

Let $a = x_1-x_2$ and $b = y_1-y_2$ to simplify the problem to proving $$\max(|a|,|b|)=\frac{|a+b|+|a-b|}{2}$$

Now let $c=|a|, d=|b|$ and consider the possibilities of $a$ and $b$ having the same sign to show this is equivalent to showing $$\max(c,d)=\frac{|c+d|+|c-d|}{2} \text{ for }c,d \ge 0$$ while if $a$ and $b$ have opposite signs it is equivalent to showing $\max(c,d)=\frac{|c-d|+|c+d|}{2}$ for $ c,d \ge 0$, which is the same thing.

Then consider that if $c \ge d \ge 0$ this is equivalent to showing $c = \max(c,d)=\frac{c+d+c-d}{2}$ while if $d \ge c \ge 0$ this is equivalent to showing $d = \max(c,d)=\frac{c+d+d-c}{2}$. These last two are clearly true.

$\endgroup$
2
$\begingroup$

Simplify by letting $x=x_1-x_2, y=y_1-y_2$.

Note that $\max(x,y) = \frac{1}{2} ( x+y + |x-y|)$. Only two possibilities need be considered to prove this.

Then: \begin{eqnarray} \max(|x|,|y|) &=& \max(\max(x,y), \max(-x,-y)) \\ &=& \max(\frac{1}{2} ( x+y + |x-y|), \frac{1}{2} ( -x-y + |x-y| )) \\ & = & \frac{1}{2}(\max(x+y,-x-y) + |x-y|) \\ &=& \frac{1}{2}(|x+y| + |x-y|) \end{eqnarray}

$\endgroup$

You must log in to answer this question.

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