Step 1 :\(\int \operatorname{tg} x dx = \int \frac{\sin x}{\cos x} dx\)
Step 2 :Let \(u = \sin x\) and \(dv = \frac{1}{\cos x} dx\)
Step 3 :Then, \(du = \cos x dx\) and \(v = \int \frac{1}{\cos x} dx\)
Step 4 :Let \(y = \tan(\frac{x}{2})\), then \(\cos x = \frac{1 - y^2}{1 + y^2}\) and \(dx = \frac{2}{1 + y^2} dy\)
Step 5 :\(\int \frac{1}{\cos x} dx = \int \frac{1 + y^2}{1 - y^2} \cdot \frac{2}{1 + y^2} dy = \int \frac{2}{1 - y^2} dy\)
Step 6 :\(\int \frac{2}{1 - y^2} dy = -\ln(y - 1) + \ln(y + 1)\)
Step 7 :Substitute back for \(x\): \(v = -\ln(\tan(\frac{x}{2}) - 1) + \ln(\tan(\frac{x}{2}) + 1)\)
Step 8 :Using integration by parts: \(\int \operatorname{tg} x dx = uv - \int v du\)
Step 9 :\(\int \operatorname{tg} x dx = \sin x \left(-\ln(\tan(\frac{x}{2}) - 1) + \ln(\tan(\frac{x}{2}) + 1)\right) - \int \left(-\ln(\tan(\frac{x}{2}) - 1) + \ln(\tan(\frac{x}{2}) + 1)\right) \cos x dx\)
Step 10 :\(\int \operatorname{tg} x dx = \ln(\cos x) + C\)
Step 11 :\(\boxed{\int \operatorname{tg} x dx = \ln(\cos x) + C}\)