# 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}}$.

-
Do you mean $\sin^2x$, i.e. $(\sin x)^2$ or $\sin(x^2)$? –  Fly by Night Jan 19 '13 at 21:25
@FlybyNight: Hagrid wrote it correctly. –  Brian M. Scott Jan 19 '13 at 21:28
@FlybyNight: I agree this notation is ambiguous, and I would write $\sin(x^2)$, but apparently some disagree (including many or most calculus textbooks). It is a usual convention that $\sin x^2$ means $\sin(x^2)$, because if $(\sin x)^2$ were intended it would always be written $\sin^2 x$. –  Jonas Meyer Jan 19 '13 at 21:38
I'm sorry. I meant $sin(x^2)$ –  Hagrid Jan 19 '13 at 21:39
@JonasMeyer If I saw $\sin x^2$ in a textbook then I would know that they meant $\sin(x^2)$ and not $\sin^2 x$. Having worked with students for a long time and seen them write $\sin x^2$ instead of $\sin^2 x$ my default setting is to want to check. –  Fly by Night Jan 19 '13 at 21:54

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.

-

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.$

-

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.

-