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.
The integral and sine function are not important here. The point is that the square root sign is defined as the positive root, so $\sqrt {a^2}=|a|$. If we try it with $a=-2$, we have $a^2=4, \sqrt 4=2$ This is covered in a number of other questions on the site. One of them is here