The given differential equation is:
dxdy+ytanx=sin2x
with the initial condition y(0)=1. This is a first-order linear differential equation of the form:
dxdy+P(x)y=Q(x)
where P(x)=tanx and Q(x)=sin2x. To solve it, we use an integrating factor (IF). The integrating factor is defined as:
IF=e∫P(x)dx=e∫tanxdx
First, compute ∫tanxdx:
∫tanxdx=∫cosxsinxdx
Let u=cosx, then du=−sinxdx, so:
∫cosxsinxdx=−∫udu=−ln∣u∣+C=−ln∣cosx∣+C
For the integrating factor, we ignore the constant and take the absolute value appropriately. Thus:
IF=e−ln∣cosx∣=eln(∣cosx∣1)=∣cosx∣1
Since cosx can be positive or negative, but for simplicity in solving, we often use secx=cosx1 and handle the domain. In the interval around 0, cosx>0, so we can write:
IF=secx
Multiply both sides of the differential equation by the integrating factor:
secx⋅dxdy+secx⋅ytanx=secx⋅sin2x
The left-hand side is the derivative of ysecx because:
dxd(ysecx)=secxdxdy+ysecxtanx
which matches the left-hand side. So:
dxd(ysecx)=secx⋅sin2x
Simplify the right-hand side. Since sin2x=2sinxcosx,
secx⋅sin2x=cosx1⋅2sinxcosx=2sinx
Thus:
dxd(ysecx)=2sinx
Integrate both sides with respect to x:
∫dxd(ysecx)dx=∫2sinxdx
ysecx=2∫sinxdx=2(−cosx)+C=−2cosx+C
where C is the constant of integration. Solve for y:
ysecx=−2cosx+C
Multiply both sides by cosx:
y=(−2cosx+C)cosx=−2cos2x+Ccosx
So:
y=Ccosx−2cos2x
Use the initial condition y(0)=1. When x=0, cos0=1:
y(0)=C⋅1−2⋅(1)2=C−2
Set equal to 1:
C−2=1
C=3
Substitute C=3 into the solution:
y=3cosx−2cos2x
Now evaluate y(π). When x=π, cosπ=−1:
y(π)=3⋅(−1)−2⋅(−1)2=−3−2⋅1=−3−2=−5
Hence, the correct answer is Option D.