I'm trying to derive the formula for the solution of a first order ODE, $y = e^{-\mu(x)}\int e^{\mu(x)}q(x)dx$ with $\mu(x) = \int p(x)dx$ for the form $y'+p(x)y = q(x)$. Here's what I did:

Rewriting the general form $y'+py = q$, we get \begin{equation} \left[q(x)-p(x)y\right]dx = dy.\label{eqn:int-fact2} \end{equation} Now state $M = q(x) - p(x) y$, $N=1$ and assume left and right hand side to be a constant: \begin{equation} \frac{dM}{dy} = \frac{dN}{dx} = C\label{eqn:int-fact-MN} \end{equation} Use integrating factor $\mu(x)$ to ensure exactness: \begin{equation} \frac{d[\mu(x) \cdot M]}{dy} = \frac{d[\mu (x) \cdot N]}{dx} \Rightarrow \mu(x) \frac{dM}{dy} = \mu(x) \frac{dN}{dx} + \frac{d\mu(x)}{dx} N. \end{equation} \begin{equation} \mu(x)\left[-p(x)\right] = \frac{d\mu(x)}{dx} \Rightarrow -p(x)dx = \frac{d\mu(x)}{\mu(x)}. \end{equation} \begin{equation} \ln \mu(x) = -\int p(x)dx \Rightarrow \boxed{\mu(x) = e^{-\int p(x)dx}} \end{equation} \begin{equation} \int \left[q(x)-p(x)y\right]dx =\int dy, \end{equation} \begin{equation} \int e^{-\int p(x)dx}dy = e^{-\int p(x)dx}y + C(x) \end{equation} \begin{equation} p(x)ye^{-\int p(x)dx} + C'(x)= q(x)e^{-\int p(x)dx} + p(x) y e^{-\int p(x)dx} \end{equation} \begin{equation} C'(x)= q(x)e^{-\int p(x)dx} \Rightarrow C(x) = \int q(x)e^{-\int p(x)dx}dx + C. \end{equation} Choose $C=0$ to get: \begin{equation} e^{-\int p(x)dx}y + \int q(x)e^{-\int p(x)dx}dx = 0 \end{equation} \begin{equation} e^{-\int p(x)dx}y = - \int q(x)e^{-\int p(x)dx}dx \Rightarrow \boxed{y = - e^{\int p(x)dx}\int q(x)e^{-\int p(x)dx}dx} \end{equation}

So why am I ending up with ye olde $+\mapsto-$ and $-\mapsto+$? Where is the error?

  • $\begingroup$ Have you looked at the relevant Wikipedia page? $\endgroup$
    – rogerl
    Commented Oct 19, 2016 at 14:48
  • $\begingroup$ @robert Yes, I already know how to do it that way. I want to do it this way as well $\endgroup$
    – user55789
    Commented Oct 19, 2016 at 16:32

2 Answers 2


$y’+py=q\enspace$ with $\enspace y:=\mu z\enspace$ $(z\neq 0)\enspace$ => $\enspace\mu’z+\mu z’+p\mu z=q$

Be $\enspace\mu’+p\mu =0\enspace$ and $\enspace\mu z’=q$ .

=> $\enspace\displaystyle \mu =e^{-\int p} \enspace$ and $\enspace\displaystyle z=\int (q\mu^{-1})= \int (q e^{\int p}) $.

=> $\enspace\displaystyle y=\mu z= e^{-\int p} \int (q e^{\int p}) $


I have to write \begin{equation} \left[p(x)y - q(x)\right]dx + dy = Mdx + Ndy = 0, \end{equation} which yields to correct integrating factor. However, filling it in, we get \begin{equation} ye^{\int p(x)dx} + C(x) + \int\left[p(x)y-q(x)\right]e^{\int p(x)dx}dx = 0, \end{equation} which still doesn't yield the right solution when taken the derivative wrt $x$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .