Question 1184044:  Find a solution to the initial value problem
 
y′+sin(t)y=g(t),   y(0)=7,
 
that is continuous on the interval [0,2π] where
 
g(t)={sin(t), if 0≤t≤π 
-----{ −sin(t),if π less than"t"  less than or equal to 2pi
 
y(t)={ My answer is 6e^(-2)+1, but is wrong,if 0≤t≤π.	  
---{ My answer is (6e^(-2)+2e)e^(cost)-1, but wrong, if π less than"t"  less than or equal to 2pi 
 
 Answer by CPhill(1987)      (Show Source): 
You can  put this solution on YOUR website! Here's how to solve the initial value problem:
 
**1. Solve for 0 ≤ t ≤ π:**
 
The equation is y' + sin(t)y = sin(t). This is a first-order linear differential equation. We can find the integrating factor:
 
Integrating factor = e^(∫sin(t)dt) = e^(-cos(t))
 
Multiply the equation by the integrating factor:
 
e^(-cos(t))y' + sin(t)e^(-cos(t))y = sin(t)e^(-cos(t))
 
Notice that the left side is the derivative of (e^(-cos(t))y):
 
d/dt (e^(-cos(t))y) = sin(t)e^(-cos(t))
 
Integrate both sides with respect to t:
 
∫ d/dt (e^(-cos(t))y) dt = ∫ sin(t)e^(-cos(t)) dt
 
e^(-cos(t))y = e^(-cos(t)) + C₁
 
y(t) = 1 + C₁e^(cos(t))
 
Using the initial condition y(0) = 7:
 
7 = 1 + C₁e^(cos(0)) 
7 = 1 + C₁e 
C₁ = 6/e
 
So, for 0 ≤ t ≤ π:
 
y(t) = 1 + (6/e)e^(cos(t)) = 1 + 6e^(cos(t)-1)
 
**2. Solve for π < t ≤ 2π:**
 
The equation is y' + sin(t)y = -sin(t).  The integrating factor is the same: e^(-cos(t))
 
Multiply the equation by the integrating factor:
 
e^(-cos(t))y' + sin(t)e^(-cos(t))y = -sin(t)e^(-cos(t))
 
d/dt (e^(-cos(t))y) = -sin(t)e^(-cos(t))
 
Integrate both sides:
 
e^(-cos(t))y = e^(-cos(t)) + C₂
 
y(t) = 1 + C₂e^(cos(t))
 
To find C₂, we need to use the continuity of y at t = π.
 
At t = π, the solutions from both intervals must be equal:
 
1 + 6e^(cos(π)-1) = 1 + C₂e^(cos(π)) 
1 + 6e^(-2) = 1 + C₂e^(-1) 
6e^(-2) = C₂e^(-1) 
C₂ = 6/e
 
So, for π < t ≤ 2π:
 
y(t) = 1 + (6/e)e^(cos(t)) = 1 + 6e^(cos(t)-1)
 
**Final Solution:**
 
y(t) = 1 + 6e^(cos(t) - 1),  0 ≤ t ≤ 2π
 
Your original answer was close, but you made a mistake in the calculation of the constant C for the second interval. The correct solution shows that the function has the same form in both intervals, ensuring continuity. 
 
  | 
 
  
 
 |   
 
 |