Takeaways
- A linear first order ODE is an ODE of the form: \[ y’ + p(x)y = r(x)\]
- These ODEs have a closed form (i.e. “plug and chug”) solution: \[ y(x) = e^{-\int p(x)dx}\left[ \int r(x) e^{\int p(x)dx} dx + C \right] \]
- Bernoulli equations have the form: \[ y’ + p(x)y = q(x)y^n \]
- We can put Bernoulli equations into the form of a linear first order ODE by the substitution \(u = y^{1-n}\). This gives us the linear first order ODE: \[ u’ + (1-n)p(x)u = (1-n)q(x) \] which is easily solved with the above closed form solution to a linear first order ODE.
Overview
Linear first order ODE are a very special family of ODEs that we study because they occur in a surprising number of engineering contexts. Although linear ODEs are exceedingly uncommon—the world is naturally nonlinear, which you will hopefully understand and appreciate after this class is over—and first order differential equations can only model a limited number of phenomena, in many contexts, first order linear differential equations models are actually work very well.
Mathematically, linear first order ODEs are very nice because they have a closed form solution. A closed form solution just means a solution that doesn’t involve any unsolved integrals or large approximations. In mathematics—and especially differential equations—we can usually only characterize how the solution looks or bound the maximum value it attains, but we cannot actually find the solution itself. Other times, we might have a solution, but it’s not necessarily a useful solution. An example of this would be a solution that contains lots of unsolved integrals or bizarre mathematical functions. (A former professor of mine in applied physics once told a story about spending an hour with his doctoral advisor deriving a solution to an incredibly compilcated ODE, only to realize at the end that the solution they came up with was so messy and contained so many unresolved integrals that it gave zero useful intuition into the problem.)
For our purposes, we really like linear first order ODEs because they have a very clean closed form solution containing no unsolved integrals or strange functions or approximations. For you, this is great since once you identify that an ODE is linear first order or transform it to be, it’s just a matter of plugging the right parts of the ODE into the solution formula and solve the integrals correctly.
Classification
The first step to solving any ODE is correctly classifying it, since it is only after we classify an ODE that we are able to pick the correct solution method. A linear first order ODE is an ODE of the form:
\[y' + p(x)y = r(x)\]This is the only form for a linear first order ODE. Later we will see that we can transform some ODEs into linear first order ODEs through a substitution, but by definition this is the only form a linear first order ODE can take. Note that:
- The equation is linear because the terms containing \(y'\) and \(y\) are linear in \(y\) and its derivative
- It is first order because \(y'\) is the highest order derivative appearing in the equation
- The equation is inhomogeneous since if we set \(y' = 0\) and \(y = 0\) we have \(0 = r(x)\) which is not true unless \(r(x) = 0\)
If our ODE is linear first order and homogeneous, then you would just solve using separation of variables (do you see why this is?).
Deriving the Closed Form Solution
We start with the ODE in question:
\[y' + p(x)y = r(x)\]We can derive the solution to this ODE using an integrating factor. An integrating factor is a function we multiply both sides of the equation by to put the ODE into a solvable form (a multiplicative factor we use to put the ODE into a form that lets us integrate to get the solution). There are some formal ways to derive integrating factors, but in general it’s just something you have to see in the structure of the differential equation.
Look at the left hand side of the equation. Notice that we have \(y'\) in one term, and \(y\) times some function in the other. This looks like a product rule of some sort, so the question is: what can we multiply this by to put it in the form of a product rule? The answer is that some very smart people at some point looked at this equation and realized if you multiply both sides by
\[\mu = e^{\int p(x) dx}\]the left hand side becomes
\[e^{\int p(x) dx}\left[ y' + p(x) y\right] = e^{\int p(x) dx} y' + e^{\int p(x) dx}p(x) y = \frac{d}{dx}\left[ e^{\int p(x)dx} y\right]\]and the right hand side is:
\[e^{\int p(x) dx} r(x)\]Work through this on your own if this doesn’t look satisfactory at first—this product rule relationship is very important to fully understand. Also, if you don’t think you could have come up with this on your own, don’t worry, I know I definitely couldn’t have either. This is one of those things that doesn’t have much of a justification beyond that it works.
To summarize so far, we have multiplied both sides by the integrating factor \(e^{\int p(x) dx}\) and put the right side into a condensed form to arrive at the equation:
\[\frac{d}{dx}\left[ e^{\int p(x)dx} y\right] = e^{\int p(x) dx} r(x)\]We see that the equation is now separable! This means we can simply apply separation of variables (or here we actually just apply direct integration) to arrive at the solution:
\[\begin{gather*} \frac{d}{dx}\left[ e^{\int p(x)dx} y\right] = e^{\int p(x) dx} r(x) \\ e^{\int p(x)dx} y = \int e^{\int p(x) dx} r(x)dx + C \\ y = e^{ - \int p(x)dx } \left[ \int e^{\int p(x) dx} r(x)dx + C \right] \quad\blacksquare \end{gather*}\]See? Not too bad, right?
Example Problem
Consider the following ODE:
\[y' - x y = x\]This equation is a linear first order ODE, so we can apply the closed form solution from above. We first identify the parts of the equation. Namely,
\[p(x) = -x, \quad r(x) = x\]Then, we plug into the solution from above:
\[y = e^{ - \int (-x) dx } \left[ \int x e^{\int (-x) dx} dx + C \right]\]Finally, we integrate to solve:
\[\begin{gather*} y(x) = e^{\frac{1}{2} x^2} \left[ -e^{\frac{1}{2}x^2 } + C \right] \\ y(x) = -1 + Ce^{\frac{1}{2} x^2} \quad\blacksquare \end{gather*}\]The challenge with linear first order ODEs is either putting the ODE into linear first order form (as we’ll see below), or identifying the ODE. Beyond that, it’s literally just plug and chug.
To summarize, the algorithm for solving a linear first order ODE is:
- Identify the different parts of the ODE i.e. \(p(x)\) and \(r(x)\)
- Plug into the linear first order ODE closed form solution
- Integrate to find the final solution
Note that the part that trips the most people up is the integration, so make sure you are absolutely comfortable with integration so you do this step successfully. Also, this solution formula is exceedingly important (as I’m sure you can tell by now), so it would behoove you to commit this to memory.
Extension: Bernoulli Equations
An interesting class of differential equation are Bernoulli Equations. These are differential equations of the form:
\[y' + p(x)y = q(x)y^n\]The equation is named after Daniel Bernoulli, who was a member of the famous Bernoulli family. Daniel Bernoulli derived an equation of this form in his work on hydrodynamics (how stuff flows). We study the equation here since it is an interesting application of linear first order ODEs, and shows that with a clever substitution, we can turn a distinctly nonlinear first order ODE into a linear ODE that is easily solved.
Once again, we start with a seemingly unintutive substitution that some very smart people came up with. We do this because it works, not necessarily because it has a rigorous justification. Here, we substitute \(u = y^{1-n}\) to get:
\[u' = (1-n)y^{-n}y' \implies \frac{1}{1-n} y^{n} u' = y', \quad y^{n}u = y\]which we can plug into the equation to get an equation in terms of \(u\) and \(y\):
\[\frac{1}{1-n} y^{n} u' + p(x) y^{n}u = q(x) y^n\]Notice that we have a \(y^{n}\) term throughout, so we can simply divide this away to get an equation for \(u\):
\[\frac{1}{1-n} u' + p(x) u = q(x)\]Multiplying through by \(1-n\), we arrive at the form of the solution give in the course reader:
\[u' + (1-n)p(x) u = (1-n) q(x) \quad \blacksquare\]This is just a linear first order ODE, so we can easily solve it using the closed form solution above.
As a closing remark for Bernoulli equations, it is perfectly fine to jump straight from the Bernouill equation to the linear first order form after the substitution (i.e. it is not necessary to rederive everything with the substitution, you can just identify what \(n\), \(p(x)\), and \(q(x)\) are and write down the equation in terms of \(u(x)\)). However, make sure you understand all the steps we took to get there. There are a lot of final results in this class that you will use to actually compute the answer but took significant derivation to arrive at. It’s perfectly okay to just use the final result (after all, there’d be no point in a final result you aren’t allowed to use), but it’s paramount you understand the derivation and motivations behind it.