Minimum of $| \sin x- 1| + |\sin x- 2| + | \sin x -3| + | \sin x+1|$

I would like to know the minimum value of $$| \sin x- 1| + |\sin x- 2| + | \sin x -3| + | \sin x+1|$$ for $x \in \mathbb{R}$.

-
Often I've changed | to \mid. This is the only time I've ever changed \mid to |. The difference is visible and conspicuous: $2|6$, $2\mid 6$. I think the lack of spacing is inappropriate for things like $2\mid6$, and the additional spacing is inappropriate for absolute-value signs. –  Michael Hardy Jan 28 '13 at 19:10
@MichaelHardy: you should use \lvert ... \rvert instead. –  Emanuele Paolini Jan 28 '13 at 19:11

As $-1\leq\sin x\leq1\implies |\sin x-1|=1-\sin x$, $|\sin x-2|=2-\sin x$, $|\sin x-3|=3-\sin x$, $|\sin x+1|=1+\sin x$

Thus the given expression becomes, $1-\sin x+2-\sin x+3-\sin x+1+\sin x=7-2\sin x$ which is minimum when $\sin x$ is maximum and equal to $1$ which gives minimum value equal to $5.$

-

The number $\sin x$ is trying to decide where to live on the number line.

Her friends live at $-1$, $1$, $2$, and $3$.

She wants the sum of her distances to her friends to be as small as possible.

Where should $\sin x$ live? Unfortunately, she has to live between $-1$ and $1$. She starts at $-1$ and begins to travel to the right. For every tiny step she takes, her distance from $-1$ increases by $1$ step, and the sum of her distances from $1$, $2$, and $3$ decreases by $3$ steps, for a net decrease of $2$ steps.

So she should go to the right as far as her nature allows. I hope that $1$ doesn't mind when $\sin x$ moves in.

-
(+1): Excellent! –  Cameron Buie Jan 28 '13 at 20:47

$\sin x-1$ is always non-positive.

$\sin x - 2$ is always negative.

$\sin x -3$ is always negative.

$\sin x + 1$ is always non-negative.

Therefore the whole expression reduces to $$-(\sin x-1) -(\sin x-2) -(\sin x-3) + (\sin x+1).$$

(But if you meant $\sin(x-1)$ where you wrote $\sin x-1$, then none of the above will help you.)

You get $7-2\sin x$. Since the sine oscillates between $1$ and $-1$, the smallest this function ever gets is $7-2=5$.

-

As $x$ varies through $\mathbb R$, $\sin x$ varies through $[-1,1]$. The problem then reduces to finding the minimum of $f(y)=|y-1|+|y-2|+|y-3|+|y+1|$ for $y\in [-1,1]$.

But on $[-1,1]$, $f(y)=(1-y)+(2-y)+(3-y)+(y+1)=7-2y$, so the minimum value is $5$.

-

Here's the graph, which should do it for you:

(Here, I take $|\sin x-1|$, etc. to mean $|\sin(x)-1|$, etc.)

It looks like the minimum value is 5, and Mathematica confirms this:

-
For every $x \in \mathbb{R}$ we have $$-1 \le \sin x\le 1 \quad \forall\ x \in \mathbb{R},$$ and therefore: \begin{eqnarray} f(x)&:=&|\sin x-1|+|\sin x-2|+|\sin x-3|+|\sin x+1|\\ &=&(1-\sin x)+(2-\sin x)+(3-\sin x)+(\sin x+1)\\ &=&5+2(1-\sin x). \end{eqnarray} The minimum is therefore equal to $5=f(\pi/2)$.
Note that $-1\le\sin x\le1$ for all real $x$. This allows you to rewrite each of the $4$ summands without the absolute value bars. For example: $\sin x-3\leq 1-3=-2<0$, so $|\sin x-3|=3-\sin x$; and $\sin x+1\geq -1+1=0$, so $|\sin x+1|=\sin x+1$. Simplify the resulting expression, and then use the fact that $\sin x$ ranges from $-1$ to $1$ (inclusive) to minimize it.