# 9231. FP2. Differential Equations

What is a differential equation?

What does it mean to solve them? (What is the difference between the general solution and a particular solution)

We can already solve DEs of the for y’=f(y)g(x)

What if we get something like xy’+y=x?

We can’t expect to always find DEs looking like the product rule. What about y’+3y=e-3x?

Any first order DE that is linear in y can be rewritten as y’+f(x)y=g(x).

We want the LHS to be in the form: u’v+uv’. To get it in this form we simply need to multiply through the whole equation by the integrating factor I(x)=e∫f(x)dx

Why does it work?

• y’+f(x)y=g(x)
• => I.y’ +f(x).I.y = I.g(x)
• By picking I = e∫f(x)dx, we have I’=f(x).I,
• => (1/I).I’=f(x)
• => ∫1/I dI = ∫f(x) dx
• => ln(I)= ∫f(x) dx
• => I=e∫f(x) dx

This method was developed by Leonard Euler around 1730 (the separating variables method had previously been developed by his teacher, Johann Bernoulli).

Worked Examples

• Find the general solution of the differential equation: $cos(x) \frac{dy}{dx} - sin(x)y = x^2$
• Find the general solution of the differential equation: $\frac{dy}{dx} + \frac{2}{x} y = \frac{4}{x^2}$ for x≠0
• Solve the differential equation $x \frac{dy}{dx} + 2y = \frac{4}{x}$ for x≠0
• Find the particular solution of $x^2 \frac{dy}{dx} + xy = \frac {2}{x}$ that satisfies the condition y=1 when x=2.

Exercise

Second Order ODEs

Consider ay’’+by’+cy=0

It is a linear combination of multiples of a function, its first derivative and its second derivative.

For these terms to all cancel out, we need a function whose first derivative and second derivative has the same form as the function itself.  Which functions are suitable?

Putting in suitable constants, we take the function: y=Aetx

So y’=Atetx and y’’=At2etx

So ay’’+by’+cy = aAt2etx+bAtetx+cAetx = 0

Notice that Aetx factors out, so we have at2+bt+c=0.  We call this the auxiliary equation for the ODE and its solutions give us the ODE’s solutions

How many solutions can there be to the auxiliary equation at2+bt+c=0?

• Suppose there are two solutions, t1 and t2. Then both the solutions y=Aet1x and y=Bet1x (for arbitrary constants A and B) are solutions to the ODE.  We can say in general that the linear combination of these: y=Aet1x + Bet1x is the general solution to the ODE.
• Suppose there is one repeated solution, t0. Then y=(A+Bx)et0x is the general solution to the ODE.

Why is the solution in this form?

Consider y’’-4y’+4y=0, with AE: (t-2)2=0.

Clearly y=Ae2x is one solution. We know there should be another solution (and another arbitrary constant, so we can write y=f(x)e2x and try to find out the function f(x))

• y = fe2x
• => y’= f’e2x+2fe2x
• => y’’=f’’e2x+2f’e2x+2f’e2x+4fe2x = f’’e2x+4f’e2x+4fe2x
• If we substitute these into our ODE, y’’-4y’+4y=0, we get:
• y’’-4y’+4y=0
• (f’’e2x+4f’e2x+4fe2x) – 4(f’e2x+2fe2x  )+4fe2x =0
• =>f’’=0
• => f’=c
• => f=cx+b.   Which is why we use this form
• This method was derived by D’Alembert around 1750.

But what if the solution is complex?

Then y=Ae(a+bi)x+Be(a-bi)x

So y=eax(Ae(bi)x+Be(-bi)x)

y=eax(Ae(bi)x+Be(-bi)x)

We can simplify this using Euler’s Formula: eix=cosx+isinx

So y=eax(Aeb(cosx+isinx)+Beb(cosx-isinx))

