# twice differentiable function [closed]

Is this function twice continuously differentiable?

$$f(x) = \sum_{i=1}^{n}\big(\max\{0,a_i-x_i\}\big)^2$$

where $(x,a\in\mathbb{R}_+^{n})$.

Any hints?

-

## closed as unclear what you're asking by TZakrevskiy, Davide Giraudo, Sami Ben Romdhane, Chris Janjigian, vonbrandMar 18 at 19:02

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

yes, I forgot to mention that. –  dicaranx Mar 18 at 17:04
How do you define order on $\Bbb R^n$? Without that $a>x$ doesn't have much sense. –  TZakrevskiy Mar 18 at 17:09

No, it is not. Take $n=1$, $a=1$ you get $$f(x) = \begin{cases} (1-x)^2 & \text{if x\le 1}\\ 0 & \text{if x>1} \end{cases}$$ whose first derivative is $$f(x) = \begin{cases} -2(1-x) & \text{if x\le 1}\\ 0 & \text{if x>1} \end{cases}$$ which is not differentiable any more in $x=1$.
Take for example the case $$f(x)=\big(\max\{0,x-a\}\big)^2=\left\{\begin{array}{lll} 0 & \text{if} & x<0 \\ (x-a)^2 & \text{if} & x\ge 0.\end{array}\right.$$ It is once differentiable and $$f'(x)=\max\{0,2(x-a)\}=\left\{\begin{array}{lll} 0 & \text{if} & x<0 \\ 2(x-a) & \text{if} & x\ge 0.\end{array}\right.$$ Note that $f'(x)$ IS NOT differentiable at $x=a$.