Derivative of max function

$\begingroup$

I was just wondering what the derivative of $f(x) = \max(0,1-x)^{2}$ would be. What technique do you use to determine this derivative?

$\endgroup$ 2

3 Answers

$\begingroup$

It might be of help to sketch the function or write it without the $\max$. We get $$f(x) = \begin{cases} (1-x)^2 & \text{if } x \leq 1\\ 0 & \text{if }x \geq 1\end{cases}$$ It is easy to work out the derivative everywhere except at $x=1$. At $x=1$, work out explicitly from definition. $$\lim_{h \to 0^+} \dfrac{f(1+h) - f(1)}{h} = 0$$ $$\lim_{h \to 0^-} \dfrac{f(1+h) - f(1)}{h} = \lim_{h\to 0^-} \dfrac{h^2}{h} = 0$$ Hence, we have $$f'(x) = \begin{cases} 2(x-1) & \text{if } x \leq 1\\ 0 & \text{if }x \geq 1\end{cases}$$

$\endgroup$ 1 $\begingroup$

HINT : Analyze this function on different intervals.

$\endgroup$ 2 $\begingroup$

I would generalize this as follows:

Let

f(x) = max(0, g(x))^2

Then

f'(x) = [2*g(x)*g'(x)] if g(x) is > 0 else [0]

Does it make sense?

$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like