# what's the local maximum and the local minimum of this function?

I have this exercise, it's about finding local maximum and local minimum (eventually. absolute maximum and absolute minimum),

$$y = e^{x} * \left | x - 1 \right |$$

I tried to find the intervals of monotonicity using first derivative test, because the inverse of Fermat's theorem can't be performed. (i.e a point of a function in which the first derivative is zero isn't necessarily a local minimum/local maximum).

Therefore I compute the derivative (of a product): $$(f * g)' = f' * g - f * g'$$

and the first derivative becomes:

$$f'(x) = e^x * \left | x-1 \right | - e^x * sign(x-1) = e^x*(\left | x-1 \right |-sign(x-1))$$

because the sign(x-1) (i.e the first derivative of the absolute value) isn't defined in 1, the domain of the first derivative is $$R-{1}$$. drawing a number line, on the right hand side from zero, I chose an arbitrary point (e.g x = 2), and from the left from zero, I chose x = 0, and I found out it's always positive. so the first derivative is always positive in its domain. So, the local maximum is the point with abscissa equal to zero, and the function has no minimum and no maximum. Am I right?

• $\mathrm{e}^x |x - 1| = \sqrt{\mathrm{e}^{2x}(x - 1)^2}$. Equivalently, you may consider the local maximum and local minimum etc. for $\mathrm{e}^{2x}(x - 1)^2$. Nov 18, 2021 at 16:53

The function you've given is continuous and piecewise differentiable, but not differentiable. This means it's probably easier to look for critical points (I think you call them "intervals of monotonicity") by breaking the function down into a piecewise function of differentiable functions as follows:

$$f(x)=e^x|x-1|=e^x\left\{\begin{matrix} x-1 & x\geq1\\ -x+1 & x<1 \end{matrix}\right.=\left\{\begin{matrix} e^x(x-1) & x\geq1\\ e^x(1-x) & x<1 \end{matrix}\right.$$

Now we can look for critical points in each of these functions on their intervals, as well as an "automatic" critical point at the discontinuity ($$x=1$$). First let us examine the function for $$x\geq1$$:

$$f'(x)=\frac{\rm d}{{\rm d}x}\left(e^x(x-1)\right) \\=\frac{\rm d}{{\rm d}x}(e^x)(x-1)+e^x\frac{\rm d}{{\rm d}x}(x-1) \\=e^x(x-1)+e^x\cdot1 \\=xe^x$$

Solving this for $$f'(x)=0$$, we get $$x=0$$, which we can throw out because we are only looking at the function for $$x\geq1$$. Thus there are no critical points on this interval. Now we can consider the function for $$x<1$$:

$$f'(x)=\frac{\rm d}{{\rm d}x}\left(e^x(1-x)\right) \\=\frac{\rm d}{{\rm d}x}(e^x)(1-x)+e^x\frac{\rm d}{{\rm d}x}(1-x) \\=e^x(1-x)+e^x(-1) \\=-xe^x$$

Solving this for $$f'(x)=0$$, we get $$x=0$$, which is on our interval $$x<1$$. We can use the second derivative test to identify this point:

$$\left.f''(x)\right|_{x<1}=\frac{\rm d}{{\rm d}x}(-xe^x)=-(x+1)e^x)$$

$$f''(0)=-(1)e^0=-1<0$$

Thus $$x=0$$ is a local maximum. Now we must consider the critical point at the non-differentiability. We can't really use the second derivative test to identify the point, but we can examine the first derivative before and after:

$$f'(1^+)=(1)e^1=e$$ $$f'(1^-)=(1-2)e^1=-e$$

So the slope is negative before $$x=1$$, and positive after. This means we have a local minimum at $$x=1$$

Also note that $$f(1)=0$$. Since $$e^x$$ is positive for all $$x$$, and $$|x-1|$$ is positive for all $$x\neq1$$, it must be the case that $$f(1)$$ is also the absolute minimum.

Since $$e^x(x-1)$$ tends to infinity as $$x$$ goes to infinity, there is no absolute maximum.