Find the particular solution of the differential equation dy
     Find the particular solution of the differential equation dy/dx + y cos(x) = 2 cos (x)  satisfying the initial condition y(0) = 4.  Your answer should be a function of x. 
  
  Solution
This equation is separable.
 
 Subtract the second terms from the left-hand side and factor out cos (x):
 
 dy/dx = (2-y) cos(x), so
 
 (1/(2-y)) dy = cos(x) dx.
 
 Integrate:
 
 ln(2-y) = -sin(x) + c1
 
 Exponentiate (use e^(both sides)):
 
 2 - y = e^(-sin(x) + c1)
 
 2 - y = e^(-sin(x)) e^(c1)
 
 2 - y = c2*e^(-sin(x)) (where c2=e^(c1))
 
 y - 2 = -c2*e^(-sin(x))
 
 y = 2 - c2*e^(-sin(x)) (general solution)
 
 OK. Since y(0) = 4, substitute in x = 0, y = 4:
 
 4 = 2 - c2*e^(-sin(0))
 
 4 = 2 - (c2 * 1)
 
 so c2 = -2, and the particular solution is
 
 y = 2 + 2*e^(-sin(x)).

