Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Minimum of a absolute function

  1. Sep 12, 2004 #1
    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. jcsd
  3. Sep 12, 2004 #2


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    Dearly Missed

    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
  4. Sep 12, 2004 #3
    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?
  5. Sep 12, 2004 #4


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    That approach only works for differentiable functions. :tongue:
  6. Sep 12, 2004 #5


    User Avatar
    Science Advisor
    Homework Helper

    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.
  7. Sep 12, 2004 #6
    modmans2ndcoming obviously I'd differentiate it if I knew how to. Thanks for your help to the rest of you.
  8. Sep 12, 2004 #7


    User Avatar
    Science Advisor
    Homework Helper

    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

    when 1<=x<3, the first two arguments are positive, the second two are negative, so

    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.
  9. Sep 12, 2004 #8
    Wait a minute can you put all that in TeX I did not understand.
  10. Sep 13, 2004 #9


    User Avatar
    Science Advisor
    Homework Helper

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

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

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

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

    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

    [tex]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}[/tex]

    You can now differentiate this guy and quickly see

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

    You should be able to see it's not differentiable at 1 and 3.
  11. Sep 13, 2004 #10
    Oooh there we go thank you very much.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook