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?
 A: $$\int_0 ^ \frac{\pi}{2} \frac{\cot x}{\cot x + cosec x} dx=\int_{0}^{\pi/2} \frac{\cos x}{1+\cos x} dx=\pi/2-\int_{0}^{\pi/2} \frac{dx}{1+\cos x} dx$$ $$=\pi/2-\frac{1}{2}\int_{0}^{\pi/2} \sec^2(x/2)~dx=\pi/2-\tan x |_{0}^{\pi/2}=\pi/2-1.$$
A: 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$$
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
\int_{0}^{\pi/2}{\cot\pars{x} \over \cot\pars{x} + \csc\pars{x}}\,\dd x & =
\int_{0}^{\pi/2}{\cos\pars{x} \over \cos\pars{x} + 1}\,\dd x =
\int_{0}^{\pi/2}{2\cos^{2}\pars{x/2} - 1 \over
2\cos^{2}\pars{x/2}}\,\dd x
\\[5mm] & =
\int_{0}^{\pi/2}\bracks{1 - {1 \over 2}\sec^{2}\pars{x \over 2}}\,\dd x =
\left.x - \tan\pars{x \over 2}\right\vert_{\ 0}^{\ \pi/2}
\\[5mm] & =
{\pi \over 2} - \tan\pars{\pi \over 4} =
\bbox[15px,#ffd,border:1px solid navy]{{\pi \over 2} - 1}\ \approx\
0.5708
\end{align}
A: HINT:  Take , $$\cot x- \csc x=t$$
then, $$\cot x+ \csc x=\frac{1}{t}$$
and $$\cot x=\frac{1}{2}\left[t+\frac{1}{t}\right]$$
I think you can proceed from here.
