Sei sulla pagina 1di 23

Ordinary Differential Equations (ODEs)

1.0 : Introduction Here we cover basic ways of solving ordinary differential equations (ODEs). This will include :

1.1 : Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2 : 1st Order Ordinary Differential Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2.1 : Separation of variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.2.2 : General solutions and family of solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.3 : Initial conditions (I.C.s) and particular solutions . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2.4 : Use of substitutions in reducing to a separable ODE . . . . . . . . . . . . . . . . . . . . . . 6 1.2.5 : Exact differential equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.3 : Integrating Factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.3.1 : Proof of integrating factor method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.4 : 1st Order ODEs : Riccati ODE (for advanced group only; private reading /self-study) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.4.1 : The Riccati ODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.4.2 : General solution of the Riccati ODE when two solutions are known . . . . . . . . . . 13 1.5 : 2nd Order ODEs : Homogeneous Equations With Constant Coefficients . . . . . . . . 14 1.5.1 : General solution to the 2nd order homogeneous ODE : Real and distinct roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.5.2 : Initial conditions and boundary conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.5.3 : General solution to the 2nd order homogeneous ODE : Real and equal roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 1.5.4 : General solution to the 2nd order homogeneous ODE : Complex roots . . . . . . . 19 1.6 : 2nd Order ODEs : Inhomogeneous equations - The method of undetermined coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 1.6.1 : Standard case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 1.6.2 : Breakdown case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 1.7 : Differential equations with non-constant coefficients (for advanced group only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

1.2 : 1st Order Ordinary Differential Equations First order ODEs are equations containing first derivatives, i.e. equations containing dy/dx or dx/dt, or other similar 1st derivatives. We then wish to solve such equations for y or x. There are three ways of representing 1st order ODEs, namely either as dy = f (x, y ) dx or dy M(x, y ) = dx N(x, y ) or

M(x, y ) dy + N(x, y ) dx = 0

In other words dy = ex y dx ,
2 dy = 2x dx y cos y

x cos y.dy + (y 1 ).dx = 0

are all different forms of ODEs. Two methods we shall study for solving first order ODEs will be i) Separation of Variables ii) Integrating Factor

1.2.1 : Separation of variables These are ODEs whose variables can be explicitly separated using just algebra, and then integrating directly to get the required solution. For example, consider the ODE dy 1 = x 2 (1 + y ) + y . dx Rearranging this ODE we have dy = 1 + x2 + y + x2y , dx dy = (1 + x 2 )(1 + y ) , dx from which we may now separate the variables as 1 dy = (1 + x 2 ) dx . 1+y Integrating this gives Hence or

1 1 y dy = 1 + x 2 dx . +
y = e x+x /3+k 1,
3

y = Ce x+x /3 1
3

(we must not forget to include the constant of integration in our solution).

1.2.2 : General solutions and family of solutions Every solution to an ODEs contains constants. A first order ODE will only ever have one constant, since we are effectively only integrating once. In this case the solution to the ODE is called a general solution. Hence the general solution to dy 1 = x 2 (1 + y ) + y . dx is

y = Ce x+x /3 1.
3

If we knew the value of C we would then have a specific solution to our ODE. We will deal with this case later. For the moment C can take on any value and thus we have an infinite number of solutions to the ODE. Plotting the solution above for various values of C is illustrated below :

Therefore y = Ce x+x

3 /3

1 constitutes not just one solution but what is called a family of solutions.

1.2.3 : Initial conditions (I.C.s) and particular solutions In order to find any one specific solution to an ODE we need to find a value to the constant C. To do this we need some extra information. This information is called an initial condition and it means that we know the answer to y and one specific value of x. You might wonder how it is possible to know one specific solution to the problem when we dont yet know the general solution, but this is not as strange as it might seem. To understand how this is possible consider the example of an electric circuit. This circuit can be described mathematically by some ODE relating current i to time t. We want to find the general solution which will allow us to calculate the current at any time t. However, we already know the value of the current at one particular time, namely we know that when the circuit is switched off no current is flowing. In terms of initial conditions this means that i = 0 when t = 0. So, it is possible to know the answer to an ODE at one particular moment, and this is what I.C.s describe.

