Derivative of $\sqrt{\sin (x^2)}$ I have problems calculating derivative of $f(x)=\sqrt{\sin (x^2)}$.
I know that $f'(\sqrt{2k \pi + \pi})= - \infty$ and $f'(\sqrt{2k \pi})= + \infty$ because $f$ has derivative only if $ \sqrt{2k \pi} \leq |x| \leq \sqrt{2k \pi + \pi}$.
The answer says that for all other values of $x$,  $f'(0-)=-1$ and $f'(0+)=1$.
Why is that? All I get is $f'(x)= \dfrac{x \cos x^2}{\sqrt{\sin (x^2)}} $.
 A: What is the definition of derivative? To find $f^{\prime}(0),$ you need to calculate the limit of $\displaystyle\frac{\sqrt{\sin h^2} - \sqrt{\sin 0^2}}{h}$ as $h \to 0.$ But if you use $h\to 0^{+},$ you will end up with a different answer than if you went with $h \to 0^{-}.$
For the actual calculation, you should know that $\displaystyle\lim_{h\to 0} \frac{\sin h^2}{h^2} = 1,$ so $\displaystyle \lim_{h\to 0} \frac{\sqrt{\sin h^2}}{h} = \lim_{h\to 0}\frac{\sqrt{\frac{\sin h^2}{h^2}}\cdot |h|}{h} = \lim_{h\to 0} \frac{|h|}{h},$ which doesn't exist since $\displaystyle \lim_{h\to 0^{+}} \frac{|h|}{h} = 1$ while $\displaystyle \lim_{h \to 0^{-}} \frac{|h|}{h} = -1.$
A: You have (correctly) that
$$f\,'(x)=\frac{x\cos x^2}{\sqrt{\sin x^2}}$$
where it is defined. When $x$ is very close to $0$, $\sin x\approx x$ and $\cos x\approx 1$, so $$f\,'(x)\approx\frac{x}{\sqrt{x^2}}=\frac{x}{|x|}=\begin{cases}1,&\text{if }x>0\\-1,&\text{if }x<0\;.\end{cases}$$
You can make this more rigorous, of course, but this is a way to think about it that makes the reason pretty clear without any messy calculations.
A: Using the chain rule twice, we can differentiate $f(x) := \sqrt{\sin(x^2)}$ to yield:
$$\frac{df}{dx} = \frac{x\cos(x^2)}{\sqrt{\sin(x^2)}} . $$
The notation $f'(0-) =-1$ means that as we tend towards zero along the negative axis, the derivative tends towads $-1$. To check this, let $x=-k$ where $k>0$. We have:
$$\left.\frac{df}{dx}\right|_{x=-k} = \frac{-k\cos((-k)^2)}{\sqrt{\sin((-k)^2)}} = \frac{-k\cos(k^2)}{\sqrt{\sin(k^2)}} \, .$$
The question is: What happens as $k$ gets smaller and smaller and tends towards zero? Here we use the nice result that for functions with well-defined limits, the product of the limits is the limit of the product. First of all $\cos(k^2) \to 1$ as $k \to 0$. Next, consider the quotient $-k/\sqrt{\sin(k^2)}$. Let is define:
$$L:=\lim_{k \to 0^+} \frac{-k}{\sqrt{\sin(k^2)}} \implies L^2 = \lim_{k \to 0^+} \frac{k^2}{\sin(k^2)} = 1 \, .$$
This last step used the well-known result that $(\sin\theta)/\theta \to 1$ as $\theta \to 0$. Clearly $L<0$ and $L^2=1$ so it follows that $L=-1$, as you wanted to show.
The notation $f'(0+) =1$ means that as we tend towards zero along the positive axis, the derivative tends towards $1$. To check this, let $x=k$ where $k>0$. We have:
$$\left.\frac{df}{dx}\right|_{x=k} = \frac{k\cos(k^2)}{\sqrt{\sin(k^2)}} \, .$$
The question is: What happens as $k$ gets smaller and smaller and tends towards zero? First of all $\cos(k^2) \to 1$ as $k \to 0$. Next, consider the quotient $k/\sqrt{\sin(k^2)}$. Let is define:
$$L:=\lim_{k \to 0^+} \frac{k}{\sqrt{\sin(k^2)}} \implies L^2 = \lim_{k \to 0^+} \frac{k^2}{\sin(k^2)} = 1 \, .$$
Clearly $L>0$ and $L^2=1$ so it follows that $L=1$, as you wanted to show.
A: I don't know if you did it this way, so I figured that I would at least display it.
\begin{align}
   y &= \sqrt{\sin x^2}\\
   y^2 &= \sin x^2\\
   2yy' &= 2x \cos x^2\\
   y' &= \frac{x \cos x^2}{\sqrt{\sin x^2}}
\end{align}
