$dm = k \sec ^{2} \theta d \theta$
$\Rightarrow \frac{ dm }{ m }=\frac{ k \sec ^{2} \theta}{ k \tan \theta} d \theta$
$\Rightarrow \frac{ dm }{ m }=\frac{ d \theta}{\sin \theta \cos \theta}=\frac{2 d \theta}{\sin 2 \theta}$
$\Rightarrow \%$ error is minimum when $\sin 2 \theta$ has maximum value
$2 \theta=\frac{\pi}{2}$ or $\theta=45^{\circ}$