[Math] Deciding when to drop the absolute values in differential equation

absolute valueintegrating-factorintegrationordinary differential equations

I am currently solving the following differential equation (link is to another post):

$\dfrac{dr}{d \theta}+r\tan \theta =\frac{1}{\cos \theta}$

The following is in standard form (i.e. $\dfrac{dr}{d\theta}+P(\theta)r=Q(\theta)$). Therefore, I can go and head and solve for the integrating factor:

$\mu(\theta)=e^{\int_{} P(\theta) d\theta}=e^{\int_{} \tan(\theta) d\theta} =e^{-\ln(|\cos(\theta)|)}=|\cos(\theta)|^{-1}$

Multiplying the entire equation by the integration factor allows us to use the "Derivative of a Product" property to yield the following:

$\dfrac{d}{dx}(|\cos(\theta)|^{-1}r)=|\cos(\theta)|^{-1}\sec(\theta)$

Integrating both sides yields a "difficult" integral:

$\int_{} \dfrac{1}{|\cos(\theta)|\cos(\theta)} d\theta$

However, according to solution given here, the absolute value is dropped in the integrating factor (thereby creating an easier problem), meaning $\mu(\theta)=(cos(\theta))^{-1}$. But, why am I allowed to drop the absolute value? Nothing in the problem states the domain of $\theta$ or $r$ and clearly, $|\cos(\theta)|\cos(\theta)\neq \cos^2(\theta)$ for all values of $\theta$.

Best Answer

$|\cos(\theta)|^{-1}$, or for that matter $\int \frac{d\theta}{|\cos\theta|\cos \theta}$, diverges to infinity for $\theta\to\pm\pi/2$ -- so if you're interested only in the connected component of the solution that contains $\theta=0$, it will only be defined on the open interval $(-\pi/2,\pi/2)$ anyway. In this interval $\cos(\theta)$ is always positive, and therefore $|\cos(\theta)|=\cos(\theta)$.

Related Question