So, we want to differentiate #f(x)=x|x|#.
We cannot truly differentiate the absolute value. It has to be done away with. This will necessitate splitting up the function at #x=0,# where the absolute value would change signs, because from #(0, oo), |x|=x,# and from #(-oo, 0), |x|=-x#.
So, from #(-oo, 0): f(x)=x(-x)=-x^2#
Then, #f'(x)=-2x.#
From #(0, oo), f(x)=x(x)=x^2#
Then, #f'(x)=2x#.
You may have noticed that #0# is not included in either of our intervals.
This is because at #x=0,# the function is not differentiable (functions are generally not differentiable at sharp corners or kinks, as is the case with the absolute value function). In fact, at #x=0,# the value of the derivative completely changes, there are two separate derivatives.
So, #f''(0)# would not be defined either. Were we to differentiate again, we would get
#(-oo, 0): f''(x)=-2. (0, oo): f''(x)=2#
Graphically, this would look like two horizontal lines, #y=+-2,# with #y=-2# being graphed from #(-oo, 0)# and #y=2# being graphed from #(0, oo).# At #x=0,# there would be a sudden jump from #y=-2# to #y=2#. There would be no derivative defined at #x=0.#