# Deciding when to drop the absolute values in differential equation?

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$.

• You can format trig functions like $\cos(\theta)$ or $\tan(\theta)$ or most trig functions, by including immediately before it, a backslash. E.g., \cos(\theta) and \tan(\theta). Similarly, instead of $ln(x)$ we can use a backslash immediately prior to ln, by writing \ln(x). Aug 27, 2018 at 19:55

$|\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)$.

• +1 Makholm for pointing this out... Aug 27, 2018 at 21:15

The integrating factor of a differential equation is unique up to a nonzero multiplicative constant.

E.g., the integrating factor of the differential equation $$\dfrac{\mathrm{d}y}{\mathrm{d}x}+g(x)\,y=h(x)$$ is in general $$Me^{\int g(x)\,\mathrm{d}x}\,\left(M\neq0\right),$$ which attains the solution independently of $$M$$: \begin{equation} \begin{aligned} \left(Me^{\int g(x)\,\mathrm{d}x}\right)\dfrac{\mathrm{d}y}{\mathrm{d}x}+\left(Me^{\int g(x)\,\mathrm{d}x}\right)g(x)\,y&=\left(Me^{\int g(x)\,\mathrm{d}x}\right)h(x)\\ e^{\int g(x)\,\mathrm{d}x}\dfrac{\mathrm{d}y}{\mathrm{d}x}+e^{\int g(x)\,\mathrm{d}x}g(x)\,y&=e^{\int g(x)\,\mathrm{d}x}h(x)\\ \dfrac{\mathrm{d}}{\mathrm{d}x}\left(e^{\int g(x)\,\mathrm{d}x}\,y\right)&=e^{\int g(x)\,\mathrm{d}x}h(x)\\ y&=\frac1{e^{\int g(x)\,\mathrm{d}x}}\int e^{\int g(x)\,\mathrm{d}x}h(x)\,\mathrm{d}x. \end{aligned} \end{equation}

Dropping any external absolute-value symbol (and the constant of integration) from the integrating factor is equivalent to setting $$M=1,$$ which is the simplest choice of $$M$$.

The absolute values originate from logarithmic integrals such as

$$\int\frac{dx}x=\log|x|+C,$$

and often the antilogarithm is taken, giving

$$e^{\log|x|+C}=C'|x|.$$

But $x=0$ corresponds to a singularity and shouldn't be crossed (otherwise the integral is improper). So all $x$'s should have the same sign, so that the correct expressions should be

$$\log x\text{ or }\log(-x)$$

and

$$C'x$$ respectively, where $C'$ can be positive or negative.

And if differentiabiliy is not required at $x=0$, you can have two distinct pieces,

$$\begin{cases}x<0\to C_-x,\\x>0\to C_+x.\end{cases}$$