With a particular initial condition we can then find the value of the constant C in the general solution and thus obtain the particular solution to the ODE. Different I.C.s would then produce different particular solutions. Suppose therefore that for the ODE dy 1 = x 2 (1 + y ) + y , dx whose general solution is

y = Ce x+x /3 1,
3

we have an initial condition of y = 1 when x = 0. We then substitute these values into the general solution and calculate the resulting value of C : 1=C1 Hence the particular solution to u C = 2.

dy 1 = x 2 (1 + y ) + y is dx

y = 2ex+x /3 1,
3

whose graph is

Examples See lecture. Find the solutions to the following 1st order ODEs 1) e x dy = 1 + y2 dx 2) dx = 3kt 2 x , k = constant, given x(t ) = 1 0 dt

(x 2 e y/x y 2 ) dx + xy dy = 0, given that y(1) = 0 (*See p55 onwards of my modern diff equations book*)
3) 4) 5) If a voltage V is passed across an R-L circuit the current i flowing through the circuit is given by L di + iR = V . dt Given that no current flows when the circuit is turned off, find an expression for the current flowing through the circuit. Exercises Find the general solutions to the following separable 1st order ODEs : 1) 4) x. dy y = y3 dx dy dy = a 1 + x2 dx dx 2) tan x. dy =y dx 5) 3) xy. dy = 1 x2 dx

(x 2 y 2 ) dx + xy dy = 0,

y x.

dy =0 dx (*See p49-51 of my modern diff equations book*) 3e x tan y + (1 e x sec 2 y ).

1.2.4 : Use of substitutions in reducing to a separable ODE If the variables of an ODE cannot be separated, it might be possible to transform it into one whose variables can be separated. We can do this by making a relevant substitution. Just as we used substitution in integration in order to simplify a difficult integral into an easier one, so we can do the same with ODEs. For example, the variables of dy x + y = dx x y cannot be separated. But if we make the substitution y = u.x, where u is a function of x, then dy = u + x. du . dx dx Thus the original ODE becomes u + x. du = x + ux dx x ux du = 1 + u 2 . dx x(1 u )

which simplifies to

This ODE is now separable and can therefore be solved accordingly.

Examples See lecture. Find the solutions to the following 1st order ODEs (where necessary confirm that they are homogeneous equations) : 1)

dy y 2 y = + +1 dx x 2 x

2)

xy

dy = y2 x2, dx

dy 3) xy = y 2 x 2 e y/x , given that y(1) = 0 dx (*See p55 onwards of my modern diff equations book*) Exercises See exercise sheet (*See p60-61 of my modern diff equations book*) 1.2.5 : Exact differential equations Another class of ODEs which can be differentiated directly is one called exact differential equations. Such ODEs have the key property of having an exact derivative. We have already met exact derivatives in the topic on differentiation ! In fact, exact derivatives come from the use of the product rule and implicit differentiation. For example, if we were to differentiate

x2ey = ex
we would obtain

(1) (2)

2x.e y + x 2 e y

dy = ex dx

product rule + implicit diff

Normally we are given (1) and we differentiate it to obtain (2). However, we will now be dealing with problems were we will be given (2) and we will need to obtain (1). In other words we will need to solve the ODE (2) by integrating it to give (1). What we therefore have to do is to recognise that the LHS of (2) has to be seen as a whole : we do not want to integrate the LHS as two separate terms ( 2x.ey dx + x2ey dy/dx dx), but recognise that those two terms come from differentiating one product term. This then requires a bit of practice in looking backwards : what function has been differentiated by the product rule to give the ODE I am looking at ?. This is (easily ?) answered : look at each term on the LHS of (2) :

2x.e y
x 2 .e y dy dx

and decided which are the undifferentiated parts. It is therefore the case that x2 is one of the undifferentiated terms (giving 2x on differentiation) and ey is the other undifferentiated term (giving ey.dy/dx on differentiation). Hence we may directly integrate the ODE.

