Differentiation

Differentiate the function $f\left(x\right)=\cot \sqrt{x}$ from first principles.


$\begin{aligned} f'\left(x\right) & = \lim\limits_{h \to 0} \; \dfrac{f\left(x+h\right)-f\left(x\right)}{h} \\ & = \lim\limits_{h \to 0} \; \dfrac{\cot \left(\sqrt{x+h}\right)-\cot \sqrt{x}}{h} \\ & = \lim\limits_{h \to 0} \; \dfrac{\dfrac{\cos \left(\sqrt{x+h}\right)}{\sin \left(\sqrt{x+h}\right)}-\dfrac{\cos \sqrt{x}}{\sin \sqrt{x}}}{h} \\ & = \lim\limits_{h \to 0} \; \dfrac{\sin \sqrt{x}\cos \left(\sqrt{x+h}\right)-\cos \sqrt{x}\sin \left(\sqrt{x+h}\right)}{\sin \sqrt{x} \sin \left(\sqrt{x+h}\right)h} \\ & = \lim\limits_{h \to 0} \; \dfrac{\sin \left(\sqrt{x}-\sqrt{x+h}\right)}{\sin \sqrt{x} \sin \left(\sqrt{x+h}\right)h} \;\; \left[\text{Note: }\sin \left(\alpha - \beta\right)= \sin \alpha \cos \beta - \cos \alpha \sin \beta\right] \\ & = \dfrac{1}{\sin \sqrt{x}} \times \lim\limits_{h \to 0} \; \dfrac{1}{\sin \left(\sqrt{x+h}\right)} \times \lim\limits_{h \to 0} \; \dfrac{\sin \left(\sqrt{x}-\sqrt{x+h}\right)}{\sqrt{x}-\sqrt{x+h}} \times \lim\limits_{h \to 0} \; \dfrac{\sqrt{x}-\sqrt{x+h}}{h} \\ & = \dfrac{1}{\sin \sqrt{x}} \times \dfrac{1}{\sin \sqrt{x}} \times 1 \times \lim\limits_{h \to 0} \; \dfrac{\left(\sqrt{x}-\sqrt{x+h}\right)\left(\sqrt{x}+\sqrt{x+h}\right)}{h\left(\sqrt{x}+\sqrt{x+h}\right)} \\ & = \dfrac{1}{\sin^2 \sqrt{x}} \times \lim\limits_{h \to 0} \; \dfrac{x-x-h}{h\left(\sqrt{x}+\sqrt{x+h}\right)} \\ & = \text{cosec}^2 \sqrt{x} \times \lim\limits_{h \to 0} \; \dfrac{-1}{\sqrt{x}+\sqrt{x+h}} \\ & = \dfrac{-\text{cosec}^2 \sqrt{x}}{2\sqrt{x}} \end{aligned}$