Find the values of a and b such that the given function is continuous at $ x = \frac{\pi}{4}$ and $x = \frac{\pi}{2}$. $$f(x)= \left\{\begin{matrix} x + a\sqrt{2} \sin x \ ;& 0\le x < \frac{\pi}{4} \\ 2x\cot x + b \ ; & \frac{\pi}{4} \le x \le \frac{\pi}{2} \\ a\cos 2x - b\sin x \ ; & \frac{\pi}{2} < x \le \pi \end{matrix}\right. $$
This is what I've tried yet :
Finding LHL : $\lim_{x\to {(\pi/4)}^{-}} f(x)$ = $x + a $
FINDING RHL : $\lim_{x \to {(\pi/4)}^{+}} f(x)$ = ?
There will be two functions possible for $x\to (\pi/4)^+$ : $2x\cot x + b$ and $a\cos 2x - b \sin x$. How should I compute RHL here? I just need a hint. Thanks!