I'm writing down the differential equation that I was solving, but it should be relatable to any other first-order linear differential equation. The equation is:
At first I got the wrong integrating factor. I realized it could be wrong after verification of the solution found and after I had made sure that I did not make any algebraic errors. Then I changed the integrating factor and got the correct solution to the equation. However, I'm still not sure why the first integrating factor does not work, and why is the second method is the way to go to find the correct solution.
Here is what I did:
(1) Wrong Integrating Factor:
With this integrating factor we find the solution to be which is wrong.
(2) Correct Integrating Factor:
With this integrating factor we find the correct solution