Cannot find mistake in my solution of derivative. I was required to find the derivative of $2\sqrt{\cot(x^2)}$.
My solution

I can't find any mistake in my solution but in my book following solution is given:

Of course my answer and the answer in book are not same(I have plotted the graph of both and they don't overlap). 
I understand the solution given in my book.
I'm asking for help to figure out where I have made mistake in my solution. 
 A: Note that $$f(x) = 2 \sqrt{\cot x^2}$$ is real-valued if and only if $\cot x^2 \ge 0$, so for $f : \mathbb R \to \mathbb R$, we must have $$x^2 \in \bigcup_{k=-\infty}^\infty (\pi k, \pi(k+1/2)].$$  On this domain, we typically take the nonnegative square root.  Thus $f \ge 0$ for all such $x$.  We also note that because $\cot x^2$ is an even function, we can restrict our attention to the behavior of $f$ for $x > 0$.  We would note that on this interval $f'(x) < 0$ since $(\cot x)' = - \csc^2 x < 0$. 
The book's solution does not satisfy this condition.  When $x$ lies in an interval for which $k$ is odd, the answer given by the book is positive (I leave the proof of this claim as an exercise to the reader).  Consequently, I would regard the book's answer as incorrect, as it chooses a branch of the square root that is not consistent with the same choice for $f$ itself.
I would go further to say that there is also a flaw in the algebra.  If we write $$\frac{1}{\sqrt{\cot x^2}} \csc^2 x^2 = \frac{\sqrt{\sin x^2}}{\sqrt{\cos x^2}} \cdot \frac{1}{\sin^2 x^2},$$ then we immediately have a problem for the same reason that we cannot write $$\sqrt{-1} \cdot \sqrt{-1} = \sqrt{(-1)(-1)} = \sqrt{1} = 1.$$  That is to say, the cancellation followed then the use of the double-angle identity is improper when $\sin x^2 < 0$.  This becomes evident if you compare the plots of $\sqrt{\tan \theta} \cdot \csc \theta$ versus $\sqrt{2 \csc 2\theta}$:  the former function admits negative values because the second factor can be negative; however, the latter function is never negative for the same choice of branch.  It is better to simply calculate the derivative as you have done, and leave it at that.
A: I still think the two answers are identical. Maybe there is something wrong with your plot ;) (If I haven't misread your writing, that is...)
$$ \frac{-2x  csc^2(x^2)}{\sqrt{cot(x^2)}} =  \frac{-2x  \left(\frac{1}{sin^2(x^2)} \right)}{\sqrt{\frac{cos(x^2)}{sin(x^2)}}} = \frac{-2x}{sin(x^2) \sqrt{sin(x^2)cos(x^2)}} = ... $$ Then proceed as in the given answer.
