Solve $\frac{dr}{d \theta}+r\tan \theta =\frac{1}{\cos \theta}$ We are given the differential equation
$\frac{dr}{d \theta}+r\tan \theta =\frac{1}{\cos \theta}$
And we are asked to find a solution.
I'm having difficulties isolating $r$ and $\theta$ to different parts of the equation so I can integrate.
it is tempting to multiply by $\cos \theta$ so we get $\cos \theta \frac{dr}{d\theta} +r\sin \theta=1$ and from here how do we get to something like $f(r)dr = g(\theta) d\theta$ so we can integrate?
 A: Take $g(\theta) = \int \tan \theta d\theta$
$$(r(\theta)e^{g(\theta)})' = r'(\theta)e^{g(\theta)} + r(\theta)e^{g(\theta)}\tan \theta = \dfrac{e^{g(\theta)}}{\cos \theta}$$
$$r(\theta)e^{g(\theta)} = \int \dfrac{e^{g(\theta)}}{\cos \theta} d\theta + C$$
$$r(\theta) = e^{-g(\theta)}\left(\int \dfrac{e^{g(\theta)}}{\cos \theta} d\theta + C\right)$$
A: In general, you can find a solution to 
$$r' + p(\theta)r = q(\theta) \ \ \ \ \ \hbox{ where } ' = d/d\theta$$
by multiplying both sides by the integrating factor
$$f(\theta) = \exp\left( \int p(\theta) \ d\theta \right)$$
In your case $p(t) = \tan t$ and hence the integrating factor is
$$f(\theta) = \exp\left( \int \tan\theta \ d\theta \right) = \exp\left( \ln\sec\theta \right) = \sec\theta$$
Multiplying your equation by this integrating factor,
$$\sec\theta . r' + \sec\theta \tan\theta .r = \sec^2\theta$$
or
$$(\sec\theta.r)' = \sec^2\theta$$
I hope you can take it from here.
A: This is a first order linear equation. All such equations can be solved. This is one of the ways of doing it:


*

*Solve the homogeneous equation $r'+r\,\tan\theta=0$. Let $r_h(\theta)$ be a non-zero solution.

*Find a particular solution of the complete equation of the form $r_p=r_h\,v$.

*The general solution is $y=C\,r_h+r_p$.