2 x .e y + x 2 e y

dy = ex dx

d ( x 2e y ) = e x dx
In the above example we have effectively integrated one term of the LHS w.r.t. x and the other term of the LHS w.r.t. y.

Examples See lecture. Which of the following are exact differential equation ? For those which are exact, integrate them directly : 1) 2) 3) (sin y + y cos x ) + (sin x + x cos y ) (x 2 cos y 1 ) dy =0 dx

dy = 2x sin y, given y(0) = . dx

y dy e y/x x e y/x + 1 2 + e y/x =0 dx 1+x

Exercises See exercise sheet (*See p69-70 of my modern diff equations book*)

1.3 : Integrating Factor Not all 1st order ODE can be solved by separation of variables, nor can they be reduced to separable variable form by a substitution. Consider for example the ODE dy + 5y = e 2x dx There is no way we will be able to separate the variables. But what if, instead of looking to separate the variables, we multiplied the ODE by e5x ? Why ? How would I know to do this ? you may ask. Well, if we perform such a multiplication we obtain e 5x dy + 5e 5x y = e 5x e 2x . dx

Looking carefully at the LHS of the ODE we should now see that it is the exact derivative of ye5x. So that answers the question of why we multiply the ODE with e5x. But how do I know I have to use e5x and not some other function ?. This question will be answered in the proof of the next section. Let us, for the moment, continue to solve the ODE above. Integrating gives e 5x y = e 3x dx , From which we may continue as usual to obtain the general solution y = e2x + ke5x. We therefore see that the way in which we can solve ODEs like the above is to multiply both sides of the ODE by a function which makes the LHS of the ODE an exact derivative. 1.3.1 : Proof of integrating factor method The only problem now is to know how to derive this function, called an integrating factor. So, here we will prove that for the general differential equation dy + P(x ).y = Q(x ) dx (1.3.1)

an integrating factor does exist and such an integrating factor helps us obtain an exact differential on the LHS of the ODE. Therefore, if there exists an integrating factor I(x), multiply the ODE by it : I. dy + I.P.y = I.Q , dx (1.3.2)

where I, P, Q are all functions of x. The LHS of this ODE is now an exact derivative (because we have an I(x) which makes it so) and we integrate it directly as I.y = I.Q dx . (1.3.3)

But if we differentiate the LHS of (1.3.3) we should obtain the LHS of (1.3.2). Let us do this and equate the two expressions I. This expression simplifies to I.P = dI , dx which can easily be solved by separation of variables to give ln I = P dx . This then gives the integrating factor I(x) = e P x
( ) dx

dy dy + I.P.y = I. + y. dI . dx dx dx

This is then the expression we need, and we can now use it to multiply the ODE. Hence we obtain e P(x ) dx dy + e P(x ) dx .p(x ).y = e P(x ) dx .Q(x ) dx

The left hand side is now an exact derivative and can be integrated directly. Hence we have e P(x ) dx .y = e P(x ) dx .Q(x ) dx + k . We may now divide through to obtain the final general solution to the ODE : y = e P(x ) dx e P(x ) dx .Q(x ) dx + k.e P(x ) dx , where k is the constant of integration. Examples See lecture. Find the general solution to the following 1st order ODEs : i) dy + 2xy = x dx 1 dy y = cos x sin x dx ii) dy y + = ex dx x dy 3 4x y = (1 + x 2 ) e x dx x 2 + 1

iii)

iv)

Find the particular solution to the following 1st order ODEs : i) cot x. dy + y = cot x. sin 2x, given y(0) = 1. dx

ii)

dy ky = a. sin x, where a, k are constants, given that y = a 2 when x = 0 dx 1+k dy + 5x 4 y = x 4 , given that y(0) = 7 dx

iii)

Exercises See exercise sheet (*exercises off my handwritten notes, + P80 and selected from p83-85 of modern diff eqns book*)

10

The idea behind exact derivatives and integrating factors can easily be extended to products of three or more functions. As an example, consider the 1st order ODE x.e x
2

