Solve this
Question:

If $f(x)=\left\{\begin{array}{cl}\frac{1-\cos k x}{x \sin x}, & x \neq 0 \\ \frac{1}{2} & , x=0\end{array}\right.$ is continuous at $x=0$, find $k$.

Solution:

Given: $f(x)=\left\{\begin{array}{l}\frac{1-\cos k x}{x \sin x}, x \neq 0 \\ \frac{1}{2}, x=0\end{array}\right.$

If $f(x)$ is continuous at $x=0$, then

$\lim _{x \rightarrow 0} f^{\prime}(x)=f(0)$             ….(1)

Consider:

$\lim _{x \rightarrow 0} f(x)=\lim _{x \rightarrow 0}\left(\frac{1-\cos k x}{x \sin x}\right)=\lim _{x \rightarrow 0}\left(\frac{2 \sin ^{2} \frac{k x}{2}}{x \sin x}\right)$

$\Rightarrow \lim _{x \rightarrow 0} f(x)=\lim _{x \rightarrow 0}\left(\frac{2 \sin ^{2} \frac{k x}{2}}{x^{2}\left(\frac{\sin x}{x}\right)}\right)$

$\Rightarrow \lim _{x \rightarrow 0} f(x)=\lim _{x \rightarrow 0}\left(\frac{\frac{2 k^{2}}{4}\left(\sin \frac{k x}{2}\right)^{2}}{\left(\frac{k x}{2}\right)^{2}\left(\frac{\sin x}{x}\right)}\right)$

$\Rightarrow \lim _{x \rightarrow 0} f(x)=\frac{2 k^{2}}{4} \lim _{x \rightarrow 0}\left(\frac{\left(\sin \frac{k x}{2}\right)^{2}}{\left(\frac{k x}{2}\right)^{2}\left(\frac{\sin x}{x}\right)}\right)$

$\Rightarrow \lim _{x \rightarrow 0} f(x)=\frac{2 k^{2}}{4}\left(\frac{\lim _{x \rightarrow 0} \frac{\left(\sin \frac{k x}{2}\right)^{2}}{\left(\frac{k x}{2}\right)^{2}}}{\lim _{x \rightarrow 0} \frac{\sin x}{x}}\right)$

$\Rightarrow \lim _{x \rightarrow 0} f(x)=\frac{2 k^{2}}{4} \times 1=\frac{k^{2}}{2}$

From equation (1), we have

$\frac{k^{2}}{2}=f(0)$

$\Rightarrow \frac{k^{2}}{2}=\frac{1}{2}$

$\Rightarrow k=\pm 1$