How to find $\int_0 ^ \frac{\pi}{2} \frac{\cot x}{\cot x + \csc x}\,dx \,$? 
How to find
$$\int_0 ^ \frac{\pi}{2} \frac{\cot x}{\cot x + \csc x}\,dx \,\,?$$

The integrand $ \frac{\cot x}{\cot x + \csc x} $ is not defined at $x =0$. But the function is bounded on $(0 , \frac{\pi}{2}]$.
$$\lim _{x \to 0} \frac{\cot x}{\cot x + \csc x} = 0$$  So this is not an improper integral.
My Attempt :
$$\int_0 ^ \frac{\pi}{2} \frac{\cot x}{\cot x + \csc x} = \lim_{t \to 0} \int_t ^ \frac{\pi}{2} \frac{\cot x}{\cot x + \csc x} = \lim_{t \to 0}  \left[(\frac{\pi}{2} - 1)+ (\tan{\frac{t}{2} - t})\right] = \left(\frac{\pi}{2} - 1\right)$$.
I know how to find the anti-derivative of the integrand. I first found out the anti-derivative of the integrand in $[t , \frac{\pi}{2}]$ , where $0 < t < \frac{\pi}{2}$. Let's say it is $\phi(t)$. Then I find $\lim_{t \to 0} \phi(t)$.
I am not sure if this is a right way. Can anyone please check it?

my solution
$$\int_0 ^ \frac{\pi}{2} \frac{\cot x}{\cot x + \csc x}\mathrm{d}x$$
$$=\int_0 ^ \frac{\pi}{2} \frac{\cot x(\csc x-\cot x)}{\csc^2 x-\cot^2x}\mathrm{d}x$$
$$=\int_0 ^ \frac{\pi}{2} \csc x\cot x-\cot^2 x)\mathrm{d}x$$
$$=\int_0 ^ \frac{\pi}{2} \csc x\cot x-\csc^2 x+1)\mathrm{d}x$$
$$=(-\csc x+\cot x+x)_0^{\pi/2}$$
$$=\frac{\pi}{2}-1$$
