I'm a university student taking a real analysis paper. I'm currently working down my problem sheet and have arrived at a series of questions reguarding smoothness and the like. I'm still getting the hang of these types of question so if any one has any tips or tricks to steer me in the right direction it would be much appreciated.
Reguarding the above question. The function is an absolute value so it is defined peice-wise.
$$f(x)= \begin{cases} (x-2)^2 & x < 0 \\ -(x-2)^2 & x \geq 0 \\ \end{cases} $$
$$f(x)= \begin{cases} 4x-4-x^2 & x < 0 \\ x^2-4x+4 & x \geq 0 \\ \end{cases} $$
$$f'(x)= \begin{cases} 4-2x & x < 0 \\ 2x-4 & x \geq 0 \\ \end{cases} $$
$$f''(x)= \begin{cases} -2 & x < 0 \\ 2 & x \geq 0 \\ \end{cases} $$
I am confused as to the classification of $C^1$ and $C^2$ as well as being generally derivable. I would assume the absolute value ensures the derivative does not exist at $x=2$ for all three except the second derivative which appears to have its derivatve not exist at $x=0$, therefore the function cannot be $C^1$ or $C^2$? I am very new to this so if anyone can help me out it would be much appreciated!
Note the function is \begin{align} f(x) &= |4x - 4 - x^2|\\ &= |x^2 - 4x + 4|\\ &= |(x-2)^2|. \end{align}
Observe that $(x-2)^2 \ge 0$ for all $x \in \Bbb R$ and so, the $|\cdot|$ can be dropped and we get $$f(x) = (x-2)^2.$$
Now, it is clear that $f$ is infinitely differentiable everywhere.
It can be seen that your original piecewise definition is incorrect because you write $-(x-2)^2$ for $x \ge 0$. If you plug something like $x = 1$, you get a negative value whereas $|\text{something}|$ can never be negative.