Step 1: Understanding the Concept:
For \(\frac{dy}{dx} + Py = Q\) the integrating factor is \(\text{I.F.} = e^{\int P\,dx}\).
Step 2: Set up:
We need \(e^{\int P\,dx} = \tan x\), so \(\int P\,dx = \log(\tan x)\). Differentiate:
\[ P = \frac{d}{dx}\log\tan x = \frac{\sec^2 x}{\tan x} = \frac{1}{\sin x\cos x} \]
Step 3: Simplify:
\[ P = \frac{2}{2\sin x\cos x} = \frac{2}{\sin 2x} = 2\csc 2x \]
Step 4: Why the other options are wrong.
\(2\sec 2x\), \(\tan 2x\) and \(\sin 2x\) do not equal \(\frac{2}{\sin 2x}\). For example at \(x = \frac\pi4\), the correct \(P\) is 2, while \(\tan 2x\) is undefined and \(\sin 2x = 1\).
Final Answer:
\(P = 2\csc 2x\), option (D).
\[ \boxed{2\csc 2x} \]