Differentiation

Find the derivative of $\sin x + \cos x$ by first principle.


Let $f\left(x\right)=\sin x + \cos x$

$\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{\sin \left(x+h\right)+\cos \left(x+h\right)-\left(\sin x + \cos x\right)}{h} \\ & \\ & \left[\begin{aligned} \text{Note: } &\sin \left(\alpha + \beta\right)= \sin \alpha \cos \beta + \cos \alpha \sin \beta \\ & \cos \left(\alpha + \beta\right)= \cos \alpha \cos \beta - \sin \alpha \sin \beta \end{aligned}\right] \\ & \\ & = \lim\limits_{h \to 0} \; \dfrac{\sin x \cos h+ \cos x \sin h + \cos x \cos h - \sin x \sin h - \left(\sin x + \cos x\right)}{h} \\ & \\ & = \lim\limits_{h \to 0} \; \dfrac{\cos h \left(\sin x + \cos x\right)-\left(\sin x + \cos x\right)+\sin h \left(\cos x - \sin x\right)}{h} \\ & \\ & = \lim\limits_{h \to 0} \; \dfrac{\left(\sin x +\cos x\right)\left(\cos h -1\right)+ \sin h \left(\cos x - \sin x\right)}{h} \\ & \\ & = \lim\limits_{h \to 0} \; \left\{\dfrac{\left(\sin x + \cos x\right) \left[-2 \sin^2 \left(\dfrac{h}{2}\right)\right]}{h} + \dfrac{\sin h \left(\cos x - \sin x\right)}{h} \right\} \\ & \\ & \left[\text{Note: }\cos \theta -1 = -2 \sin^2 \left(\dfrac{\theta}{2}\right)\right] \\ & \\ & = -2 \left(\sin x + \cos x\right) \; \lim\limits_{h \to 0} \; \left\{\left[\dfrac{\sin \left(\dfrac{h}{2}\right)}{\dfrac{h}{2}}\right]^2 \times \dfrac{h^2}{4} \right\} + \left(\cos x - \sin x\right) \lim\limits_{h \to 0} \dfrac{\sin h}{h} \\ & \\ & = \dfrac{-1}{2} \left(\sin x + \cos x\right) \lim\limits_{\frac{h}{2} \to 0} \; \left[\dfrac{\sin \left(\dfrac{h}{2}\right)}{\dfrac{h}{2}}\right]^2 \times \lim\limits_{h \to 0} h^2 + \left(\cos x - \sin x\right) \times 1 \\ & \\ & = \dfrac{-1}{2} \left(\sin x + \cos x\right) \times 1 \times 0 + \cos x - \sin x \\ & \\ & = \cos x - \sin x \end{aligned}$