$f(x)=\left\{\begin{array}{ll}\frac{1-\cos k x}{x \sin x}, & \text { if } x \neq 0 \\ \frac{1}{2} & \text {, if } x=0\end{array}\right.$ at $x=0$
Finding the left hand and right hand limits for the given function, we have
$\lim _{x \rightarrow 0^{-}} f(x)=\frac{1-\cos k x}{x \sin x}$
$=\lim _{h \rightarrow 0} \frac{1-\cos k(0-h)}{(0-h) \sin (0-h)}=\lim _{h \rightarrow 0} \frac{1-\cos (-k h)}{-h \cdot \sin (-h)}$
$=\lim _{h \rightarrow 0} \frac{1-\cos k h}{h \sin h} \quad\left[\begin{array}{c}\because \sin (-\theta)=-\sin \theta \\ \cos (-\theta)=\cos \theta\end{array}\right]$
$=\lim _{h \rightarrow 0} \frac{2 \sin ^{2} \frac{k h}{2}}{h \sin h}$
$=\lim _{h \rightarrow 0 \atop k h \rightarrow 0} \frac{2 \sin \frac{k h}{2}}{\frac{k h}{2}} \times \frac{k h}{2} \times \frac{\sin \frac{k h}{2}}{\frac{k h}{2}} \times \frac{k h}{2} \cdot \frac{1}{h \cdot \frac{\sin h}{h} \cdot h}$
$=2 \cdot 1 \cdot \frac{k h}{2} \cdot 1 \cdot \frac{k h}{2} \cdot \frac{1}{h^{2}} \cdot 1$ $\left[\begin{array}{l}\lim _{h \rightarrow 0} \frac{\sin h}{h}=1 \text { and } \\ \lim _{k h \rightarrow 0} \frac{\sin k h}{k h}=1\end{array}\right]$
$=\frac{k^{2}}{2}$
$\lim _{x \rightarrow 0} f(x)=\frac{1}{2}$
But, as the function is continuous we have
$\lim _{x \rightarrow 0^{-}} f(x)=\lim _{x \rightarrow 0} f(x)$
So, $\frac{k^{2}}{2}=\frac{1}{2}$
$k^{2}=1 \Rightarrow k=\pm 1$
Therefore, the value of k is ± 1