5 minutes read

Let's continue our learning journey and take a closer look at differential equations. In the previous introductory topic, we got acquainted with the concept of an ODE and learned how to solve them using the variable separation method. Unfortunately, this nice method lacks generality: there exist a lot of interesting and important ODEs in which the variables cannot be properly separated.

Today we will learn a single, yet very important class of ODEs, which frequently arises in applications.

Definition of first-order linear ODEs

Let's start from decomposing this name into building blocks:

1) Remember that the order of an ODE is the highest order of the derivative present in it. Thus, in our first-order ODEs, we will deal with first order derivatives only.

2) Linearity means that our variable y(x)y(x) and its derivatives y(n)(x)y^{(n)}(x) enter the equation in the first degree.

So, the ODEs we will deal with today will have the following general form:

y+u(x)y=f(x)(1)y' + u(x)y = f(x) \tag {1}If the equation satisfies the condition f(x)0f(x) \equiv 0, it is called homogeneous. Later, we will see that it plays a crucial role in finding the solution of the equation (1)(1).

In what follows, we will solve the equation (1)(1) in the general form and then will have a look at a couple of examples.

General solution

To begin with, let's restrict ourselves to the homogeneous counterpart of the equation (1)(1):

y+u(x)y=0(2)y' + u(x)y = 0 \tag {2}Well, this one is easy to solve: let's divide the variables!

y=dydx    dydx+u(x)y=0dyy=u(x)dxlny=u(x)dxy=CeF(x),F(x)=u(x)dx,C=const(*)y' = \frac{dy}{dx} \implies \frac{dy}{dx} + u(x)y = 0 \\ \frac{dy}{y} = -u(x)dx \\ ln|y| = -\int{u(x)dx} \\ y = Ce^{-F(x)}, F(x) = \int{u(x)dx}, C = const \tag{*}If some of the transformations above seem vague to you, just return to the introductory topic and recall how we solve simple ODEs by dividing variables.

Cool, now we've solved a homogeneous linear ODE! By the way, don't be confused by the general form of this solution: all functions of this kind satisfy the equation (2)(2) and therefore are its solutions. Don't get scared by the integral in the exponent – if we knew the particular kind of function u(x)u(x), we would substitute the integral into the final answer ()(*).

Now, let's turn to the initial equation (1)(1). How can the solution ()(*) of the homogeneous equation help us? The next idea we will bring in here is the method of variation of constants. Let's consider the constant CC in the solution above as a function of the independent variable xx rather than some arbitrary number.

Thus, our general solution will take the following form:

y=C(x)eF(x)(3)y = C(x)e^{-F(x)} \tag{3}To get the final solution, we should only find the unknown function C(x)C(x) (since F(x)F(x) is unambiguously calculated from u(x)u(x) and may be considered known). To do it, let's substitute the general form of the solution (3)(3) into the initial equation (1)(1):

y+u(x)y=f(x)(C(x)eF(x))+u(x)C(x)eF(x)=f(x)C(x)eF(x)+(eF(x))C(x)+u(x)C(x)eF(x)=f(x)y' + u(x)y = f(x) \\ (C(x)e^{-F(x)})' + u(x)C(x)e^{-F(x)} = f(x) \\ C'(x)e^{-F(x)} + (e^{-F(x)})'C(x) + u(x)C(x)e^{-F(x)} = f(x) \\Don't get discouraged, we are nearing the end of our journey!

Let's talk in more detail about the derivative (eF(x))(e^{-F(x)})'. It is a complex function, therefore the derivative is

(eF(x))=eF(x)(F(x))=eF(x)(u(x)dx)=u(x)eF(x)(e^{-F(x)})' = e^{-F(x)}(-F(x))' = -e^{-F(x)}(\int {u(x)dx})' = -u(x)e^{-F(x)}since F(x)F(x) is simply an antiderivative of u(x)u(x), and thus, differentiating F(x)F(x) returns u(x)u(x).

Now, let's gather all parts together:

C(x)eF(x)u(x)eF(x)C(x)+u(x)C(x)eF(x)=f(x)C'(x)e^{-F(x)} -u(x)e^{-F(x)}C(x) + u(x)C(x)e^{-F(x)} = f(x)Wow! The terms in the left part annihilate, leaving us with a simple equation:

C(x)eF(x)=f(x)C(x)=f(x)eF(x)C(x)=f(x)eF(x)dx(**)C'(x)e^{-F(x)} = f(x) \\ C'(x) = f(x)e^{F(x)} \\ C(x) = \int{f(x)e^{F(x)}dx} \tag{**}Great! We know the general form of the solution (3)(3), and we've found the unknown function C(x)C(x). Now, let's check our solution by substituting it into the original equation... just kidding, we're not going to do that. We've had enough theory for today. However, as an exercise in differentiation, you can do it yourself.
You may wonder why this trick of replacing a constant with a function worked. There is a theoretical justification for the constant variation method, but it is beyond our interest in this topic. It is enough for us to know that this method will always lead us to success. Of course, if our equation is homogeneous, we should stop our solution at the step ()(*).