dy 2 2 2 + e x .y + 2x 2 e x y = x.e x . dx
2

The left hand side of the ODE happens to be the exact derivative of the expression x.e x y. This can 2 easily be seen by differentiating x.e x y using the product rule twice. On the other hand, in order to 2 findx.e x y as the exact derivative of the ODE we again look for those function in the left hand side which are differentiated and/or undifferentiated. Hence i)
2 2 dy in the first term x.e x , the term dy/dx is clearly the differentiated part, so x.e x is dx the undifferentiated part;

ii)

in the second term e x .y, the terms y and e x are clearly undifferentiated, so the x present in the first term must have been differentiated; finally, in the third term 2x 2 e x y, the term y is clearly undifferentiated. Knowing that an x already exists as part of the term, the remaining term 2x must have come 2 from differentiating e x .
2

iii)

Given that we have now accounted for all the separate function, namely the undifferentiated and 2 differentiated versions of x, e x and y, we can say that the left hand side of the ODE is an exact derivative and we can integrate this directly to give x.e x y = x.e x dx .
2 2

From this we obtain the final general solution to be


2 y = 1 (Ce x 1 ), 2 x

where C is the constant of integration. Consider now the 1st order ODE dy y 2 + x + 2xy = x.e x . dx Here the left hand side is not an exact derivative, so we need to find an integrating factor which 2 makes it so. The integrating factor for this ODE happens to be x.e x . Multiplying the ODE by this integrating factor will then transform the left hand side into an exact derivative (check this).

11

1.4 : 1st Order ODEs : Riccati ODEs (for advanced group only; private reading/self-study) We will now study a special type of 1st order ODEs which do not fit the standard structure above. In this case the aim will be to use a substitution (just like we use substitutions in integration to transform them into simpler problems) to transform the ODE into a simpler, linear ODE so that we can then solve it using one of the methods above (usually this will be by using the integrating factor method) 1.4.1 : The Riccati ODE So far we have seen how to solve 1st order ODEs of the type y + p.y = q.y n , where p h p(x) and q h q(x) are functions of x, when n = 0 (by integrating factor) and when n m 1 (Bernoulli equation). We will now make a general study of this ODE when n = 2. More specifically we will study, and solve special cases, of the following ODE : dy = r(x ) + p(x ).y + q(x ).y 2 , dx (1.4.2)

where r(x) ! 0 (why ?) and where q(x) ! 0 (why ?). This ODE is called the Riccati equation (Jacopo Riccati, Italian mathematician, 1676 1754) and is a 1st order non-linear ODE (1st order because it only goes up to 1st derivative, and non-linear because it has a y2 term). One of the biggest problems (of many) in mathematics is an equation which is non-linear. They are a nightmare to have to solve, so what people try to do is to simplify them by making them linear by using some sort of transformation/substitution. This is what we will do here. What we therefore want to do is transform (1.4.2) so that it no longer has the y2 term in it. To do 1 this we will use the transformation y = qu du , where u h u(x) (i.e. u is a function of x) is a dx continuous and differentiable function. We will then substitute this into (1.4.2) which should then simplify it into a linear equation in u(x). As such we should therefore end up with an ODE in u(x) which does not have any u2 terms (or any un terms for n > 1) in it. Hence implies that

y
dy dx

1 = qu du dx 1 = d qu du dx dx q 2 1 = qu u + 1 2 (u ) + 2 u q u qu (1.4.3)

Substituting (1.4.3) into (1.4.2) gives q (u ) 2 2 u 1 qu u + 1 2 (u ) + 2 u = r + p qu + q 2 2 . qu q u q u


2 Now, notice how the terms in (u ) cancel left and right. This is exactly what we wanted : No squared terms, and that is why we chose the transformation y = u /(qu ).

12

The above ODE therefore simplifies to q u 1 qu u + 2 u = r + p qu , q u i.e.

qu + (pq q )u + rq 2 u = 0,

(1.4.4)

