First order linear ordinary differential equations

A common equation that pops up in a lot of applications is a Linear First Order Equation. The form that this takes is

\[y^{\prime}+ P(x)y=Q(x) \quad \text{OR} \quad \frac{dy}{dx}+ P(x)y=Q(x)\]

Similar to separable, you will probably have to use some algebra to rearrange it to get it into this form, but the key parts of it are that its the

differential +
a function that is in terms of the independent variable times the dependent variable =
a function that is in terms of the independent variable

in order to solve this, were going to multiply the whole equation by an integrating factor \(I(x)\) that were going to create.

\[I(x)[y^\prime(x)+ P(x)y=Q(x)]\quad \Rightarrow \quad I(x)\frac{dy}{dx}+ I(x)P(x)y=I(x)Q(x)\]

If we can find a function that satisfies the equation

\[I(x)=\frac{I^{\prime}(x)}{P(x)}\]

and then substitute that into the middle term we get

\[I(x)y^{\prime}(x)+I^{\prime}(x)y(x)= I(x)Q(x)\]

we did this because this makes the left side of the equation just a product rule (\((fg)^{\prime}= fg'+f'g\)) so we can write this as

\[[I(x)y(x)]^{\prime}= I(x)Q(x)\]

Integrate both sides and simplify with some algebra

\[\int[I(x)y(x)]^{\prime} \,dx= \int I(x)Q(x)\, dx\]
\[I(x)y(x)+c = \int I(x)Q(x)\,dx\]
\[y(x)=\frac{\int I(x)Q(x)+c}{I(x)}\]

Note that the c eats the negative when you subtract it

With this we have a way to solve for what \(y(x)\) is so now we just have to figure out what the integrating factor is.

Note that in order to show how we are interacting with the constants after we integrate, the integral without \(dx\) will mean that we are treating the function as "integrated"

\[I(x) = \frac{I^{\prime}(x)}{P(x)} \quad \Rightarrow \quad P(x)=\frac{I^{\prime}(x)}{I(x)}\]

Using the chain rule, we know that

\[\frac{d}{dx}[\ln g(x)] = \frac{g^\prime(x)}{g(x)}\]

We can set \(P(x)\) equal to \(\frac{d}{dx}[\ln|I(x)|]\)

\[P(x)=[\ln I(x)]^\prime\]

integrating both sides

\[\int P(x) \, dx=\int [\ln I(x)]^{\prime}\,dx\]
\[\int P(x) + c = \ln I(x)+c\]

subtracting the \(c\)'s '(one eats the other) and solving for \(I(x)\)

\[\ln I(x)= \int P(x) + c \quad \Rightarrow \quad e^{\ln I(x)}= e^{\int P(x) +c}\]
\[I(x) = ce^{\int P(x)}\]

Now we plug our generalized integrating factor into the original equation to see what happens
Note the constant from the general solution will be labeled \(c\) and the constant from the integrating factor will be \(c_{0}\)

\[y(x)=\frac{\int I(x)Q(x)+c}{I(x)} \quad \text{and} \quad I(x) = c_{0}e^{\int P(x)}\]
\[y(x) = \frac{\int c_{0}e^{\int P(x)}Q(x)+c}{c_{0}e^{\int P(x)}}\]

splitting the fraction and pulling the constant out of the integrated function

\[y(x) = \frac{c_{0}\int e^{\int P(x)}Q(x)}{c_{0}e^{\int P(x)}} + \frac{c}{c_{0}e^{\int P(x)}}\]

the \(c_{0}\)'s from the first term will cancel and the \(c\) from the general solution will eat the \(c_{0}\) from the integrating factor

\[y(x) = \frac{\int e^{\int P(x)}Q(x)}{e^{\int P(x)}} + \frac{c}{e^{\int P(x)}}\]

With this we can see that the \(c\)'s will always cancel and be absorbed, so we don't have to worry about them until the end. Because of this we can say our integrating factor will always be

\[I(x) = e^{\int P(x)\,dx}\]

and with a little bit of factoring and arranging what we did above to clean it up, we can have a nice formula to follow

\[y=\frac{1}{I(x)}\left(\int I(x)Q(x)\, dx +c\right)\]

Quick note: We don't actually need to include the "c" in the formula as we will get one that we when we integrate, I like to leave it in because its a good reminder not to forget about it, and technically it's still correct because the "c" you get from the integral can also eat/be eaten by the extra c

With that we have a simple generalized formula for solving this type of equation.

Form

\[y^{\prime}+P(x)y = Q(x)\]

General Solution

\[I(x) = e^{\int P(x)dx}\]
\[y=\frac{1}{I(x)}\left(\int I(x)Q(x) dx +c\right)\]

Quick Example before moving on

\[\cos(x) \frac{dy}{dx} + y\sin(x) = 8x\,cos^{2}(x),\qquad y\left(\frac{2\pi}{3}\right) = \frac{11\pi^{2}}{18}\]

Divide by \(\cos(x)\) to isolate the differential

\[\frac{1}{\cos(x)}\left(\cos(x) \frac{dy}{dx} + y\sin(x) = 8x\,cos^{2}(x)\right)\]
\[\Rightarrow \qquad \frac{dy}{dx} + y\tan(x) = 8x\cos(x)\]

Find our \(P(x)\), \(Q(x)\), and integrating factor \(I(x)\)

\[P(x) = \tan(x) \qquad Q(x) = 8x\cos(x)\]
\[I(x) = e^{\int\left(\tan x\right)dx} \quad \Rightarrow \quad e^{\ln|\sec(x)|} \quad \Rightarrow \quad \sec(x)\]

Using the above formula solve for \(y\)

\[y = \frac{1}{\sec(x)}\left(\int \sec(x)(8x\cos(x))\,dx\right) \quad\Rightarrow\quad y = \cos(x)\left(\int8x\,dx\right)\]

Note: Don't forget the "+c", and that it gets multiplied by \(\frac{1}{I(x)}\), the general solution to this is \(\boxed{y = \cos(x)4x^{2} + \cos(x)c}\) and not \(\textcolor{red}{y = cos(x)4x^{2}+c}\)

\[y = \cos(x)(4x^{2}+c)\]

With our general solution lets use the given initial value to find the particular solution

\[\frac{11\pi^{2}}{18} = \cos\left(\frac{2\pi}{3}\right)\left(4\left(\frac{2\pi}{3}\right)^{2} + c\right)\]

Plugging in our given \(x\) and \(y\) to solve for \(c\)

\[\frac{11\pi^{2}}{18} = -\frac{1}{2}\left(\frac{16\pi^{2}}{9} + c\right)\]
\[c = -2\left(\frac{11\pi^{2}}{18}\right)- \frac{16\pi^{2}}{9}\quad\Rightarrow \quad c = -3\pi^{2}\]

After solving for \(c\) we can write out the full solution

\[y = 4x^{2}\cos(x) -3\pi^2\cos(x)\]

--> Bernoulli Equations
<-- Separable Equations

Differential Equation Index
Home