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

Homework Help: Differentiating Piecewise Functions

  1. Mar 26, 2006 #1
    Hello Calculus Forum,

    I need some help in differentiating piecewise functions and finding local/absolute minimum/maximum values. Problem is, I don't know how. For example,

    .........-x , if x<0
    f(x)={ 2x^3-15x^2+36x , if 0<x<4, or x=0, or x=4
    ........ 216-x , if x>4

    my first inclination is to differentiate each part separately, see where the slopes change in each part, and then calculuate the min/max values using the critical points, but I am not arriving at the correct answers. =\

    I can find out the critical points of the middle part pretty easily
    (x= 2,x=3), but my answer key also reads that there is a local minimum point at f(0)=0
    I really don't have a good idea of how f(0) could be a minimum value, unless it is because x=0 is where the first part of the fuction ends and where the second piece begins, but if I am right in that regard, why isn't x=4 also considered a critical value?

    Hope my question makes sense, and so on.

  2. jcsd
  3. Mar 26, 2006 #2


    User Avatar
    Science Advisor

    There are no critical points "for the middle part"! Remember that a critical may be at a point where the derivative is 0, or where the derivative does not exist. You are given that
    f(x)= -x , if x<0
    f(x)= 2x^3-15x^2+36x , if 0<x<4, or x=0, or x=4
    f(x)= 216-x , if x>4

    f'(x)= -1, if x< 0
    f'(x)= 6x2-30x+ 36, if 0< x< 4
    f'(x)= -1, if x> 4

    f'(x) does not exist at x= 0 or 4.

    Obviously f' is never 0 for x not between 0 and 4. 6x2- 30x+ 6= 0 is the same as x2- 5x+ 6= (x-6)(x+1) 0 has roots
    -1 and 6 which are not between 0 and 4. The only possible local max and min are at 0 and 4!

    for x close to 0 but positive, f'(x) is close to 36> 0 so f is increasing to the right of x= 0. On the other hand, for x< 0, f(x)= -x> 0= f(0). Clearly, x= 0 is a local minimum.

    for x close to4 but less than 4, f'(x) is close to 24- 120+ 36< 0 so f is decreasing for x< 4. For x> 4 but close to 4, f(x) is close to 212= f(4) but less. Clearly, x= 4 is a local maximum.
  4. Mar 26, 2006 #3
    but isn't 6x^2-30x+36=x^2-5x+6=(x-3)(x-2)

    which would place its roots inside the given domain?

    In addition, since in the original fuction, the domain of the middle function is "x greater than/equal to 0, less than/equal to 4", wouldn't that mean that x=0 and x=4 are within the parameters of the fuction, which would mean that f'(x) would also be defined at those points?

    Thanks a lot for the reply, it's already cleared a lot of things for me. If you could just answer some of my last questions here, that'd be great.

  5. Mar 27, 2006 #4


    User Avatar
    Science Advisor
    Homework Helper

    You should be abel to see by inspection that as [itex]x \to -\infty[/itex], [itex]f(x) \to \infty[/itex], and likewise as [itex]x \to \infty[/itex], [itex]f(x) \to -\infty[/itex], so there are no absolute minima or maxima. Sisyphus, you're right, HallsofIvy miscalculated, and on (0,4), f'(x) = 6(x-3)(x-2). So, on (0,4), f''(x) = 12x - 30. f''(2) = -6, and f''(3) = 6, so 2 is a local maximum, and 3 is a local minimum.

    Just because f is defined at 0 and 4 doesn't mean f'' is defined there. You should know this. For example, the absolute value function is defined at 0, since |0| = 0, but it has no derivative at 0. So you have to "manually" check the behaviour of the function around 0 and 4.

    f(0) = 0, f(4) = 32. It's easy to see that for x < 0 but close to 0, f(x) > 0. For x > 0 but close to 0, f(x) = x(2x² - 15x + 36). x is positive, and since x is small, (2x² - 15x + 36) is approximately 36, i.e. whatever it is, it is positive, so f(x) is positive. So 0 is another local minimum. For x > 4 but close to 4, it's easy to see that f(x) is close to 212 which is greater than f(4) = 32. You can also see that for x < 4 but close to 4, f'(x) is close to 6*4² - 30*4 + 36 = 12 > 0, so f is increasing as it approaches 4 from the left. So 4 is not a local minimum or maximum (because to the right, the f is clearly larger than f(4), and on the left, since f increases as it approaches 4 and f is continuous on [0,4], f must be smaller than f(4)).
  6. Mar 27, 2006 #5


    User Avatar
    Homework Helper

    BTW, the tex for

    .........-x , if x<0
    f(x)={ 2x^3-15x^2+36x , if 0<x<4, or x=0, or x=4
    ........ 216-x , if x>4


    f(x)=\left\{\begin{array}{cc}-x,&\mbox{ if } x< 0\\2x^3-15x^2+36x , & \mbox{ if } 0\leq x\leq 4 \\216-x, & \mbox{ if }x>4\end{array}\right.

    which looks like this:

    [tex] f(x)=\left\{\begin{array}{cc}-x,&\mbox{ if }
    x< 0\\2x^3-15x^2+36x , & \mbox{ if } 0\leq x\leq 4 \\216-x, & \mbox{ if }x>4\end{array}\right. [/tex]
  7. Mar 27, 2006 #6


    User Avatar
    Homework Helper

    Recall that the derivative of a function, say f(x), at a point x=a is given by

    [tex]f^{\prime} (a) = \lim_{x\rightarrow a} \frac{f(x)-f(a)}{x-a}[/tex]

    which exists if and only if the left- and right-hand limits exist and are equal so that for the above function

    [tex]f_+^{\prime} (0) = \lim_{x\rightarrow 0^+} \frac{f(x)-f(0)}{x-0} = \lim_{x\rightarrow 0^+} \frac{(2x^3-15x^2+36x) -0}{x-0}= \lim_{x\rightarrow 0^+} 2x^2-15x+36 = 36[/tex]


    [tex]f_-^{\prime} (0) = \lim_{x\rightarrow 0^-} \frac{f(x)-f(0)}{x-0} = \lim_{x\rightarrow 0^-} \frac{(-x) -0}{x-0}= \lim_{x\rightarrow 0^-} -1=-1[/tex]

    so that [tex]f^{\prime}(0)[/tex] does not exist, note that [tex]f_{-}^{\prime}(a)\mbox{ and }f_{+}^{\prime}(a)[/tex] are called the left- and right-hand derivatives of f(x) at x=a (and, if equal, are then equal to the derivative [tex]f^{\prime}(a)[/tex], similar to left- and right-hand limits).

    Try calculating the left- and right-hand derivatives of f(x) at x=4.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook