Question:medium

\( \int \frac{x+\cos x}{1-\sin x} dx = \)

Show Hint

For tricky integrals, especially in multiple-choice questions, it's often faster to differentiate the given options than to perform the integration directly. If the derivative of an option matches the integrand, you've found the answer.
Updated On: Jun 14, 2026
  • \( x \tan(\frac{\pi}{4}+\frac{x}{2}) + c \)
  • \( x \tan(\frac{x}{2}) + c \)
  • \( x \cot(\frac{x}{2}) + c \)
  • \( x \cot(\frac{\pi}{4}+\frac{x}{2}) + c \)
Show Solution

The Correct Option is A

Solution and Explanation

Let's rewrite the integrand by splitting the fraction.
\( \int \left( \frac{x}{1-\sin x} + \frac{\cos x}{1-\sin x} \right) dx = \int \frac{x}{1-\sin x} dx + \int \frac{\cos x}{1-\sin x} dx \).
Let's try to use integration by parts on the first integral. Let \( u = x \) and \( dv = \frac{1}{1-\sin x} dx \).
To find v, we integrate dv: \( v = \int \frac{1}{1-\sin x} dx = \int \frac{1+\sin x}{1-\sin^2 x} dx = \int \frac{1+\sin x}{\cos^2 x} dx \).
\( v = \int (\sec^2 x + \tan x \sec x) dx = \tan x + \sec x \).
Now apply integration by parts \( \int u dv = uv - \int v du \):
\( \int \frac{x}{1-\sin x} dx = x(\tan x + \sec x) - \int (\tan x + \sec x) dx \).
So the original integral is \( [x(\tan x + \sec x) - \int (\tan x + \sec x) dx] + \int \frac{\cos x}{1-\sin x} dx \).
Let's focus on the last integral \( \int \frac{\cos x}{1-\sin x} dx \). Let \(t = 1-\sin x\), then \(dt = -\cos x dx\).
\( \int \frac{-dt}{t} = -\ln|t| = -\ln|1-\sin x| \). This doesn't seem to simplify things.
Let's try another approach. Consider the form \( \int (xf'(x)+f(x))dx = xf(x)+c \).
Let \(f(x) = \tan(\frac{\pi}{4}+\frac{x}{2})\).
\(f'(x) = \sec^2(\frac{\pi}{4}+\frac{x}{2}) \cdot \frac{1}{2}\).
We know that \( \tan(\frac{\pi}{4}+\frac{x}{2}) = \frac{1+\tan(x/2)}{1-\tan(x/2)} = \frac{\cos(x/2)+\sin(x/2)}{\cos(x/2)-\sin(x/2)} = \frac{1+\sin x}{\cos x} = \sec x + \tan x \).
And \( \sec^2(\frac{\pi}{4}+\frac{x}{2}) = 1 + \tan^2(\frac{\pi}{4}+\frac{x}{2}) = 1 + (\sec x + \tan x)^2\). This is getting complicated.
Let's go back to \(uv - \int v du\). The expression is \( x(\tan x + \sec x) - \int (\tan x + \sec x) dx + \int \frac{\cos x}{1-\sin x} dx \).
The integral \( \int \frac{\cos x}{1-\sin x} dx \) can be solved. Let's see if it cancels with \( \int (\tan x + \sec x) dx \). No.
Let's try to prove that \( \frac{d}{dx} [x \tan(\frac{\pi}{4}+\frac{x}{2})] = \frac{x+\cos x}{1-\sin x} \).
Let \( y = x \tan(\frac{\pi}{4}+\frac{x}{2}) \). Using product rule: \( \frac{dy}{dx} = 1 \cdot \tan(\frac{\pi}{4}+\frac{x}{2}) + x \cdot \sec^2(\frac{\pi}{4}+\frac{x}{2}) \cdot \frac{1}{2} \).
We know \( \tan(\frac{\pi}{4}+\frac{x}{2}) = \frac{1+\sin x}{\cos x} \). And \( \sec^2(\frac{\pi}{4}+\frac{x}{2}) = (\frac{1+\sin x}{\cos x})^2 \). No. Also, \( \sec^2\theta = \frac{1}{\cos^2\theta} \). \( \cos^2(\frac{\pi}{4}+\frac{x}{2}) = \frac{1+\cos(\pi/2+x)}{2} = \frac{1-\sin x}{2} \).
So, \( \sec^2(\frac{\pi}{4}+\frac{x}{2}) = \frac{2}{1-\sin x} \).
Substituting back: \( \frac{dy}{dx} = \frac{1+\sin x}{\cos x} + x \cdot \frac{2}{1-\sin x} \cdot \frac{1}{2} = \frac{1+\sin x}{\cos x} + \frac{x}{1-\sin x} \).
This is \( \frac{(1+\sin x)(1-\sin x) + x\cos x}{\cos x (1-\sin x)} = \frac{1-\sin^2 x + x \cos x}{\cos x(1-\sin x)} = \frac{\cos^2 x + x \cos x}{\cos x(1-\sin x)} = \frac{\cos x( \cos x + x)}{\cos x(1-\sin x)} = \frac{x+\cos x}{1-\sin x} \).
The derivative matches the integrand. Thus the integral is correct.
Was this answer helpful?
0