If $\tan \theta=\frac{1}{2}$ then evaluate $\left(\frac{\cos \theta}{\sin \theta}+\frac{\sin \theta}{1+\cos \theta}\right)$
Given: $\tan \theta=\frac{1}{2}$
Since, $\tan \theta=\frac{P}{B}$
$\Rightarrow P=1$ and $B=2$
Using Pythagoras theorem,
$P^{2}+B^{2}=H^{2}$
$\Rightarrow 1^{2}+2^{2}=H^{2}$
$\Rightarrow H^{2}=1+4$
$\Rightarrow H^{2}=5$
$\Rightarrow H=\sqrt{5}$
Therefore,
$\sin \theta=\frac{P}{H}=\frac{1}{\sqrt{5}}$
$\cos \theta=\frac{B}{H}=\frac{2}{\sqrt{5}}$
Now,
$\left(\frac{\cos \theta}{\sin \theta}+\frac{\sin \theta}{1+\cos \theta}\right)=\left(\frac{\frac{2}{\sqrt{5}}}{\frac{1}{\sqrt{5}}}+\frac{\frac{1}{\sqrt{5}}}{1+\frac{2}{\sqrt{5}}}\right)$
$=\left(\frac{2}{1}+\frac{\frac{1}{\sqrt{5}}}{\frac{\sqrt{5}+2}{\sqrt{5}}}\right)$
$=\left(\frac{2}{1}+\frac{1}{\sqrt{5}+2}\right)$
$=\left(2+\left(\frac{1}{\sqrt{5}+2} \times \frac{\sqrt{5}-2}{\sqrt{5}-2}\right)\right)$
$=\left(2+\left(\frac{\sqrt{5}-2}{5-4}\right)\right)$
$=(2+\sqrt{5}-2)$
$=\sqrt{5}$
Hence, $\left(\frac{\cos \theta}{\sin \theta}+\frac{\sin \theta}{1+\cos \theta}\right)=\sqrt{5}$.