Let's summarize what we've learned about solving non-homogeneous linear ODEs in a straightforward algorithm:

  1. Zero out the right side, arriving at a homogeneous equation.
  2. Solve it by the variable separation method (at this step, our solution takes the form ()(*)).
  3. Treat the arbitrary constant CC as an unknown function C(x)C(x). Substitute the solution of the form (3)(3) into the initial non-homogeneous equation.
  4. Solve the resulting equation for C(x)C(x).
  5. Put all the components together to get the final solution.

Example

Let's turn to a concrete equation:

y+2xy=xex2y' + 2xy = xe^{-x^2}Following the notation from (1)(1), here we have

u(x)=2xf(x)=xex2u(x) = 2x\\ f(x) = xe^{-x^2}Instead of substituting these functions into formulae ()(*) and ()(**), we will follow our algorithm from the very beginning. It turns out to be a good practice since the formulae are not easy to learn. Moreover, one has to be extremely careful with the signs as they depend on the concrete form we write our equation in. By contrast, our algorithm is easy to keep in mind.

1. The homogeneous equation in our case is y+2xy=0y' + 2xy = 0.

2. Solving it may seem a pleasure after all the theoretical stuff we've covered above:

dydx+2xy=0dyy=2xdxlny=x2+Cy=Cex2\frac{dy}{dx} + 2xy = 0 \\ \frac{dy}{y} = -2xdx \\ ln|y| = -x^2 + C \\ y = Ce^{-x^2}3. Now we have an ansatz for our solution. To finalize it, we consider CC as a function of the independent variable: C=C(x)C = C(x). Let's substitute this into the initial equation:

y+2xy=xex2,y=C(x)ex2(C(x)ex2)+2xC(x)ex2=xex2C(x)ex2+C(x)(ex2)+2xC(x)ex2=xex2C(x)ex22xC(x)ex2+2xC(x)ex2=xex2C(x)=xC(x)=x2/2+C,C=consty' + 2xy = xe^{-x^2}, y = C(x)e^{-x^2} \\ (C(x)e^{-x^2})' + 2xC(x)e^{-x^2} = xe^{-x^2} \\ C'(x)e^{-x^2} + C(x)(e^{-x^2})' + 2xC(x)e^{-x^2} = xe^{-x^2} \\ C'(x)e^{-x^2} - 2xC(x)e^{-x^2} + 2xC(x)e^{-x^2} = xe^{-x^2} \\ C'(x) = x \\ C(x) = x^2/2 + C, C = constNote that the terms containing C(x)C(x) eliminated each other again. This is not a coincidence, but rather a checkpoint for your solution: if your calculations are correct, these two terms will always vanish, leaving you with a single term containing C(x)C'(x).

So, our final solution takes the form

y(x)=(x22+C)ex2,C=consty(x) = (\frac{x^2}{2} + C)e^{-x^2},\\ C = const

Hooray!

Role of initial conditions

In fact, there is nothing new to say here after what we've covered in the introductory topic. The solutions we got previously were general, i.e., they contained a constant that could take any values, leading to different solution functions. If we want to pick up some concrete solution, we should impose an initial condition, fixing the value of our function at a certain point.

For example, for the equation we've solved above, such a problem could look like:

{y+2xy=xex2y(1)=0\begin{cases} y' + 2xy = xe^{-x^2} \\ y(1) = 0 \end{cases}The algorithm is as follows:

  1. Find a general solution of an ODE.
  2. Substitute the initial condition into the solution and solve the resulting equation for CC.

Remember that the general form of our solution is

y(x)=(x22+C)ex2,C=consty(x) = (\frac{x^2}{2} + C)e^{-x^2},\\ C = constTo get the value of CC, we substitute the initial condition:

0=(122+C)e12C=120 = (\frac{1^2}{2} + C)e^{-1^2} \\ C = -\frac{1}{2}So, the particular solution is

y(x)=(x212)ex2y(x) = (\frac{x^2-1}{2})e^{-x^2}In the picture below, you may see different solutions y(x)y(x), depending on the constant CC.

Different solutions, depending on the constant

Note that CC is not just a scaling constant, as it strongly affects the form of the solution curve.

Conclusion

In this topic, we've figured out what first-order linear ODEs are and how to solve them. Such ODEs can be homogeneous and inhomogeneous. The former are easy to solve using the method of separation of variables, while the latter are solved using a technique called the "variation of a constant". The final answer, as always, contains one arbitrary constant that defines a family of solutions. To isolate a particular solution from this family, an additional initial condition can be imposed on the ODE.

2 learners liked this piece of theory. 0 didn't like it. What about you?
Report a typo