# Proofing solution formula for first order ODEs with constant coefficients using integrating factor method

I want to show for an ODE of the form $$y'=ay+b \tag{1}$$ with $$a\neq0$$, $$b$$ constants, has infinitely many solutions, $$y(t) = ce^{at}- \frac{b}a \tag{2}$$ with $$c \in \mathbb{R}$$ using the integrating factor method

I put the following notes together:

First recall the product rule for derivatives, i.e. let $$f(x) = f$$, $$\,u(x) = u$$ be two functions, then \begin{align} \frac{d f \cdot u}{dx} &= \left(\frac{df}{dx}\right)u + \left(\frac{du}{dx}\right)f \\ &= f'u + fu'\end{align} We introduce an integrating factor which is a function of $$t$$, i.e. $$\mu(t)$$. We want to choose $$\mu(t)$$ in a way, that we can find a form of $$$$\left(\frac{dy}{dt}\right)\mu + ya\mu = \frac{d \mu y}{dt} \tag{3}$$$$ so that we can utilize the product rule for integrating. Note we can consider $$a,b$$ to be functions of $$t$$, i.e. $$a(t), b(t)$$. To find $$\mu(t)$$ we use the product rule \begin{align} \frac{d\mu y}{dt} &= \left(\frac{d \mu}{dt}\right) y +\left(\frac{dy}{dt}\right) \mu \tag{4} \end{align} Comparing $$(3)$$ and $$(4)$$ and setting them equal yields \begin{alignat}{2} \left(\frac{dy}{dt}\right)\mu + ya\mu &= \left(\frac{d \mu}{dt}\right) y +\left(\frac{dy}{dt}\right) \mu \qquad && \Big|-\left(\frac{dy}{dt}\right) \mu \\ ya\mu &= \left(\frac{d \mu}{dt}\right) y &&\Big| \cdot y^{-1}\\ a\mu &=\frac{d \mu}{dt} &&\Big|\cdot dt, \cdot \mu^{-1} \\ a\, dt &=\frac{d \mu}{\mu} &&\Big|\int \\ \int a\, dt &= \int \frac{1}{\mu} \, d \mu \\ \int a\, dt &=\ln\mu &&\Big|\;e^{( \, . \, )} \\ e^{\int a\, dt} &=\mu \tag{5} \end{alignat} Thereby we found an expression for $$\mu$$ which is our integrating factor. Note the constant of integration cancels out when we multiply with $$\mu$$ on both sides of our first order ODE. \begin{alignat}{2} \frac{dy}{dt} &= ay + b \qquad&&\Big| -ay \\ \frac{dy}{dt} - ay &= b &&\Big| \cdot \mu \\ \frac{dy}{dt}\mu - ay \mu &= b\mu &&\Big| \text{ inserting } \mu = e^{\int a\, dt}\\ \underbrace{\frac{d}{dt} ye^{\int a\, dt}}_{=f'u} - \underbrace{ya e^{\int a\, dt}}_{=fu'} &= b e^{\int a\, dt} &&\Big| \int (\, . )\,dt\\ \int \frac{d}{dt}\left[ye^{\int a\, dt}\right] \, dt &= \int b e^{\int a\, dt} \, dt\\ y e^{\int a\, dt} &= \int b e^{\int a\, dt} \, dt \qquad &&\Big| \;\cdot e^{-\int a\, dt} \\ y&=\frac{1}{e^{\int a\, dt}} \int b e^{\int a\, dt} \, dt \tag{6} \end{alignat} Assuming $$a = a(t)$$ and $$b=b(t)$$ are functions, then equation $$(6)$$ is the solution. Next we assume $$a,b$$ are constants again, then we have \begin{align} \int a\, dt &= ta + c\\ \int b e^{\int a\, dt} \, dt &= \int b e^{ta + c} \, dt \\ &= \frac{b}{a}e^{ta + c} + c \end{align}

From here on I am confused, because if I solve accordingly, I get $$\frac{b}{a} + ce^{-at-c}$$ where do I have a misconception? I am pretty sure that until equation (6) everything should be correct.

You didn't account for the minus sign in the equation $$y' + (-a)y = b$$ when determining the integrating factor; it should be $$\exp \left( -\int a \, dt \right)$$, not $$\exp \left( \int a \, dt \right)$$.