Minimizing a function involving several modulus terms $f(x)=3|x+1|+|x|+3|x-1|+2|x-3|$
finding minimum value of this function
One conventional way would be to make five cases regarding the various inequalities and hence simplifying to find minimum value in a graph as in 

I was trying another way 

method : Aim is to minimise each term .Since difference of x and 1 would matter thrice as much as that between x and 3 would , the value of x should be closer to 1 . 

Applying this thought,x={3(1)+3(-1)+2(3)+1(0)}\9 which gives as x=2/3 . 
This way comes to be incorrect. 
I wanted to know if there were shorter solutions to this problem rather than using the graphical approach each time as when the modulus terms increase to 10 terms , it would be unreasonable to make 11 cases.
 A: We want a point where the derivative goes from negative to positive. For |x-a|, the derivative is negative if x < a and positive if x > a. If f(x) = $\sum|x-a_i|$, then the derivative at x is thus going to be (sum of all $a_i$ greater than x) minus (sum of all $a_i$ less than x). So we want a point where those are equal. That is, we want a number where as many numbers are less than it as greater than. That's called the median. Note that if you have an even number of terms, then there will be a region between the two "middle" terms where the function is constant and minimal. Also note that when calculating the median, you should take repetition into account; that is, if an absolute value term has a coefficient of n, take n copies of the associated $a_i$. For example, in this case you should take the median of -1,-1,-1,0,1,1,1,3,3. And finally, note that it's a bit more complicated if some of the absolute value terms have negative coefficients.
A: $f$ is a convex function because a sum of convex functions is a convex function
and since the graph of $f$ is an union of segments and rays,
$\lim\limits_{x\rightarrow+\infty}f(x)=+\infty$  and $\lim\limits_{x\rightarrow-\infty}f(x)=+\infty$,  we obtain:
$$\min{f}=\min\{f(-1),f(0),f(1),f(3)\}=f(1)=11.$$
A: By triangle inequality we have for the function $$g(x) = 3|x+1|+3|x-1| = |3x+3|+|3-3x|\geq |3x+3+3-3x| =6$$
with equality exactly when $x-1$ and $x+1$ are of equal sign and this is exactly when $-1\leq x\leq 1$. But in this case we have $2|x-3| = 6-2x$. So we have 
$$f(x)=g(x)+|x|+2|x-3|\geq 12-2x+|x|$$ 
So, if $x\geq 0$ we have $f(x) =12-x \geq 11$ and if $x\leq 0$ we have $f(x) =12-3x \geq 12$.
So $f$ achieve minimum at $x=1$ and it is $11$. 
A: Hint:  For the (convex) function $f(x) = \sum \lambda_n|x-a_n|$, ($a_n$ are distinct numbers). we always have a minimum point where derivative does not exist (it is not hard to prove this). 
Hence,
 $$\min{f}=\min\{f( a_1),f(a_2),...,f(a_n)\}$$

I added this part to prove my claim! (Although it is somehow trivial! I am writing this exclusively for down-voter)
Proof : 
We want to show that there is a minimizer which happens to be nondifferentiable point.
we assume $\lambda_n > 0$ (actually we don't need assume this as long as we are sure minimum exist!) Let $c \in \Bbb R$ be the minimum point then it has to be critical point too which means either $f'(c) =0$ or $f'(c) = \text{does not exist}.$  In second case we are done! So assume first case has been happened. So we have $f'(c) =0$. Since $f$ is pieacewise linear, there exist a maximal interval say $[a,b]$ containing $c$ such that $f$ is constant on it. Also note $ -\infty < a< b < + \infty $ because $\lim_{x \to \pm \infty} f(x) = + \infty$. This shows $f(a) = f(b)= f(c)$ and so $a,b$ are minimizer too and moreover (it is easy to show that)  $a,b$ are nondifferentiable points.
Conclusion: In order to find a minimum point, just evaluate $f$ at Absolutvalues' roots and pick the smallest one! Then you don't need think about graphical method which may lead to $11$ cases.
