# Minimum of a absolute function

1. Sep 12, 2004

### cateater2000

For which value of x in 0<=x<=4 is the function|x| + 3|x-1| + |x-3|+2|x-4| minimized. I don't know how to differentiate, this and I'm not sure how to draw the graph, any tips would be great.

2. Sep 12, 2004

### arildno

Note that your function consists of linear segments, with vertices at x=0,1,3,4
Therefore find the minimum value of these 4 points

3. Sep 12, 2004

### modmans2ndcoming

in general, you take the derivative, set it equal to zero and solve for the unknown then plug that into the original equation. depending on the type of equation you will have a relative or absolute min or max.

why are you trying to solve a minimization with out differentiation? are you in pre calc and working with guess and check?

4. Sep 12, 2004

### Hurkyl

Staff Emeritus
That approach only works for differentiable functions. :tongue:

5. Sep 12, 2004

### Zurtex

Although you can differentiate it in general it won't be possible at its minimum points.

However it's not a particularly complex function and just involves integers, so just work out x = 0, 1, 2, 3, 4 and that should give you your answer.

6. Sep 12, 2004

### cateater2000

modmans2ndcoming obviously I'd differentiate it if I knew how to. Thanks for your help to the rest of you.

7. Sep 12, 2004

### shmoe

Which is fine, to max/minimize the "calculus way" you look at the critical points, which includes all the points where the derivative does not exist.

cateater2000, you should be able to break this up into a piecewise defined function, if only to convince yourself it is linear in between the integers 0, 1, 3, 4, as arildno mentioned (this will also aid in graphing). You can then differentiate it as usual (with special care at the break points).

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

when 0<=x<1, all the arguments inside the absolute values are negative except the first, so
f(x)=(x)+3(-(x-1))-(x-3)+2(-(x-4))=-5x+8

when 1<=x<3, the first two arguments are positive, the second two are negative, so
f(x)=(x)+3(x-1)-(x-3)+2(-(x-4))=x+2

You can do the interval 3<=x<=4.

You can now differentiate this guy, and get a piecewise defined function as it's derivative. When 0<x<1, f'(x)=-5, and so on. Note that the derivative is not defined at x=1, or 3 (why?).

I'd strongly suggest you finish what I've started in converting this to a piecewise defined function and draw the graph to give you an idea of how this thing behaves.

8. Sep 12, 2004

### Theelectricchild

Wait a minute can you put all that in TeX I did not understand.

9. Sep 13, 2004

### shmoe

Sure, not much will change though, the end piecewise defined function will look neater.

We're concerned with the function $$f(x)=|x|+3|x-1|+|x-3|+2|x-4|$$ on the interval $$[0,4]$$. We have to break it up at the points where one of the arguments of an absolute value changes sign, namely $$x=1$$ and $$x=3$$. 0 and 4 won't matter for this since they are at the endpoints of our domain.

When $$0\leq x<1$$, $$x$$ is non-negative, so $$|x|=x$$. On this same interval, $$x-1, x-3, x-4$$ are all negative, so $$|x-1|=-(x-1)=1-x,|x-3|=-(x-3)=3-x,|x-4|=-(x-4)=4-x$$. We can use this to determine:

$$f(x)=x+3(1-x)+3-x+2(4-x)=-5x+14$$ on the interval $$0\leq x <1$$

which may be why you didn't understand, I apparently can't add, sorry. You do a similar analysis on the other intervals, and (hopefully) find

$$f(x)=\begin{cases}-5x+14& if\ 0\leq x <1,\\x+8& if\ 1 \leq x <3,\\ 3x+2& if\ 3\leq x\leq 4\end{cases}$$

You can now differentiate this guy and quickly see

$$f'(x)=\begin{cases}-5& if\ 0< x <1,\\1& if\ 1 < x <3,\\ 3& if\ 3< x<4\end{cases}$$

You should be able to see it's not differentiable at 1 and 3.

10. Sep 13, 2004

### Theelectricchild

Oooh there we go thank you very much.