which is now a linear ODE. Notice that this is a 2nd order ODE (i.e. an ODE which goes up to second derivatives). We will study these types of ODEs later, but the above ODE has no general solution in closed form, i.e. as a formula with a finite number of terms of basic functions. So we either have to use methods involving infinite series (which then gives us an infinite number of terms and hence an approximate answer only) or we study only some special cases of the Riccati ODE which do give us exact, closed form solutions. We shall ignore the use of series solutions and focus only on some special cases of the Riccati equation. 1.4.2: General solution of the Riccati ODE when two solutions are known See the ODEs cswk to come.

Exercises Once you have done the cswk you will be able to solve the following exercises. So, find the general solutions to the following Riccati equations given the known solutions listed : 1) 2) 3) 4) 5) 6) 7) 8)

y = y 2 + (1 2x )y + x 2 x + 1; y = xy 2 + (1 2x )y + x 1; u (1 2x 2 ) = xu + u 2 ; v = (x + v )(x + v 2 );
2 x x = x 3 (y x ) ; t

y1 = x. y1 = 1. u1 = x. v1 = 1 x. x1 = t. y1 = 1. x1 = et .

y = (y 1 )(y + 1/x ); x = e t x 2 + x e t ;

Guess a very simple solution to y = (1 2t ) + ty 2 + t 1. Use this solution to find the general solution to this ODE. (*y1 = 1*)

13

1.5 : 2nd Order ODEs : Homogeneous Equations With Constant Coefficients Second order ODEs are equations containing second derivatives, i.e. equations containing d 2 y/dx 2 or d 2 x/dt 2 , or other similar 2nd derivatives. Such ODEs may also contain 1st derivatives as well, but not necessarily so. We then wish to solve such equations for y or x. Two methods we shall study for solving second order ODEs will be those relating to i) and ii) use of auxiliary equation to find complementary functions as well as the use of trial solutions for finding particular integrals of non-homogeneous 2nd order ODEs. use of auxiliary equation for solving homogeneous 2nd order ODEs,

The most general type of 2nd order ODE is

a(x ).

d2y dy ( ) ( ) ( ) 2 + b x . dx + c x .y = f x , dx

(1.5.1)

where the coefficients a, b, and c are all functions of x. A simpler form of the ODE above (and one which is much easier to solve) is when a, b, and c are constants, i.e.

a.

d2y dy ( ) 2 + b. dx + c.y = f x . dx

(1.5.2)

where a, b, c c . We will deal with the solutions to (1.5.2) in two steps : we will first consider how to solve the ODE when f(x) = 0, then we will consider how to solve it when f(x) is a given function. Later we will also consider how to solve (1.5.1) when f(x) ! 0. 1.5.1 : General solution to the 2nd order homogeneous ODE : Real and distinct roots Here we wish to solve the 2nd order ODE

ay + by + cy = 0,
where a, b, c c . This type of ODE is called a homogeneous ODE. To see how to solve it let us consider an actual example : Let us try to derive the general solution to

y + 5y + 6y = 0.
We can rewrite this as

y + 2y + 3y + 6y = 0.
It is not yet obvious why we would want to do this. After all, why not write the ODE as

(1.5.3)

y + 1y + 4y + 6y = 0

or

y + 5y + 4y + 2y = 0

or any other form ? Well, we will see why it is useful to write the ODE in the form (1.5.3) as we progress through the derivation. Some simple algebra gives :

y + 2y = 3y 6y.

14

Since

d2y dy we can write the above as h d dx 2 dx dx d dy + 2y = 3 dy + 2y dx dx dx

For convenience we can replace dy/dx + 2y by z. We then end up with dz = 3z dx which we should recognise as a 1st order separable ODE. In other words, we have reduced our ODE to one which can be solved by separation of variables. Solving in this way we obtain z = A.e3x where A is a constant and is equal to ek (here, k is the usual constant of integration). But since z = dy/dx + 2y we now need to solve dy + 2y = A.e 3x . dx This can be done using the integrating factor method. Hence we will obtain the solution y = A.e3x + B.e2x where A and B are constants. We can now generalise the derivation of the solution above. Let ay + by + cy = 0 be a 2nd order homogeneous ODE which has two real and distinct roots and . Then the ODE can be written as

y ( + )y +
Some basic algebra gives which becomes

y = 0.

y y = (y y ).
d (y y ) = (y y ) . dx

Letting z = y y we transform our ODE into dz = z . dx Solving by separation of variables we have

z = Be x ,
where B is the constant of integration. But since z is itself an differential equation we have to now solve dy y = Be x . dx

15

This can be done using the integrating factor method with P(x) = . The general solution is then

y = Ae x + Be x ,

(1.5.4)

where A, B c are constants of integration whose values can be found once we are given some extra information. We now notice how, in general, the solution to ay + by + cy = 0 is like solving a quadratic with coefficients a, b, and c. The constants and in the general solution (1.5.4) then seem to be the roots of this quadratic equation. This is in fact the case ! No longer will be need to do the process above (unless asked for as part of a proof). All we will need to do is i) set up the auxiliary or characteristic equation (essentially a quadratic with coefficients a, b, and c) : a.m2 + b.m + c = 0, solve the auxiliary/characteristic equation to find the roots and , use the relevant general solution depending on the type of roots we have, in this case

ii) iii)

y = Ae x + Be x .
The type of general solution we use depends on the type of roots we have : real and distinct, real and equal, or complex. We will see later what type of general solution we get for roots which are real and equal or complex. Examples See lecture. Find the general solution to the following homogeneous 2nd order ODEs : 1)

y + 11y + 24y = 0,

2)

y + 3y 10y = 0.

1.5.2 : Initial conditions and boundary conditions We see from the previous section that 2nd order ODEs give rise to two arbitrary constants and not just one as in the case of 1st order ODEs. To find the values of these constants we need extra information. For 2nd order ODEs this extra information can come in one of two types : boundary conditions or initial conditions. Boundary Conditions Here we specify the value of the dependent variable y at two end points of x, for example y = 0 when x = 0, and y = 10 when x = 1. Initial Conditions Here we specify the value of the dependent variable y and the derivative dy/dx at a starting point of x, for example y = 0 when x = 0, and dy/dx = 0 when x = 0.

16

From the previous section we know that the general solution to y + 5y + 6y = 0 is given by y = A.e-3x + B.e-2x. If we now know that this ODE satisfies the boundary conditions y(0) = 2, and y(0.075) = 1.66 then we can find the particular solution by substituting these values into the G.S. as follows : y(0) = 2 : y(0.075) = 1.66 : 2=A+B 1.66 = 0.7985A + 0.8607B

Solving this gives A = 1 and B = 1. Hence the particular solution to our ODE is y = e3x + e2x Examples See lecture. Find the particular solution to the following homogeneous 2nd order ODEs : 1) 2)

3y + 2y 8y = 0 when y(0 ) = 6 and y (0 ) = 18 4y 5y = 0 when y(2 ) = 0 andy (2 ) = 7

1.5.3 : General solution to the 2nd order homogeneous ODE : Real and equal roots Similarly we can derive the solution to ay + by + cy = 0 when its characteristic equation has real and equal roots. The process of finding the general solution is identical to that shown above in the case of real and distinct roots. Then, in following the algebra through we will end up with the necessary general solution to ay + by + cy = 0 when its characteristic equation has real and equal roots. Therefore, let ay + by + cy = 0 be a 2nd order homogeneous ODE which has two real and equal roots . Then the ODE can be written as

y 2 y +
Some basic algebra gives which becomes

y = 0.

y y = (y y ).
d (y y ) = (y y ) . dx

Letting z = y y we transform our ODE into dz = .z . dx Solving by separation of variables we have

z = Ae x ,
where A is the constant of integration.

17

But since z is itself an differential equation we have to now solve dy y = Ae x . dx This can be done using the integrating factor method with P(x) = . In this case we have I.F. = e
dx

= e

Multiplying our 1st order ODE above with this I.F. we obtain e x. dy .e x .y = A . dx

The left hand side is now an exact derivative which integrates directly to y.e x . Hence the equation above becomes y.e x = A dx = A.x + B The general solution then becomes

