Why is $ \sum_{n=0}^{k}|m-n|=\sum_{n=0}^{m}(m-n)+\sum_{n=m}^{k}(n-m)$?

479 Views Asked by At

The problem is:

Why is $$ \sum_{n=0}^{k}|m-n|=\sum_{n=0}^{m}(m-n)+\sum_{n=m}^{k}(n-m)\;?$$

4

There are 4 best solutions below

0
On

\begin{align} \sum_{n=0}^{k}|m-n|&= \sum_{n=0, n \le m}^{k}|m-n| + \sum_{n=0, n \ge m}^{k}|m-n| \\ &= \sum_{n=0}^{m}|m-n| + \sum_{n= m }^{k}|m-n|\\ &= \sum_{n=0}^{m}(m-n) + \sum_{n= m}^{k}(n-m) \end{align}

0
On

Note that $|m-n|=m-n$ for $n< m$ and $|m-n|=n-m$ for $n\ge m$.The given sum can thus be split as $$ \sum_{n=0}^k|m-n|=\sum_{n=0}^{m-1}|m-n|+\sum_{n=m}^{k}|m-n|=\sum_{n=0}^{m-1}(m-n)+\sum_{n=m}^{k}(n-m).$$ The only remaining difference is that the summand for $n=m$ is missing from the first sum. But since $|m-m|=0$, this doesn't matter.

Implicitly, we used $0\le m\le k$ in the above. But the result also holds for $m>k$ or $m<0$, provided one interpretes sums with lower index greater than upper index accordingly.

0
On

Hint. Recall that $$ |u| = \begin{cases} -u, & \text{if $u \leq 0$} \\ u, & \text{if $u \geq 0$} \end{cases} $$ thus $$ |m-n| = \begin{cases} n-m, & \text{if $m \leq n$} \\ m-n, & \text{if $m \geq n$.} \end{cases} $$

1
On

Try to understand what it means.

The absolute value $| m - n |$ is $m - n$ when $n \le m$ and $n - m$ when $n \ge m$