# When linear differential equation can also directly be solved by variable separable method?

Consider the linear differential equation $$\frac{dy}{dx}+p(x)y=q(x).$$ 1. What conditions may be imposed on functions $$p(x)$$ and/or $$q(x)$$ so that it could directly be solved by variable separable method rather than integrating factor $$e^{\int p(x) dx}$$. 2. In the case if it can be solved by both variable separable and integrating factor method, which would be more suitable?

Comparing the general linear ODE and the separable linear ODE, $$$$\frac{dy}{dx} + p(x) y = q(x) \quad \textrm{and} \quad \frac{dy}{dx} = f(x) (ay+b),$$$$ we note that the linear ODE is separable if and only if $$$$q(x) - p(x)y = f(x) (ay+b),$$$$ with a new function $$f$$. This is the case if $$q(x) = c p(x)$$ for some constant $$c \in \mathbb{R}$$, since then we obtain $$q(x) - p(x) y = p(x)(c-y)$$.
The solution of a separable linear ODE $$$$\frac{dy}{dx} + p(x) y = c p(x) \quad \Leftrightarrow \quad \frac{dy}{dx} = p(x)(c-y)$$$$ via separation of variables or via an integrating factor is a matter of preference, and with both methods we obtain the general solution $$$$y(x) = c + C e^{-P(x)}, \quad C \in \mathbb{R},$$$$ where $$P$$ is an antiderivative of $$p$$.