y = e x (Ax + B )

(1.5.5)

where A, B c are constants of integration whose values can be found once we are given some extra information. As before we dont need to keep on solving our ODEs in this way (unless asked for in a proof). Hence, all we will need to do is i) set up the auxiliary or characteristic equation (essentially a quadratic with coefficients a, b, and c) : a.m2 + b.m + c = 0, solve the auxiliary/characteristic equation to find the double roots and , use the relevant general solution :

ii) iii)

y = e x (Ax + B ),
iv) find the particular solution as necessary using the relevant ICs or BCs.

Examples See lecture. Find the particular solution to the following homogeneous 2nd order ODEs : 1) 2) 3)

y 4y + 4y = 0 when y(0 ) = 12 and y (0 ) = 3 16y 40y + 25y = 0 when y(0 ) = 3 andy (0 ) = 9 . 4 y + 14y + 49y = 0 when y(4 ) = 1 andy (4 ) = 5.

18

1.5.4 : General solution to the 2nd order homogeneous ODE : Complex roots We can also derive the solution to ay + by + cy = 0 when its characteristic equation has complex roots, in other words roots of the form ! i. The process of finding the general solution is identical to that shown above in the case of real and distinct roots. Since we have distinct roots to ay + by + cy = 0 we might as well just use the general solution for distinct roots. Hence y

= Ae (

+i )x

+ Be (

i )x
x

= Ae x e i x + Be x e i

= e x (Ae i x + Be i x ).
Now it can be shown (using Taylor series on ex, sin x and cos x) that e ix = cos x + i sin x. Substituting it into the above expression we obtain

y = e x (A(cos x + i sin x ) + B(cos x i sin x )),


which simplifies to

y = e x (D cos x + iE sin x ),

where D = A + B and E = A B. Now, although this solution is complex it doesnt always have to be so. For example, if we let A = 1 + i and B = 1 i then D=1+i+1i=2 and iE = i(1 + i 1 + i) = 2i2 = 2

So D and E can be real. We will therefore only deal with solution which have real coefficients, and the general solution to the ODE when its characteristic equation has complex roots is

y = e x (A cos x + B sin x ).

(1.5.6)

where all I have done is to swap the letters D and E for A and B just to be consistent with the coefficients of the previous general solutions of (1.5.4) and (1.5.5). As before we dont need to keep on solving our ODEs in this way (unless asked for in a proof). Hence, all we will need to do is i) set up the auxiliary or characteristic equation (essentially a quadratic with coefficients a, b, and c) : a.m2 + b.m + c = 0, solve the auxiliary/characteristic equation to find the complex roots ! i, use the relevant general solution :

ii) iii)

y = e x (A cos x + B sin x ),
iv) find the particular solution as necessary using the relevant ICs or Bcs.

19

Examples See lecture. Find the particular solutions to the following 2nd order homogeneous ODEs 1) 2) 3)

y 4y + 9y = 0 when y(0 ) = 0 and y (0 ) = 8 y 8y + 17y = 0 when y(0 ) = 4 and y (0 ) = 1 4y + 24y + 37y = 0 when y( ) = 1 and y ( ) = 0

In summary, to solve homogeneous 2nd order ODEs with constant coefficients we perform the following three steps : i) ii) iii) Replace the ODE by an equivalent quadratic called the characteristic equation. Solve the characteristic equation (as you would any quadratic) to obtain two roots. Substitute your answers to ii) into the relevant standard general solution : a) for two real and distinct roots and : y = A.ex + B.ex b) for two real and equal roots and : y = ex.(Ax + B) c) for two complex roots ! i : y = ex (A.cos(x) + B.sin(x))

Exercises See handouts.

1.6 : 2nd Order ODEs : Inhomogeneous equations - The method of undetermined coefficients We have seen how to solve 2nd order ODEs where the right hand term was 0. But how do we solve the more general type of ODE (*) a.y + b.y + c.y = f (x ) when f(x ) ! 0. We need, somehow, to find a way of solving this type of ODE. 1.6.1 : Standard case The way in which we can solve inhomogeneous ODEs such as (*) is two-fold : i) firstly we solve the ODE as if f(x) = 0. In other words we solve the equivalent homogeneous ODE

