The minimum value of $ f(x) = | x - 1 | + | x - 2 | + | x - 3 | $ is?

25.6k Views Asked by At

I don't get it why my solution is wrong :

My solving :

$ f(x) = | x - 1 | + | x - 2 | + | x - 3 | $

When $ x\leq 1 $

$ f(x) = | x - 1 | + | x - 2 | + | x - 3 | = 0 $

= $ 6 -3x $

since $ x\leq 1 $

$ f(x)\leq 3 $ also it clear $ f(x)\geq 0 $

=> The min value is 0 .

I dont have to consider other cases, since 0 is the min value f(x) can take .

Book has given the answer : $ 2 $ .

8

There are 8 best solutions below

1
On BEST ANSWER

The function $f$ is linear on each of the intervals $(-\infty,1]$, $[1,2]$, $[2,3]$ and $[3,+\infty)$. Since a linear function on an interval always attains its minimum at one of the endpoints of the interval, and $f(x) \to +\infty$ as $x \to \pm \infty$, the function $f$ must attain its minimum at one of $x = 1, 2, 3$. Since $f(1) = 3$, $f(2) = 2$ and $f(3) = 3$, the function $f$ attains a minimum of $2$ at $x = 2$.

0
On

We have \begin{align} f(x) & = \begin{cases} -(x-1)-(x-2)-(x-3) & = -3x+6 & \text{if } x \leq 1\\ (x-1) - (x-2) - (x-3) & = -x+4 & \text{if } x\in[1,2]\\ (x-1) + (x-2) - (x-3) & = x & \text{if } x\in[2,3]\\ (x-1) + (x-2) + (x-3) & = 3x-6 & \text{if }x \geq 3 \end{cases} \end{align} Hence, the minimum occurs at $x=2$ and take a value of $2$ as well. The plot is as shown below. enter image description here

0
On

When $x\leq 1,$ then $f(x)\neq 0.$ First note that $f(x)$ is zero only if all the three terms in the right side are zeros which is not possible. It can be seen minimum is attained when one of these three terms is zero and sum of other two is minimum which happens to be $2.$

0
On

When $ x\leq 1 $

$ f(x) = | x - 1 | + | x - 2 | + | x - 3 | = 0$

= $ 6 -3x $

This piece of the reasoning has at least two flaws. First, the "$= 0$" in the second line seems like a total typo, because it comes out of nowhere, and is false. Secondly, consider the range of values for $6 - 3x$ on this interval; at the boundary $x = 1$, the value is $f(1) = 3$, and the values increase for any lesser value of $x$ (i.e., it's a downward-sloping line that reaches its minimum at this boundary).

0
On

Since $|x|$ is a convex function and a sum of a convex functions is a convex function

and since $\lim\limits_{x\rightarrow\infty}f(x)=+\infty$, we obtain $$\min{f}=\min\{f(1),f(2),f(3)\}=f(2)=2.$$ Done!

2
On

|x-1|+|x-2|+|x-3| (>=)0

x-1+x-2+x-3 (>=)0

3x-6 (>=)0

x (>=) 2

So the minimum value is 2

0
On

Using the Triangle Inequality, if $a_0,a_1,\ldots,a_{2n}$ are real numbers with $a_0\leq a_1\leq \ldots \leq a_{2n}$, then $$\sum_{i=0}^{2n}\,\left|x-a_{i}\right|\geq \sum_{i=0}^{n-1}\,\Big(\left|x-a_{i}\right|+\left|x-a_{2n-i}\right|\Big)\geq \sum_{i=0}^{n-1}\,\left(a_{2n-i}-a_i\right)$$ for every $x\in\mathbb{C}$. The equality holds iff $x=a_n$.

On the other hand, $$\sum_{i=1}^{2n}\,\left|x-a_i\right|=\sum_{i=1}^{n-1}\,\Big(\left|x-a_i\right|+\left|x-a_{2n+1-i}\right|\Big)\geq \sum_{i=1}^{n-1}\,\left(a_{2n+1-i}-a_i\right)$$ for all $x\in\mathbb{C}$. The equality holds if $x$ is a real number between $a_{n-1}$ and $a_n$.

In this problem, you have $a_0=1$, $a_1=2$, and $a_2=3$ (i.e., $n=1$). Therefore, the minimum value of $$\sum_{i=0}^2\,\left|x-a_i\right|=|x-1|+|x-2|+|x-3|$$ occurs when $x=a_1=2$, which gives the value $2$.

0
On

Geometrically, you are trying to find a point $p$ that minimizes the sum of distances from $p$ to $1$, to $2$, and to $3$; convince yourself, first, that such a point must be somewhere in $[1, 3]$.

Next, consider picking the point $p=2$ to begin with (noting that the distance between $p$ and $2$ is, therefore, $0$). If you move $p$ to the left, its distance to $1$ gets smaller just as much as its distance to $3$ gets bigger, which keeps the sum of these two distances constant; however, $p$ also moves away from $2$ in the process, which means that the overall sum of distances increases. So, moving to the left is no help. A similar argument indicates why moving to the right is no help, which leads to the conclusion that, in fact, your minimum is attained by staying still at the point $p=2$.

Plugging this value in for $x$, we end up with:

$$f(2) = |2-1| + |2-2| + |2-3| = 1 + 0 + 1 = 2$$