### \int \frac{\tan \frac{x}{2} + \cos \frac{x}{2}}{\sin \frac{x}{2}}dx = ?

Solution:

I = \int \frac{\tan \frac{x}{2} + \cos \frac{x}{2}}{\sin \frac{x}{2}}dx

I = 2\int \frac{\sin \frac{x}{2} + \cos^2 \frac{x}{2}}{2\sin \frac{x}{2}\cos \frac{x}{2}}dx

I = 2\int \frac{\sin \frac{x}{2} + \cos^2 \frac{x}{2}}{\sin x}dx

I = 2\int \frac{\sin \frac{x}{2} + \frac{1+ \cos x}{2}}{\sin x}dx

I = 2\int \frac{2\sin \frac{x}{2} + 1+ \cos x}{2\sin x}dx

I = \int \frac{2\sin \frac{x}{2} + \cos x + 1}{\sin x}dx

I = \int \frac{2\sin \frac{x}{2}}{\sin x}dx + \int \frac{\cos x}{\sin x}dx + \int \frac{1}{\sin x}dx

I = \int \frac{2\sin \frac{x}{2}}{2\sin \frac{x}{2}\cos \frac{x}{2}}dx + \int \frac{\cos x}{\sin x}dx + \int \frac{1}{\sin x}dx

I = \int \frac{1}{\cos \frac{x}{2}}dx + \int \frac{\cos x}{\sin x}dx + \int \frac{1}{\sin x}dx

I = \int \sec \frac{x}{2} dx + \int \cot x dx + \int \csc x dx

I_1 = \int \sec \frac{x}{2} dx

I_1 = 2\int \sec t dt

I_1 = 2log|\sec t + \tan t| + c

I_1 = 2log|\sec \frac{x}{2} + \tan \frac{x}{2}| + c

I = 2log|\sec \frac{x}{2} + \tan \frac{x}{2}|+ log|\sin x| + log|\csc x- \cot x| + C

I = 2log|\sec \frac{x}{2} + \tan \frac{x}{2}|+ log|1- \cos x| + C

I = 2log|\sec \frac{x}{2} + \tan \frac{x}{2}|+ log|2\sin^2 \frac{x}{2}| + C

I = 2log|\sec \frac{x}{2} + \tan \frac{x}{2}|+ 2log|\sin \frac{x}{2}| + C