# Examples of functions that are $C^2$ but not $C^3$

I am trying to find examples of functions that are in $C^2(\mathbb{R})$ but not in $C^3(\mathbb{R})$. I am also wondering about $C^2[0,1]$ and $C^3[0,1]$.

If I am not mistaken about the definitions, a function is said to be in $C^p(A)$ if it is a real-valued function with the set $A$ as its domain and its $p$-th derivative being defined on all of $A$ and continuous.

Thanks!

-
The definition I think that you mean is that its $p$th derivative is a continuous function. – alex.jordan Nov 16 '12 at 7:57
Thanks Alex. I will re-edit the definition. I was not really sure about it! – Learner Nov 16 '12 at 7:59
I think your original definition is fine if you replace the typo "differential" with "differentiable". – alex.jordan Nov 16 '12 at 8:00
Alex, do you think the current definition is ok now? – Learner Nov 16 '12 at 8:01
I'd say so. You could emphasize that the $p$th derivative is also defined on all of $A$. And another thing: it's all just about convention, but I would have it that by "differentiable on $[0,1]$" you are referring to a topological definition of the derivative that uses open neighborhoods, whereby differentiable at $0$ or at $1$ means what would normally be a one-sided derivative. – alex.jordan Nov 16 '12 at 8:06

Take some function $f \in C^0(\mathbb R) \setminus C^1(\mathbb R)$, for example $f\colon x \mapsto \left|x-\frac 12\right|$. Taking the antiderivative twice, gives you $$F \colon x \mapsto \int_0^x \int_0^\xi \left|t - \frac 12\right| \, dt\,d\xi$$ which is in $C^3(\mathbb R) \setminus C^2(\mathbb R)$ (no, you don't want $C^2(\mathbb R)$-functions to be bounded). Restricting $F$ to $[0,1]$ gives you an example there.

-

Define $f:\mathbb{R}\rightarrow\mathbb{R}$ by $$f(x):=x^2|x|,\text{ for all }x\in\mathbb{R}.$$ By translating the function suitably at $\frac{1}{2}$, one can answer the next question as well.

-

Take a function that is piecewise continuous but not continuous and antidifferentiate it the proper number of times.

For example, let $f(x)=\begin{cases}1&x>0\\-1&x<0\end{cases}$. A first antiderviative is $|x|$. A second antiderivative is $x|x|/2$, and a third antiderivative is $x^2|x|/6$. This last function meets your conditions.

-