0
$\begingroup$

I have to plot graph of
$$f(x)=|x|+2|x-1|+|x-4|$$
See I know graphs of individual $|x|,2|x-1|,|x-4|$
But how can I draw their sum.
I have to find minimum value of the sum using graph.

$\endgroup$
2
$\begingroup$

Hint: make a case distinction.

1st case: $x< 0$

2nd case: $0\leq x < 1$

3rd case: $1\leq x < 2$

4th case: $2\leq x$

In all four cases, you can simplify the expression to a linear function, which yields you the definition of a piece-wise linear function. Plot each of these restricted to the intervals specified by the conditions, and you get the graph.

$\endgroup$
  • $\begingroup$ I think, this implies that the minimum value lie at one of the points at which individual values are least. Thanks. $\endgroup$ – Love Invariants Apr 15 at 7:35
1
$\begingroup$

If you are interested in a more general solution of what the minimum of your expression is (even without graphs):

Your expression has the generalized form

$$\sum_{k=1}^n|x-x_i|$$

A standard result is that the minimizer of this expression is a median of the data $x_1, \ldots , x_n$.

So, in your case the minimum is the median $m$ of $0,1,1,4$: $\boxed{m = 1}$.

$\endgroup$
  • $\begingroup$ I got it from graph method answered by A.Pongracz. Thanks for proof in the link. $\endgroup$ – Love Invariants Apr 15 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.