Gathering the cosines and sines together, we have: y=eax((cosx(Aeb+Be-b)+sinx(Aebi-Be-bi))

Which is simply y=eax(Pcosx+Qsinx)

So, in general, we use the ODE to form the auxiliary equation and solve the auxiliary equation to find the general solution from the above.

We can then use initial conditions or boundary conditions to find out the particular solution (i.e. without any arbitrary constants)

Worked Examples

• Find the particular solution of $\frac{d^2y}{dx^2} + 4 \frac{dy}{dx} + 3y = 0$ subject to the conditions y=0 and $\frac{dy}{dx}=1$ when x=0
• Find the particular solution of the equation $\frac{d^2z}{dt^2} +6 \frac{dz}{dt} + 9z = 0$ subject to the conditions z = 0 and $\frac{dz}{dt} = 5$ when t=0
• Find the particular solution of the differential equation $\frac{d^2y}{dx^2} + 2 \frac{dy}{dx} + 5y = 0$ which satisfies the initial conditions y=0 and $\frac{dy}{dx}=1$ when x=0

Exercise

Homegeniety

Have you noticed that for all of our second order differential equations, the right hand side of the equation was equal to zero?

What should we do if this isn’t the case? i.e. if the equation is non-homogenous?

First we should note that adding the general solution to the related homogenous equation to our solution will not change the solution (because it gives zero when put in the equation).

So our general solution to a non-homogenous equation will be of the form GS=CF+PI, where the solution to the related non-homogenous equation is called the complementary function.

We find the particular integral relevant to the RHS of the equation by using a trial function, which is essentially a guess at the solution in the correct form, with constants in to be determined.

How to find the Particular Integral

Note that we need both trigonometric functions in our trial function because of the way differentiation cycles through these functions.

Special cases

In some differential equations the function on the right-hand-side has the same form as one of the complementary functions. For example, the complementary function of the differential equation $\frac{d^2y}{dx^2} - 5 \frac{dy}{dx} + 6y = 4e^{3x}$ is $Ae^{2x} + Be^{3x}$ and e3x occurs on the right hand side. In this situation it is no good using the trial function ae3x, since upon substituting y=ae3x, $\frac{dy}{dx} = 3ae^{3x}$ and $\frac {d^2y}{dx^2} = 9ae^{3x}$ into the differential equation, you obtain 9ae3x-5(3ae3x)+6(ae3x)=4e3x => 0=4e3x and so clearly this trial function doesn’t work. Instead we use $axe^{3x}$as a trial function.

This illustrates a general rule. If the function on the right-hand-side of the differential equation has exactly the same form as one of the complementary functions, you multiply the usual trial function by the independent variable to give a new trial function. In order to recognise these special cases when they arise, it is worth getting into the habit of finding the complementary function before the particular integral.

Worked Example

• Find the particular integral of the differential equation $\frac{d^2z}{dt^2} - 2 \frac{dz}{dt} - 3z = 6cos(3t)$;
• Find the general solution of the differential equation $\frac{d^2y}{dx^2} - 2 \frac{dy}{dx} -3y = 6x-2$

Exercise (Do questions 1-3 and 5-9)

Solutions

Substitution methods for ODEs. Form: f(y/x)

If an ODE is of the form y’=f(y/x) we can use the substitution y=ux, which replaces y/x with u and y’ with u’x+x, giving an equation in separable form.

Worked Example

Solve the differential equation $\frac{dy}{dx} = \frac{y^2+2xy}{x^2}$

Substitution methods for second order ODEs

We can often use a substitution u=yx (where y is a function of x, to simplify a second order ODE (exam questions may give a specific alternate substitution).

If u=yx, then u’ = y’x+y and u’’=y’’x+2y’. We can rearrange these to put y in terms of u before substitution into an equation.

Worked Example

Solve xy’’+2(1-x)y’-(2+3x)y=e2x, by using the substitution u=yx

Substitutions which introduce a new variable

We can solve x2y’’+4xy’+2y=lnx by introducing x=et

Then we use the fact that $\frac{dy}{dx} = \frac{dy}{dt} \frac{dt}{dx}$

And that $\frac{d^2y}{dx^2} = \frac{d}{dx}(\frac{dy}{dx}) = \frac{d}{dt}(\frac{dy}{dx}). \frac{dt}{dx}$

Exercise

Notes for exams

With substitutions suggested in an exam, there is normally one way to have the substitution that is easier to differentiate (normally it is given in this form).  After differentiating it the easy way, algebra can be used to rearrange it into the form needed to substitute.

General Exercise