Find the general solution of the differential equation It has been a long time (years) since I have worked with differential equations and I just want to check to make sure that my method is ok and also I had a few questions.
Find the general solution of the differential equation.


*

*$$\frac{dy}{dt}+ycost=0$$


$$a(t)=cost$$
$$y(t)=Ce^{-\int a(t) dt}$$
$$y(t)=Ce^{-\int cost dt}$$
$$y(t)=Ce^{-sint }$$
$$y(t)=\frac{C}{e^{sint}}$$


*$$\frac{dy}{dt}+\frac{2t}{1+t^2}y=\frac{1}{1+t^2}$$


$$a(t)=\frac{2t}{1+t^2}$$
$$μ(t)=e^{\int a(t)dt}$$
$$μ(t)=e^{\int \frac{2t}{1+t^2}dt}$$
Then doing a u substitution with $u=1+t^2$ and $du=2tdt$
(Would $μ(t)$ become $μ(u)$ or just $μ$ when I am doing the u substitution?
$$μ(t)=e^{\int \frac{1}{u}du}$$
$$μ(t)=e^{ln|u|}$$
$$μ(t)=|u|$$ (Do I need to keep the absolute value signs here?)
Resubstitute $1+t^2$ in for u:
$$μ(t)=|1+t^2|$$
Multiply both sides of the original equation by $μ(t)$:
$$μ(t)[\frac{dy}{dt}+\frac{2t}{1+t^2}y]=μ(t)[\frac{1}{1+t^2}]$$
$$|1+t^2|[\frac{dy}{dt}+\frac{2t}{1+t^2}y]=|1+t^2|[\frac{1}{1+t^2}]$$
$$\frac{d}{dt}(1+t^2)y=1$$
$$(1+t^2)y=\int dt$$
$$(1+t^2)y=t + C$$
$$y=\frac{t}{1+t^2} + C$$
So I just need to use the $μ(t)$ method when the original equation has a right hand side not equal to 0 (is a nonhomogeneous differential equation, right?)
 A: Simple way to think about it you can always use the Integrating method for equations
$$
\dfrac{dy}{dt} + a(t)y + b(t) = 0
$$
where using the integrating factor method we find
$$
y\mathrm{e}^{\int^t_0 a(s)ds} = \int_0^tb(s)\mathrm{e}^{\int^s_0 a(s')ds'}ds
$$
You will get an analytic solution if you can compute 
$$
\int_0^tb(s)\mathrm{e}^{\int^s_0 a(s')ds'}ds
$$
This is not always the case. So the examples you gave above correspond to
$$
a(t) = \cos t\\
b(t) =0.
$$
and
$$
a(t) = \frac{2t}{1+t^2} = \dfrac{d}{dt}\ln\left(1+t^2\right)\\
b(t) = \frac{1}{1+t^2}.
$$
respectively.
To answer do you need to keep the modulus sign in $\ln|u|$ the short answer is, but as you can see that $1+t^2>0$ for all real values of $t$. so you can drop it. 
The example of the ode I give here is defined as a first order (non-) homogeneous differential equation. Where as you correctly spotted, the "non" arises for $b(t)\neq 0$.
I arrived to the party late, so hopefully you have found your answers already, but if not hopefully this will help. 
