I have the following function
$$g(x) = \int_0^{(\frac{x}{2})^2} \sin \sqrt{t}\ dt$$
Applying the fundamental theorem of calculus one would get
$$g'(x) = \frac{x}{2} \sin \sqrt{(\frac{x}{2}) ^2}$$
My question is related with the square root within the $\sin$ function. It would seem to me that the square root would cancel with the square and we would get
$$g'(x) = \frac{x}{2} \sin (\frac{x}{2})$$
However I was told that this was not quite right, and that the correct answer is
$$g'(x) = \frac{x}{2} \sin (\frac{|x|}{2})$$
I assume it has something to do with allowing the function to be defined over the whole set of the real numbers, but I am not being able to grasp why. Could someone please clarify?
Thanks in advance.