Lecture 19: Solving linear ODEs + separable techniques for nonlinear ODE s Geoffrey Cowles Department of Fisheries Oceanography School for Marine Science and Technology University of Massachusetts-Dartmouth November 13, 2008
Linear systems Consider our general ODE problem: y = f (x, y). We have already seen for ODEs of the form y = f (x) we can easily solve by integrating both sides w.r.t. x. Now we will look at a second type of equations: linear. A linear ODE is of the form: y + p(x)y = q(x) It is linear because the powers of y and y are either 1, or if they are not present, 0. A linear example would be: (x 2 + 1)y xy = e x and a nonlinear example would be: (x 2 + 1)y x y = e x We have a technique for dealing directly with the former. For nonlinear equations, there is a technique that works for certain forms, but in general, numerical techniques may be required.
Solving Linear ODE s: Eqns of the form: y + p(x)y = q(x) This is a little tricky, so pay attention. First, we find the antiderivative of p(x) and call that F(x). Then, we form the function G(x) = e F (x). Note that G(x) is called the integrating factor. Now, we multiply both sides of the equation by G(x) to give G(x)y + G(x)p(x)y = G(x)q(x). However, if G(x) = e F (x), then G (x) = e F (x) F (x) by the chain rule. F (x) is, by definition p(x) and thus we have that G (x) = G(x)p(x). Plug that into our middle term above and we get: G(x)y + G (x)y = q(x)g(x). However, the left side of this equation is just, through the chain rule: G(x)y + G (x)y = (G(x)y) and thus we have finally, after some manipulations, the differential equation: (G(x)y) = q(x)g(x). This equation is in the form we already discussed. The solution process is straightforward, simply integrate both sides w.r.t. x.
Solving Linear ODE s: Recipe 1 Put the equation in the correct form: y + p(x)y = q(x) 2 Find the antiderivative of p(x) F(x) 3 Set G(x) = e F (x) 4 Solve (G(x)y) = q(x)g(x) by integrating both sides giving: G(x)y = q(x)g(x) 5 Solve the result and put in the nicer form: y = 1 G(x) q(x)g(x) Note, the constant of integration may end up multiplying some factor and is not necessarily of the form:... + C. See the following example.
Linear Equation: Ex1: Growth We ll return to the growth equation. We have already solved this in chapter 4 by essentially guessing a solution, but here we will formally determine the solution. Let s start with our growth equation: y = ky. 1 Put in the correct form: y = ky y ky = 0 2 Find antiderivative of p(t) = k F(t) = kt 3 Set G(t) = e F (t) = e kt 4 Solve (G(t)y) = q(t)g(t) e kt y = 0 + C 5 Solve for y: y = Ce kt 6 Check, by differentiating: Is Okay
Linear Equation: Ex2: y 3x 2 y = x 2 1 Equation is already in the right form 2 p(x) = 3x 2 F(x) = x 3 3 G(x) = e F (x) = e x 3 4 Solve: (e x 3 y) = x 2 e x 3 e x 3 y = x 2 e x 3 dx. We can solve this by substitution with u = x 3 and du = 3x 2 dx to give e x 3 y = 1 3 e x 3 + C 5 Solve for y: y = 1 3 + Cex 3 6 Check to make sure y satisfies the original ODE: 3x 2 Ce x 3 3x 2 ( 1 3 + Cex 3 ) x 2 = 0 Yes.
Autonomous Equations and Stability An interesting class of ODE s are the autonomous type. These equations have no explicit dependence on the independent variable and thus can be written in the form y = f (x, y) (as opposed to the more general form: y = f (x, y). Note that the exponential y = ry and logistic y = ry(1 y K ) growth functions we have studied are both of this form. In those cases, the rate of change of the population was only dependent on the population and had no explicit dependent on the time t. We will discuss the solution methods in the next lecture, but we will discuss a key tool in the study of differential equations here.
Equilibrium (Critical) Points Recall our discussion of derivatives. Critical points of a function y = f (x) were found by setting the derivative dy dx to zero and solving for x. These were points where the function f (x) was not changing with x. In differential equations, these critical points where y = 0 in general exist and are sometimes known as equilibrium points because the solution has reached equilibrium. Consider the growth equation y = ky. Solving for y = 0 = ky we find the differential equation has one equilibrium point y = 0. If we have 0 population, the population cannot grow. This is interesting in itself, but what we would like to know is how stable is this point. For example, let s say the ecosystem arrived at this point, but was subject to a small perturbation, i.e. the introduction of a few individuals. The I.V.P. y = ky with an initial condition y = y 0 where y 0 is a small, but finite number has the solution y(t) = y 0 e kt. This tells us that exponential growth will occur if our equilibrium solution is perturbed every so slightly. This equilibrium point is unstable. Let s look at the concept of stability more formally.
Equilibrium (Critical) Points Once we find the equilibrium point y = y c, we can assess the stability by looking at y very near that point. At the point, of course, the value is zero by definition. Also note that the critical point is not dependent on x. This is because we are looking at autonomous systems of the form y = f (y). Given a y c, we test y (y c + ɛ) and y (y c ɛ) and see if the calculated gradient would force the solution back to y c (asymptotically stable) or drive it away (unstable). Note that sometimes we only have to check one side of the equilibrium point if the other is not physically feasible. For example, in our growth equation, the equilibrium is y = 0. We can check y = 2, but we shouldn t check y = 2 as we can t have 2 fish.
Example: Growth Returning to our growth example, we have one critical point y = 0 y c = 0. We test the rate of change of the function at y = 2 to find y = 2r > 0. The derivative is positive and thus, perturbed, the system will grow with time, away from y = 0. We can see this if we look for the directional fields for the growth function:
Example: Decay With decay, our differential equation is y = ry. Again, we have one critical (equilibrium) point y = 0 y = 0. However, if we consider a small perturbation of the population, y = ɛ, we find that y = rɛ < 0. The rate of change is negative and thus, perturbed, the solution will drive back to zero. This is also clear from looking at the directional gradients. For your homework, you ll look at the logistic equation. Note, there are two equilibrium solutions (can you guess what they are)
Summary 1 Differential Equation: Equations with terms that include the derivative of an unknown function 2 Ordinary Differential Equation (ODE). A D.E. for a function of a single variable (as opposed to a partial differential equation) 3 1st Order Differential Equation: An ODE in which the highest derivative of the unknown function is the first derivative. Can be written in the form: y = f (x, y). 4 Linear (ODE) A linear ODE can be written in the form: y + p(x)y = q(x) and thus does not involve powers of the unknown function greater than 1 5 Autonomous D.E.: Differential equation that does not explicitly include dependent on the independent variable. Can be written in the form: y = f (y)
Review We have looked at some solution methods already for ODEs (remember the general form is y = f (x, y)). For equations of the form y = f (x) we just integrate both sides: y = f (x)dx. For linear ODEs we can write them in the form y + p(x)y = q(x) and solve them using the integration factor F(x) using a very straightforward procedure. In this lecture, we will discuss a third method which is related to the first above. It is called separation of variables. The idea is to manipulate the differential equation to get it in the form: f (y)y = g(x) We can then integrate both sides with respect to x f (y)y dx f (y) dy dx dx f (y)dy = g(x)dx If we can complete these integrals, we have a general solution for y(x)
Separable: Example 1 We will start with Example 1 from the book: y = 3x 2 e 2y. This rather scary looking ODE is easily manipulated into the form we need. Remember, we want all y stuff on the left and x on the right. If we can do that, than the equation is separable and we can use our separable-specific technique. e 2y y = 3x 2 Integrate both sides with respect to x to give (see last slide) e 2y dy = 3x 2 dx Take the ln of both sides: 1 2 e 2y = x 3 + C e 2y = 2x 3 2C 2y = ln( 2x 3 2C) y = 1 2 ln( 2C 2x 3 )
Separable Example 2 Sometimes the solution can t be written in the nice clean form y = stuff. Let s look at the Initial Value Problem, y = 2x y+e 5y with the initial data y(2) = 0. We start by separating the variables: dy dx = (y + e 5y )y = 2x 2x y + e 5y Integrate both sides to give: (y + e 5y )dy = 2xdx y 2 2 + e5y 5 = x 2 + C
Separable Example 2, cont d Now, we use the initial condition to determine C Our final solution: 0 2 2 + e5 0 5 = 2 2 + C C = 19 5 y 2 2 + e5y 5 = x 2 19 5 Note, this equation is implicit in y because we can t solve for y exactly. To examine solutions we have two choices. We can pick values of x and then solve the resulting equation for y using a root finding method. Alternatively, we can select values of y and solve for x easily. This method does not allow us to find out the value of y at a specific position x, but will allow us to graph the solution.