# Differentiating Piecewise Functions

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.

...

Related Calculus and Beyond Homework Help News on Phys.org
HallsofIvy
Homework Helper
Sisyphus said:
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.

...
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.

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.

Thanks.

AKG
Homework Helper
You should be abel to see by inspection that as $x \to -\infty$, $f(x) \to \infty$, and likewise as $x \to \infty$, $f(x) \to -\infty$, 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)).

benorin
Homework Helper
Gold Member
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

is:

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:

$$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.$$

benorin
Homework Helper
Gold Member
Recall that the derivative of a function, say f(x), at a point x=a is given by

$$f^{\prime} (a) = \lim_{x\rightarrow a} \frac{f(x)-f(a)}{x-a}$$

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

$$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$$

but

$$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$$

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

Try calculating the left- and right-hand derivatives of f(x) at x=4.