Concept:
This is a Bernoulli differential equation of the form \(\frac{dy}{dx} + P(x)y = Q(x)y^n\). Here \(n=2\).
Step 1: Rewrite the equation.
\[
\frac{dy}{dx} - y\tan x = -y^2\sec x
\]
Step 2: Divide by \(y^2\).
\[
y^{-2}\frac{dy}{dx} - y^{-1}\tan x = -\sec x
\]
Step 3: Substitute \(v = y^{-1}\).
Then \(\frac{dv}{dx} = -y^{-2}\frac{dy}{dx}\). So:
\[
-\frac{dv}{dx} - v\tan x = -\sec x \Rightarrow \frac{dv}{dx} + v\tan x = \sec x
\]
Step 4: Solve linear DE.
Integrating factor \(e^{\int \tan x dx} = e^{\ln|\sec x|} = \sec x\).
\[
\frac{d}{dx}(v \sec x) = \sec^2 x
\]
\[
v \sec x = \tan x + C
\]
\[
v = \frac{\tan x + C}{\sec x} = \sin x + C\cos x
\]
Step 5: Back substitute \(v = 1/y\).
\[
\frac{1}{y} = \sin x + C\cos x \Rightarrow y = \frac{1}{\sin x + C\cos x}
\]
This can be rearranged to \(\sec x = (C + \tan x)y\). Multiply both sides by \(\sec x\): \(1 = (C + \tan x)y \cos x\)? Actually:
\[
y = \frac{1}{\sin x + C\cos x} = \frac{1}{\cos x (\tan x + C)} = \frac{\sec x}{\tan x + C}
\]
\[
\Rightarrow \sec x = (C + \tan x)y
\]