0

Find the minimum value of the equation $|x-1|+|x-2|+|x+1|+|x+2|$. I checked the values at x=1,x=2,x=-1 and x=-2 and getting the answer 6. Is there any other way to find the minimum values.

4 Answers4

2

generalised Triangle inequality does it!

As $|x-2|=|2-x|$ and $|1-x|=|x-1|$ $$|1-x|+|2-x|+|x+1|+|x+2|\ge |1-x+2-x+x+1+x+2|=6$$

2

For an even number of data their median minimizes the sum of the absolute deviations. As in our case the median equals $0$, the minimum is $6$.

Michael Hoppe
  • 18,614
1

Absolute values change behaviors when the sign changes. In your equation, the sign starts to change when $x= 1,2,-1,-2$ because some of the values in the absolutes become zero, so we examine what happens between these values.

Case $1$: $x \ge 2$. If $x \ge 2$, all the values in the absolute values are positive, and the absolute value of a positive number does nothing, so we remove all the absolute values and simplify to get $4x$. However, remember that $x \ge 2$ in this case, so the smallest $x$ we can use here is $x=2$, so the minimum for this case is $8$

Case $2$: $2 \ge x \ge 1$. If $2 \ge x \ge 1$, all values in $|x−1|+|x−2|+|x+1|+|x+2|$ are positive except for $|x-2|$. Taking the absolute value of a negative expression is equal to multiplying it by negative one. Example $|-1|$ = $1$ because $-1*-1$ = $1$. So, $|x-2| = -(x-2) = 2-x$. So, our equation becomes $(x−1)+(2-x)+(x+1)+(x+2)$ which simplifies down to $2x+4$. Since $2 \ge x \ge 1$, the smallest $x$ we can use is $1$, so our minimum value in this case is $6$.

Case $3$: $1 \ge x \ge -1$. If $1 \ge x \ge -1$, all values in $|x−1|+|x−2|+|x+1|+|x+2|$ are positive except for $|x-2|$ and $|x-1|$. So, our equation becomes $(1-x)+(2-x)+(x+1)+(x+2)$ which simplifies down to $6$. So, the minimum value is $6$ in this case.

Case $4$: $-1 \ge x \ge -2$. If $-1 \ge x \ge -2$, all values in $|x−1|+|x−2|+|x+1|+|x+2|$ are positive except for $|x-2|$ and $|x-1|$ and $|x+1|$. So, our equation becomes $(1-x)+(2-x)+(-x-1)+(x+2)$ which simplifies down to $-2x+4$. We are subtracting $2x$ from $4$, so we get the smallest value when we choose the biggest $x$ in $-1 \ge x \ge -2$, so $x=-1$, and thus the smallest value is $6$ in this case.

Case 5: $x \le -2$. If $x \le -2$, all values are negative in $|x−1|+|x−2|+|x+1|+|x+2|$, so our equation becomes $(1-x) + (2-x) +(-x-1) + (-x-2)$ which becomes $-4x$. Since we are subtracting $4x$, we make $x$ as big as possible to get smallest value. The biggest $x$ in $x \le -2$ is $-2$, so our minimum value becomes $8$.

Thus, the smallest minimum in all of our cases is $6$. Took a lot longer, but at least you know for sure you didn't miss a smaller value.

Some Guy
  • 2,728
1

Let $f(x)$ be the above expression. Since $f(x)$ is linear between integers, the minimum will occur at an integer. Since $f(-x)= f(x),$ the minimum occurs at a nonnegative integer $n.$ Since $f(0)=f(1)=6$ and $f(n) \ge 7$ for $n \ge 2,$ the minimum value is $6.$

David
  • 11