Continuity

If $f\left(x\right)= \dfrac{1-\tan x}{1-\sqrt{2} \sin x}$ for $x \neq \dfrac{\pi}{4}$, is continuous at $x=\dfrac{\pi}{4}$, find $f\left(\dfrac{\pi}{4}\right)$


$\begin{aligned} \lim\limits_{x \to \frac{\pi}{4}} f\left(x\right) & = \lim\limits_{x \to \frac{\pi}{4}} \; \dfrac{1-\tan x}{1-\sqrt{2}\sin x} \\ & \\ & = \lim\limits_{x \to \frac{\pi}{4}} \; \dfrac{1-\dfrac{\sin x}{\cos x}}{1-\sqrt{2}\sin x} \\ & \\ & = \lim\limits_{x \to \frac{\pi}{4}} \; \dfrac{\cos x - \sin x}{\cos x \left(1-\sqrt{2}\sin x\right)} \\ & \\ & = \lim\limits_{x \to \frac{\pi}{4}} \; \dfrac{\left(\cos x - \sin x\right)\left(cos x + \sin x\right)\left(1+\sqrt{2}\sin x\right)}{\cos x \left(1-\sqrt{2}\sin x\right) \left(1+\sqrt{2}\sin x\right) \left(\cos x + \sin x\right)} \\ & \\ & = \lim\limits_{x \to \frac{\pi}{4}} \; \dfrac{\left(cos^2 x - \sin ^2 x\right)\left(1+\sqrt{2}\sin x\right)}{\cos x \left(1-2\sin^2 x\right)\left(\cos x + \sin x\right)} \\ & \\ & = \lim\limits_{x \to \frac{\pi}{4}} \; \dfrac{1+\sqrt{2}\sin x}{\cos x \left(\cos x + \sin x\right)}\\ & \\ & \left[\text{Note: }\cos 2\theta = \cos ^2 \theta - \sin^2 \theta = 1-2\sin^2 \theta\right] \\ & \\ & = \dfrac{1+\sqrt{2}\sin \left(\dfrac{\pi}{4}\right)}{\cos \left(\dfrac{\pi}{4}\right)\left[\cos \left(\dfrac{\pi}{4}\right)+ \sin \left(\dfrac{\pi}{4}\right)\right]} \\ & \\ & = \dfrac{1+\sqrt{2}\times \dfrac{1}{\sqrt{2}}}{\dfrac{1}{\sqrt{2}}\times \left(\dfrac{1}{\sqrt{2}}+\dfrac{1}{\sqrt{2}}\right)} = 2 \end{aligned}$

Since $f\left(x\right)$ is continuous at $x=\dfrac{\pi}{4}$,

$\implies$ $f\left(\dfrac{\pi}{4}\right) = \lim\limits_{x \to \frac{\pi}{4}} f\left(x\right) = 2$