a.y + b.y + c.y = 0


in the usual manner. For example, if we wanted to find the general solution to

y + 5y + 6y = e 5x
we would first begin by solving

y + 5y + 6y = 0
to obtain A.e-2x + B.e-3x. It is now important to understand that this solution is not the general solution. It is only part of the general solution, since we still have to find another solution which accounts for the function f(x).

20

So, it is mathematically incorrect to write y = A.e-2x + B.e-3x Since y represents the complete general solution and A.e-2x + B.e-3x is only part of the complete solution. The solution to the homogeneous ODE a.y + b.y + c.y = 0 is now simply called the complementary function;

ii)

secondly, in order to account for the function f(x) we need to find a particular integral to the ODE a.y + b.y + c.y = f (x ) . In other words we need to find an answer which when substituted into the LHS of the ODE will gives us f(x) as a solution. This may seem a strange thing to do : we need to find an answer to the ODE in order to be able to solve the ODE ! Well, it is not as strange as all that. As an example suppose we had to solve y + 5y + 6y = e 5x . What kind of function y would we need to find in order for the LHS to give us the answer e5x ? Well, it would have to be some combination of e5x, in other words k.e5x, where k is a constant. We know this will work since every time we differentiate e5x we will recover e5x as part of our answer. All we then need to do is find the specific combinations of e5x to use in the LHS of our ODE in order to get exactly e5x on the right hand side. Let me therefore assume that k.e5x is a solution to y + 5y + 6y = e 5x . What value of k is necessary in order to obtain e5x of the RHS ? To find this, substitute into the ODE :

(25k.e 5x ) + 5(5k.e 5x ) + 6(k.e x ) = e 5x .


Solving for k we find k = 1/56, and therefore one particular solution to

y + 5y + 6y = e 5x
is y =
1 5x 56 e .

iii)

finally, find the actual general solution to y + 5y + 6y = e 5x we add the two previous solutions, i.e. we add the complementary function and the particular integral : G.S. :

y = A.e 2x + B.e 3x +

1 5x 56 e

The first two terms are then solutions to y + 5y + 6y = 0, and the last term is a solution which accounts for the RHS function e5x.

21

But .... I hear you cry. No need to panic I say. The guesses you will need to make for the RHS function f(x) are listed in the table below : If the RHS of the ODE is ... constant linear quadratic the exponential function epx sin px cos px ... choose your trial function to be y=k y = ax + b y = ax2 + bx + c y = k.epx A.sin px + B.cos px A.sin px + B.cos px

Examples See lecture. Find the general/particular solution to the 2nd order inhomogeneous ODEs below : i)

y + 5y + 6y = 24 4i + 8i + 4i = v. cos t given that i(0) = 0 and i (0 ) = 0

ii)

y + 4y + 5y = 13e x , given y(0) = 5/2, and y (0 ) = 1/2 x = x + 1, given x = 0 when t = 0 and x = u when t = a

iii)

iv)

Exercises See handouts. Also, find the general/particular solution to the 2nd order inhomogeneous ODEs below : i)

y + 3y + y = 4x 2 y 7y + 10y = 2e x

ii)

2x 5x + 3x = 10e t , given y(0) = 0, and x (0 ) = 0 3y + y 5y = e x + x

iii)

iv)

1.6.2 : Breakdown case Consider finding the general solution to

2y + y y = e x .
The complementary function is given by A.ex/2 + B.ex. Now, since the RHS of the ODE is an exponential let us use y = kex as our trial function. Substituting this into our ODE we obtain

2(ke x ) + (ke x ) ke x = e x .
Hence What is going on here ? See lecture. 0 = ex ?

22

Examples See lecture.

Exercises See exercise sheet.

1.7 : Differential Equations With Non-Constant Coefficients (for advanced group only)

See separate handouts

23

Potrebbero piacerti anche