Topic5 ODEs

download Topic5 ODEs

of 23

Transcript of Topic5 ODEs

  • 8/6/2019 Topic5 ODEs

    1/23

    Ordinary Differential Equations (ODEs)

    1.0 : Introduction

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

    23

    1.7 : Differential equations with non-constant coefficients (for advanced group

    only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    221.6.2 : Breakdown case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    201.6.1 : Standard case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    20

    1.6 : 2nd Order ODEs : Inhomogeneous equations - The method of undetermined

    coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    191.5.4 : General solution to the 2nd order homogeneous ODE : Complex roots . . . . . . .

    171.5.3 : General solution to the 2nd order homogeneous ODE : Real and equalroots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    161.5.2 : Initial conditions and boundary conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    14

    1.5.1 : General solution to the 2nd order homogeneous ODE : Real and distinct

    roots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    141.5 : 2nd Order ODEs : Homogeneous Equations With Constant Coefficients . . . . . . . .

    131.4.2 : General solution of the Riccati ODE when two solutions are known . . . . . . . . . .

    121.4.1 : The Riccati ODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    12

    1.4 : 1st Order ODEs : Riccati ODE (for advanced group only; private reading

    /self-study) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    91.3.1 : Proof of integrating factor method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    81.3 : Integrating Factor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71.2.5 : Exact differential equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    61.2.4 : Use of substitutions in reducing to a separable ODE . . . . . . . . . . . . . . . . . . . . . .

    41.2.3 : Initial conditions (I.C.s) and particular solutions . . . . . . . . . . . . . . . . . . . . . . . . .

    41.2.2 : General solutions and family of solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    31.2.1 : Separation of variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    31.2 : 1st Order Ordinary Differential Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    21.1 : Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    1

  • 8/6/2019 Topic5 ODEs

    2/23

  • 8/6/2019 Topic5 ODEs

    3/23

    1.2 : 1st Order Ordinary Differential Equations

    First order ODEs are equations containing first derivatives, i.e. equations containing ordy/dx, or other similar 1st derivatives. We then wish to solve such equations for y or x. There aredx/dt

    three ways of representing 1st order ODEs, namely either as

    dydx

    =f(x,y)

    ordy

    dx=

    M(x,y)

    N(x,y)

    or

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

    In other words

    , ,dy

    dx

    = ex ydy

    dx

    =x2

    y2

    cosy

    x cosy.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

    .dydx

    1 =x2(1 +y) +y

    Rearranging this ODE we have

    ,dy

    dx= 1 +x2 +y +x2y

    ,dy

    dx= (1 +x2 )(1 +y)

    from which we may now separate the variables as

    .1

    1 +ydy = (1 +x2 ) dx

    Integrating this gives

    . 11 +y

    dy = 1 +x2 dx

    Hence

    ,y = ex+x3/3+k 1

    or

    y = Cex+x3/3 1

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

    3

  • 8/6/2019 Topic5 ODEs

    4/23

    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

    .dydx

    1 =x2(1 +y) +y

    is

    .y = Cex+x3/3 1

    If we knew the value ofCwe would then have a specific solution to our ODE. We will deal with

    this case later. For the moment Ccan take on any value and thus we have an infinite number of

    solutions to the ODE. Plotting the solution above for various values ofCis illustrated below :

    Therefore constitutes not just one solution but what is called afamily of solutions.y = Cex+x3/3 1

    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. Todo this we need some extra information. This information is called an initial condition and it means

    that we know the answer toy and one specific value ofx. 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.

    4

  • 8/6/2019 Topic5 ODEs

    5/23

    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

    dx 1 =x2(1 +y) +y

    whose general solution is

    ,y = Cex+x3/3 1

    we have an initial condition ofy = 1 when x = 0. We then substitute these values into the general

    solution and calculate the resulting value ofC:

    1 = C 1 u C = 2.

    Hence the particular solution to isdydx

    1 =x2(1 +y) +y

    ,y = 2ex+x3/3 1

    whose graph is

    Examples

    See lecture. Find the solutions to the following 1st order ODEs

    1) 2) , k= constant, givenx(t0) = 1exdy

    dx= 1 +y2

    dxdt

    = 3kt2x

    5

  • 8/6/2019 Topic5 ODEs

    6/23

    3) , 4) ,(x2 y2) dx +xy dy = 0 (x2ey/x y2) dx +xy dy = 0given thaty(1) = 0

    (*See p55 onwards of my modern diff equations book*)

    5) If a voltage Vis passed across anR-L circuit the current i flowing through the circuitis given by

    .Ldidt

    + iR = V

    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) 2) 3)x. dydx

    y =y3 tanx. dydx

    =y xy. dydx

    = 1 x2

    4) 5)y x.dy

    dx= a 1 +x2

    dy

    dx3ex tany + (1 ex sec2y).

    dy

    dx= 0

    (*See p49-51 of my modern diff equations book*)

    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

    dx=

    x +yx y

    cannot be separated. But if we make the substitutiony = u.x, where u is a function ofx, then

    .dy

    dx= u +x.

    dudx

    Thus the original ODE becomes

    u +x.

    du

    dx =

    x + ux

    x ux

    which simplifies to

    .dudx

    =1 + u2

    x(1 u)

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

    6

  • 8/6/2019 Topic5 ODEs

    7/23

    Examples

    See lecture. Find the solutions to the following 1st order ODEs (where necessary confirm that they

    are homogeneous equations) :

    1) 2) ,dy

    dx=

    y2

    x2+

    y

    x+ 1 xy

    dy

    dx=y2 x2

    3) , given thaty(1) = 0xydy

    dx=y2 x2ey/x

    (*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 equationsAnother 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

    (1)x2ey = ex

    we would obtain

    (2)

    product rule + implicit diff

    2x.ey +x2eydy

    dx= ex

    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.eydx + x2eydy/dxdx), 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.ey

    x2.eydy

    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.

    7

  • 8/6/2019 Topic5 ODEs

    8/23

    22 . y y xdy

    x e x e edx

    + =

    ( )2 y xd

    x e edx

    =

    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) (siny +y cosx) + (sinx +x cosy)dy

    dx= 0

    2) , giveny(0) = .(x2 cosy 1)dy

    dx= 2x siny

    3) ey/x yx ey/x + 1

    1 +x2+ ey/x dy

    dx= 0

    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

    dx+ 5y = e2x

    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

    .e5xdy

    dx+ 5e5xy = e5xe2x

    8

  • 8/6/2019 Topic5 ODEs

    9/23

    Looking carefully at the LHS of the ODE we should now see that it is the exact derivative ofye5x.

    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

    ,e5xy = e3x 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

    (1.3.1)

    dy

    dx + P(x).y = Q(x)

    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 factorI(x), multiply the ODE by it :

    , (1.3.2)I.dy

    dx+I.P.y =I.Q

    whereI, P, Q are all functions ofx. The LHS of this ODE is now an exact derivative (because we

    have anI(x) which makes it so) and we integrate it directly as

    . (1.3.3)I.y = I.Q dx

    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.dy

    dx+I.P.y =I.

    dy

    dx+y.

    dIdx

    This expression simplifies to

    ,I.P = dIdx

    which can easily be solved by separation of variables to give

    .lnI= P dx

    This then gives the integrating factor

    I(x) = .e P(x) dx

    9

  • 8/6/2019 Topic5 ODEs

    10/23

    This is then the expression we need, and we can now use it to multiply the ODE. Hence we obtain

    e P(x) dxdy

    dx+ e P(x) dx.p(x).y = e P(x) dx.Q(x)

    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 kis the constant of integration.

    Examples

    See lecture. Find the general solution to the following 1st order ODEs :

    i) ii)dy

    dx+ 2xy =x

    dy

    dx+

    yx = e

    x

    iii) iv)1

    sinx

    dy

    dxy = cosx

    dy

    dx

    4xx2 + 1

    y = (1 +x2 )3ex

    Find the particular solution to the following 1st order ODEs :

    i) , giveny(0) = 1.cotx.dy

    dx+y = cotx.sin2x

    ii) , where a, kare constants, given that whenx = 0dy

    dx ky = a.sinx y =

    a1 + k2

    iii) , given that y(0) = 7dy

    dx+ 5x4y =x4

    Exercises

    See exercise sheet (*exercises off my handwritten notes, + P80 and selected from p83-85 of

    modern diff eqns book*)

    10

  • 8/6/2019 Topic5 ODEs

    11/23

    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.ex2 dy

    dx+ ex

    2

    .y + 2x2ex2

    y =x.ex2

    The left hand side of the ODE happens to be the exact derivative of the expression . This canx.ex2y

    easily be seen by differentiating using the product rule twice. On the other hand, in order tox.ex2y

    find as the exact derivative of the ODE we again look for those function in the left hand sidex.ex2y

    which are differentiated and/or undifferentiated. Hence

    i) in the first term , the term dy/dx is clearly the differentiated part, so isx.ex2 dy

    dxx.ex

    2

    the undifferentiated part;

    ii) in the second term , the terms y and are clearly undifferentiated, so the xex2.y ex

    2

    present in the first term must have been differentiated;

    iii) finally, in the third term , the termy is clearly undifferentiated. Knowing2x2ex2y

    that an x already exists as part of the term, the remaining term 2x must have come

    from differentiating .ex2

    Given that we have now accounted for all the separate function, namely the undifferentiated and

    differentiated versions ofx, and y, we can say that the left hand side of the ODE is an exactex2

    derivative and we can integrate this directly to give

    .x.ex2

    y = x.ex2 dx

    From this we obtain the final general solution to be

    ,y =1x (Ce

    x2 12

    )

    where Cis the constant of integration. Consider now the 1st order ODE

    .dy

    dx+

    yx + 2xy =x.e

    x2

    Here the left hand side is not an exact derivative, so we need to find an integrating factor whichmakes it so. The integrating factor for this ODE happens to be . Multiplying the ODE by thisx.ex

    2

    integrating factor will then transform the left hand side into an exact derivative (check this).

    11

  • 8/6/2019 Topic5 ODEs

    12/23

    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 , wherephp(x) and qhy +p.y = q.yn

    q(x) are functions ofx, when n = 0 (by integrating factor) and when nm 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 :

    , (1.4.2)dy

    dx= r(x) +p(x).y + q(x).y2

    where r(x) ! 0 (why ?) and where q(x) ! 0 (why ?). This ODE is called theRiccati equation (JacopoRiccati, 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

    this we will use the transformation , where u h u(x) (i.e. u is a function ofx) is ay = 1

    qududx

    continuous and differentiable function. We will then substitute this into (1.4.2) which should thensimplify 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 y = 1

    qududx

    implies thatdy

    dx=

    ddx

    1qududx

    (1.4.3)= 1qu u + 1

    qu2(u )

    2+

    q

    q2uu

    Substituting (1.4.3) into (1.4.2) gives

    .1

    qu u +

    1qu2

    (u )2

    +q

    q2uu = r+p

    u qu + q

    (u )2

    q2u2

    Now, notice how the terms in cancel left and right. This is exactly what we wanted : No(u )2

    squared terms, and that is why we chose the transformation .y = u/(qu)

    12

  • 8/6/2019 Topic5 ODEs

    13/23

    The above ODE therefore simplifies to

    ,1qu u

    +q

    q2uu = r+p

    u

    qu

    i.e. , (1.4.4)qu

    + (pq q

    )u

    + rq2u = 0

    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) ; y1 =x.y =y2 + (1 2x)y +x2 x + 1

    2) ; y1 = 1.y

    =xy2

    + (1 2x)y +x 1

    3) ; u1 =x.u (1 2x2) =xu + u2

    4) ; v1 = 1 x.v = (x + v)(x + v 2)

    5) ; x1 = t.x xt =x

    3(y x)2

    6) ; y1 = 1.y = (y 1)(y + 1/x)

    7) ; x1 = et.x = etx2 +x et

    8) Guess a very simple solution to . Use this solution to find the generaly = (1 2t) + ty2 + t 1solution to this ODE. (*y1 = 1*)

    13

  • 8/6/2019 Topic5 ODEs

    14/23

    1.5 : 2nd Order ODEs : Homogeneous Equations With Constant Coefficients

    Second order ODEs are equations containing second derivatives, i.e. equations containing d2y/dx2

    or , or other similar 2nd derivatives. Such ODEs may also contain 1st derivatives as well,d2x/dt2

    but not necessarily so. We then wish to solve such equations fory orx. Two methods we shall study

    for solving second order ODEs will be those relating to

    i) use of auxiliary equation for solving homogeneous 2nd order ODEs,

    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.

    The most general type of 2nd order ODE is

    , (1.5.1)a(x).d2y

    dx2+ b(x).

    dy

    dx+ c(x).y =f(x)

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

    . (1.5.2)a.d2y

    dx2+ b.

    dy

    dx+ c.y =f(x)

    where . We will deal with the solutions to (1.5.2) in two steps : we will first consider howa, b, c c to solve the ODE whenf(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) whenf(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 . This type of ODE is called a homogeneous ODE. To see how to solve it let usa, b, c c consider an actual example : Let us try to derive the general solution to

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

    . (1.5.3)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

    ory + 1y + 4y + 6y = 0 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

  • 8/6/2019 Topic5 ODEs

    15/23

    Since we can write the above asd2y

    dx2h

    ddx

    dy

    dx

    ddx

    dy

    dx+ 2y = 3

    dy

    dx+ 2y

    For convenience we can replace dy/dx + 2y byz. We then end up with

    dzdx

    = 3z

    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

    whereA is a constant and is equal to e

    k

    (here, kis the usual constant of integration). But sincez =dy/dx + 2y we now need to solve

    .dy

    dx+ 2y =A.e3x

    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

    be a 2nd order homogeneous ODE which has two real and distinct rootsand.ay

    + by

    + cy = 0Then the ODE can be written as

    .y ( +)y + y = 0Some basic algebra gives

    .y y = (y y)

    which becomes

    .ddx

    (y y) = (y y)

    Letting we transform our ODE intoz =y y

    .dzdx

    = z

    Solving by separation of variables we have

    ,z =Bex

    whereB is the constant of integration. But since z is itself an differential equation we have to now

    solve

    .dy

    dx y =Bex

    15

  • 8/6/2019 Topic5 ODEs

    16/23

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

    , (1.5.4)y =Aex +Bex

    where are constants of integration whose values can be found once we are given someA,B c

    extra information.

    We now notice how, in general, the solution to is like solving a quadratic withay + by + cy = 0

    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,

    ii) solve the auxiliary/characteristic equation to find the roots and ,

    iii) use the relevant general solution depending on the type of roots we have, in this case

    .y =Aex +Bex

    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) , 2) .y + 11y + 24y = 0 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 variabley at two end points ofx, for exampley

    = 0 whenx = 0, andy = 10 whenx = 1.

    Initial Conditions

    Here we specify the value of the dependent variable y and the derivative dy/dx at a starting

    point ofx, for exampley = 0 whenx = 0, and dy/dx = 0 whenx = 0.

    16

  • 8/6/2019 Topic5 ODEs

    17/23

    From the previous section we know that the general solution to is given by y =y + 5y + 6y = 0A.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 : 2 =A +B

    y(0.075) = 1.66 : 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) when and3y + 2y 8y = 0 y(0) = 6 y(0) = 182) when and4y 5y = 0 y(2) = 0 y(2) = 7

    1.5.3 : General solution to the 2nd order homogeneous ODE : Real and equal roots

    Similarly we can derive the solution to when its characteristic equation has realay + by + cy = 0and 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 when its characteristic equation has real and equalay + by + cy = 0roots.

    Therefore, let be a 2nd order homogeneous ODE which has two real and equalay + by + cy = 0

    roots. Then the ODE can be written as

    .y 2y + 2y = 0Some basic algebra gives

    .y y = (y y)

    which becomes

    .ddx

    (y y) = (y y)

    Letting we transform our ODE intoz =y

    y

    .dzdx

    = .z

    Solving by separation of variables we have

    ,z =Aex

    whereA is the constant of integration.

    17

  • 8/6/2019 Topic5 ODEs

    18/23

    But sincez is itself an differential equation we have to now solve

    .dy

    dx y =Aex

    This can be done using the integrating factor method with P(x) = . In this case we have

    I.F. = e dx = ex

    Multiplying our 1st order ODE above with this I.F. we obtain

    .ex.dy

    dx .ex.y =A

    The left hand side is now an exact derivative which integrates directly to . Hence the equationy.ex

    above becomes

    y.ex = A dx

    =A.x +B

    The general solution then becomes

    (1.5.5)y = ex(Ax +B)

    where are constants of integration whose values can be found once we are given someA,B c 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,

    ii) solve the auxiliary/characteristic equation to find the double roots and ,

    iii) use the relevant general solution :

    ,y = ex(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) when andy 4y + 4y = 0 y(0) = 12 y(0) = 32) when and .16y 40y + 25y = 0 y(0) = 3 y(0) =

    94

    3) when and .y + 14y + 49y = 0 y(4) = 1 y(4) = 5

    18

  • 8/6/2019 Topic5 ODEs

    19/23

    1.5.4 : General solution to the 2nd order homogeneous ODE : Complex roots

    We can also derive the solution to when its characteristic equation has complexay + by + cy = 0

    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 we might as well just use the general solution foray + by + cy = 0distinct roots. Hence

    y =Ae(+i)x +Be(i)x

    =Aexeix +Bexeix

    .= ex(Aeix +Beix )

    Now it can be shown (using Taylor series on ex, sinx and cosx) that . Substitutingeix = cosx + i sinxit into the above expression we obtain

    ,y = ex(A(cosx + i sinx) +B(cosx i sinx))

    which simplifies to

    ,y = ex(Dcosx + iEsinx)

    whereD = A + B andE = A B. Now, although this solution is complex it doesnt always have to

    be so. For example, if we letA = 1 + i andB = 1 i then

    D = 1 + i + 1 i = 2 and iE= i(1 + i 1 +i) = 2i2 = 2

    SoD andEcan be real. We will therefore only deal with solution which have real coefficients, andthe general solution to the ODE when its characteristic equation has complex roots is

    . (1.5.6)y = ex(A cosx +Bsinx)

    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,

    ii) solve the auxiliary/characteristic equation to find the complex roots !i,

    iii) use the relevant general solution :

    ,y = ex(A cosx +Bsinx)

    iv) find the particular solution as necessary using the relevant ICs or Bcs.

    19

  • 8/6/2019 Topic5 ODEs

    20/23

    Examples

    See lecture. Find the particular solutions to the following 2nd order homogeneous ODEs

    1) when andy 4y + 9y = 0 y(0) = 0 y(0) = 8

    2) when andy 8y + 17y = 0 y(0) = 4 y(0) = 1

    3) when and4y + 24y + 37y = 0 y() = 1 y() = 0

    In summary, to solve homogeneous 2nd order ODEs with constant coefficients we perform the

    following three steps :

    i) Replace the ODE by an equivalent quadratic called the characteristic equation.

    ii) Solve the characteristic equation (as you would any quadratic) to obtain two roots.

    iii) Substitute your answers to ii) into the relevant standard general solution :

    a) for two real and distinctroots 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 . We need, somehow, to find a way of solving this type of ODE.f(x) ! 0

    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 = e5x

    we would first begin by solving

    y + 5y + 6y = 0

    to obtainA.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 functionf(x).

    20

  • 8/6/2019 Topic5 ODEs

    21/23

    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 isa.y + b.y + c.y = 0

    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 . In other words we need to find ana.y + b.y + c.y =f(x)

    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 = e5x

    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 ofe5x, in other words k.e5x,

    where kis 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 ofe5x 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 . What value ofky + 5y + 6y = e5x

    is necessary in order to obtain e5x

    of the RHS ? To find this, substitute into the ODE :

    .(25k.e5x ) + 5(5k.e5x ) + 6(k.ex ) = e5x

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

    y + 5y + 6y = e5x

    is .y =156 e

    5x

    iii) finally, find the actual general solution to we add the twoy + 5y + 6y = e5x

    previous solutions, i.e. we add the complementary function and the particular

    integral :

    G.S. : y =A.e2x +B.e3x +1

    56 e5x

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

    21

  • 8/6/2019 Topic5 ODEs

    22/23

    But .... I hear you cry. No need to panic I say. The guesses you will need to make for the RHS

    functionf(x) are listed in the table below :

    A.sinpx +B.cospxcospx

    A.sinpx +B.cospxsinpx

    y = k.epxthe exponential function epx

    y = ax2 + bx + cquadratic

    y = ax + blinear

    y = kconstant

    ... choose your trial function to beIf the RHS of the ODE is ...

    Examples

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

    i) ii) , giveny(0) = 5/2,y + 5y + 6y = 24 y + 4y + 5y = 13ex

    andy(0) = 1/2

    iii) iv) , givenx = 0 when t= 04i + 8i + 4i = v.cos t x = x + 1given that i(0) = 0 and when t= ax = uand i(0) = 0

    Exercises

    See handouts. Also, find the general/particular solution to the 2nd order inhomogeneous ODEs

    below :

    i) ii) , giveny(0) = 0,y + 3y +y = 4x2 2x 5x + 3x = 10et

    andx(0) = 0

    iii) iv)y 7y + 10y = 2ex 3y +y 5y = ex +x

    1.6.2 : Breakdown caseConsider finding the general solution to

    .2y +y y = ex

    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(kex) + (kex ) kex = ex

    Hence 0 = ex?

    What is going on here ? See lecture.

    22

  • 8/6/2019 Topic5 ODEs

    23/23

    Examples

    See lecture.

    Exercises

    See exercise sheet.

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

    See separate handouts