Question:

Solve the following differential equation \( \cos^2 x \frac{dy}{dx} + y = \tan x \), given that \( y(0)=1 \). Hence find \( y\left(\frac{\pi}{4}\right) \)

Show Hint

For linear differential equations, always reduce to standard form and use integrating factorSubstitution helps simplify RHS integrals.
Updated On: May 6, 2026
  • \( 2 \)
  • \( \frac{2}{e} \)
  • \( e \)
  • \( 1 \)
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Step 1: Convert to standard linear form.
\[ \cos^2 x \frac{dy}{dx} + y = \tan x \]
Divide by \( \cos^2 x \):
\[ \frac{dy}{dx} + y\sec^2 x = \tan x \sec^2 x \]

Step 2: Identify integrating factor (IF).

\[ IF = e^{\int \sec^2 x dx} = e^{\tan x} \]

Step 3: Multiply entire equation by IF.

\[ e^{\tan x}\frac{dy}{dx} + y e^{\tan x}\sec^2 x = \tan x \sec^2 x e^{\tan x} \]
\[ \frac{d}{dx}\left(y e^{\tan x}\right) = \tan x \sec^2 x e^{\tan x} \]

Step 4: Integrate both sides.

Let \( t=\tan x \Rightarrow dt=\sec^2 x dx \)
\[ \int \tan x \sec^2 x e^{\tan x} dx = \int t e^t dt \]
\[ = (t-1)e^t + C \]
\[ = (\tan x -1)e^{\tan x} + C \]

Step 5: Solve for \( y \).

\[ y e^{\tan x} = (\tan x -1)e^{\tan x} + C \]
\[ y = \tan x -1 + C e^{-\tan x} \]

Step 6: Apply initial condition \( y(0)=1 \).

\[ 1 = 0 -1 + C \Rightarrow C=2 \]
\[ y = \tan x -1 + 2e^{-\tan x} \]

Step 7: Find \( y\left(\frac{\pi}{4}\right) \).

\[ \tan\frac{\pi}{4}=1 \]
\[ y\left(\frac{\pi}{4}\right)=1-1+2e^{-1}=\frac{2}{e} \]
\[ \boxed{\frac{2}{e}} \]
Was this answer helpful?
0
0