I have questions regarding trigonometry used in the solution of this problem:
Discuss the differentiability of $f(x)$ at the point $x=\frac{\pi}{2}$. $$f(x) = \begin{cases} 1, & x<0 \\[4pt] 1+\sin x, &0\leq x<\frac\pi2 \\[2pt] 2+\left(x-\frac{\pi}{2}\right)^2, &x\geq\frac\pi2 \end{cases}$$
$$\begin{align} Lf'\left(\frac{\pi}{2}\right)&=\lim_{h\to0^-} \frac{f(\frac{\pi}{2}+h)-f(\frac{\pi}{2})}{h} \\[4pt] &=\lim_{h\to0^-} \frac{1+\sin(\frac{\pi}{2}+h)-2}{h} \\[4pt] &=\lim_{h\to0^-} \frac{\cos h-1}{h} \\[4pt] &=\lim_{h\to0^-} \frac{-2 \sin^2 (\frac{h}{2})}{h} \\[4pt] &=-\lim_{h\to0^-} \left(\frac{\sin\frac{h}{2}}{\frac{h}{2}}\right)^2\cdot\frac{h}{2} \\[4pt] &=0 \end{align}$$
The last two line was little bit weird (It was looking just like magic) to me.
- How they converted $$\sin(\frac{\pi}{2}+h)=\cos h$$?
- How they wrote $$\cos h-1 = -2 \sin^2 (\frac{h}{2})$$
I think I am missing something on trigonometry.