\(\int\displaystyle\frac{dx}{1+\tan x}\) is equal to (C is a constant of integration)
Answer & explanation
Correct answer: option 1
The correct answer is Option (1) → \(\displaystyle\frac{x}{2}+\frac{1}{2}\log\left|\sin x+\cos x\right|+C\)
Multiplying numerator and denominator by \(\cos x\):
\( \displaystyle \frac{1}{1+\tan x} = \frac{\cos x}{\cos x+\sin x} \)
The derivative of the denominator is \(\cos x-\sin x\). The numerator is half of the denominator plus its derivative:
\( \displaystyle \cos x = \frac{1}{2}\left[\left(\cos x+\sin x\right)+\left(\cos x-\sin x\right)\right] \)
So
\( \displaystyle \int\frac{\cos x}{\cos x+\sin x}\,dx = \frac{1}{2}\int dx+\frac{1}{2}\int\frac{\cos x-\sin x}{\cos x+\sin x}\,dx \)
\( \displaystyle = \frac{x}{2}+\frac{1}{2}\log\left|\sin x+\cos x\right|+C \)
Why the other options are incorrect
Option (2) \(x+\log\left|1+\tan x\right|+C\) — Incorrect. At x = 0 its derivative is \(1+\sec^2 0 = 2\), but the integrand is 1.
Option (3) \(\displaystyle\frac{x}{2}+\frac{1}{2}\log\left|\sin x-\cos x\right|+C\) — Incorrect. The log must contain the denominator \(\sin x+\cos x\), whose derivative is the second part.
Option (4) \(\displaystyle\frac{x}{2}-\frac{1}{2}\log\left|\sin x+\cos x\right|+C\) — Incorrect. This is \(\int\frac{\sin x}{\sin x+\cos x}\,dx\), the integral of \(\frac{\tan x}{1+\tan x}\).