Problem Statement
Solve the differential equation $\frac{dy}{dx} + y\tan x = \sec x$, given that $y = 2$ when $x = 0$, for $-\frac{\pi}{2} < x < \frac{\pi}{2}$.
Verified Solution & Marking Scheme
Compute integrating factor
Standard linear form: $\frac{dy}{dx} + P(x)y = Q(x)$, where $P(x) = \tan x, Q(x) = \sec x$.
$\text{I.F.} = e^{\int \tan x \, dx} = e^{\ln|\sec x|} = \sec x \quad (\text{since } \sec x > 0 \text{ for } x \in (-\pi/2, \pi/2))$
Multiply across by integrating factor and integrate
$\frac{d}{dx}(y \sec x) = \sec x \cdot \sec x = \sec^2 x$
$y \sec x = \int \sec^2 x \, dx = \tan x + C$
Apply boundary condition y(0) = 2
Substitute $x = 0, y = 2$:
$2 \sec(0) = \tan(0) + C \implies 2(1) = 0 + C \implies C = 2$
Therefore:
$y \sec x = \tan x + 2$
$y = \frac{\tan x + 2}{\sec x} = \sin x + 2\cos x$