## Wednesday, June 29, 2011

### 8.2 – Second Order Linear Differential Equations

In this section, we will be learning how to solve second order linear differential equations, both homogeneous and non-homogeneous.

HOMOGENEOUS CASE
A second order homogeneous linear differential equation has the form

where a, b and c are constants. We first give a smart guess (ansatz) that the solution has the form y = Aenx, where A is a constant, and n is an integer. Differentiating it yields

and once we substitute all equations into the differential equation, and eliminating Aenx, we get a quadratic equation of the form

which we call as the auxiliary equation. From here we can see that y = Aenx is indeed a solution for the 2nd order differential equation, provided that the value of n satisfies this equation. Once we find the values of n, we can thus write down the general solution of the differential equation.

However, the equation will give you 3 outcomes, which is either it has 2 distinct roots, 2 equal roots or 2 complex roots.

Case 1: 2 Distinct Roots
In this case, suppose the auxiliary equation gives you 2 roots n1 and n2. your answer for y will be in the form of

Remember that your initial guessed solution for the differential equation was y = Aenx? Notice that if y = Aenx and y = Bemx both are solutions of the the differential equation, then the sum of both the solutions, y = Aenx + Bemx is also a solution for the differential solution. That is why, our solution for y is the sum of both solutions. You may want to prove it. Given the differential equation

You find the auxiliary equation to have the values n = –1, –2 respectively. Do try substituting y = Ae-x, y = Ae-2x and y = Ae-x + Be-2x into the equation. All of them are consistent, aren’t they?

Case 2: 2 Equal Roots
Suppose your auxiliary equation gives you only one value of n. Your answer will be in the form of

When there is a repeated root, you multiply it by x. Try recalling the connection of this chapter with what you learnt in the chapter Recurrence Relations.

Case 3: Complex Roots
Suppose you get 2 complex roots, m + in and m – in. Your answer will then be in the form of

Notice the second line of the equation. Remember the fact that
e(m+in)x = emx(cos nx + i sin nx), and you get y = emx[ (A + B)cos nx + i(A – B)sin nx ], in which you represent the terms (A + B) and i(A – B) as C and D respectively. You will be surprised that D is actually a real constant, so somewhere on the way, A and B must have been complex.

As I said, these are the forms of general solutions that you can get. To get a particular solution, you need to have an initial condition, something like when y = 1, x = 0 or so. The particular solution eliminates the constants ABCD, and gives them in terms of real numbers instead.

NON-HOMOGENEOUS CASE

A second order non-homogeneous linear differential equation has the form

Again, a, b and c are constants, and f(x)  is a function of x, which is either a polynomial, a constant, an exponential function, a cosine or sine function, or a combination of any 2. Functions like tan x, sinh x or ln x will be out of your syllabus, in which the solving of these kinds of differential equations will require the Method of Variation of Parameters. Try google for it if you want to know more.

The solving method is easy. First you separate the differential equation into 2 parts. You let the first part = 0,

and this is solved just as above, by finding the auxiliary equation and then representing the answer in the form of y = g(x) = Aenx + Bemx. This solution is called as the complementary function (CF). The other part f(x) will have the solution y = h(x), which is called as the particular integral (PI). Remember that the sum of solutions is also a solution, so our final answer will be
y = g(x) + h(x)

Since you already know what to do with the CF, we will introduce methods to solve the PI below, which depends on what h(x) is.

Case 1: h(x) is a Polynomial Function
You should just substitute the PI as a polynomial function. For example,

You already know the CF from above, which is y = Ae-x + Be-2x. Then to find the PI, you let
y = Ax2 + Bx + C, according to the degree of the polynomial. Differentiating, you get

Substituting it back, we get 2A + 3(2Ax + B) + 2(Ax2 + Bx + C) = x2 + 4x –3. Solving for ABC, you get A = 1/2, B = 1/2, C = –11/2. So in the end, our PI is

and the general solution, being the sum of the CF and the PI will be

Try not to get confused with the constants of the CF and the PI, in which here, I have 2 A’s and 2 B’s. I would suggest you that you should name the constants for the PI as C, D and E instead. This rule applies for any polynomial of degree n. However, there is an exception, when your auxiliary equation has a root n = 0. Since Ae0 = A, you already have a constant term in the CF. So for your PI, you need to multiply your solution with an extra x. So if your
f(x) is 4x + 3, your PI should be Bx2 + Cx instead of Bx + C. Similarly, you can guess that if the CF has a double root n = 0, you will then multiply your PI with x2. Try relating this information with the chapter on Recurrence Relations.

Case 2: h(x) is an Exponential Function
This is easy. If f(x) = 5e2x, our PI will be just y = Ce2x. Just differentiate y to get dy/dx and d2y/dx2, substitute it into the equation, and find A. Again in this case, there are exceptions. If your CF already has a term Ae2x, then like the above, you multiply x in front of the PI to give you  y = Cxe2x. If your CF is y = Ae2x + Bxe2x, then your PI will be y = Cx2e2x, multiplying x2 this time. Not hard I think. If you are given

Your CF is the same, y = Ae-x + Be-2x. Your PI will be y = Cex + Dxe-2x, and you should further solve the equation yourself.

Case 3: h(x) is a Cosine or Sine Function
If f(x) = 5sin 2x, or f(x) = 4cos 2x, or f(x) = 6sin 2x + 7cos 2x, your PI will be the same, which is y = Ccos 2x + Dsin 2x. Notice that whether you have only sines or only cosines, you still have to come up with both cosines and sines for your PI. The reason is simple, if you only come up with one of them, your solution is not solvable. Again, there is an exception, which is when your auxiliary equation might have totally imaginary roots, which happens to give your CF a sine or cosine function of the same form. As usual, just multiply an x in front of your PI. For example,

You get an auxiliary equation of n = ±4i, CF of y = A cos 4x + B sin 4x. So, your PI should be in the form of y = Cxcos 4x + Dxsin 4x. Differentiate it (might be complicated), substitute it, find constants C and D, and give the general solution by adding the PI and CF. Should be straight forward.

Combinations of functions, like f(x) = x cos 3x, f(x) = xe4x, f(x) = e4xsin 3x shouldn’t be hard for you to solve. The basic rule is if your CF already has a solution with the same form as f(x), then just multiply x to that term. If it doesn’t work, multiply x2 then.

SUBSTITUTION

If you could recall what you learned in Maths T, you have already learned how to use the substitutions v = ax + by and y = vx to transform a complicated-looking differential equation into one that is solvable. You can apply those skills in 2nd order differential equations too. Other kinds of substitution include x = u0.5, u = xy, but I want your attention on solving differential equations of the form

You need to use the substitution

From here, find dy/dx and d2y/dx2 by using the chain rule.

Which in the end, gives you a differential equation of the form

which is solvable.

PROBLEM MODELLING

Seriously, I have looked through many books, but none of them really teach us about modelling for 2nd order differential equations. You should be familiar with modelling of 1st order differential equations though. So here, I have no choice but to introduce to you some university level stuff.

1. LRC Circuits
The potential differences of an inductor, a resistor and a capacitor are denoted by

So this means that the total voltage across the 3 elements put in series is equals to

I assume you know that L, R, C, and Q means inductance, resistance, capacitance and charge respectively. Here we see that the voltage V is a function of time, which makes it a non-homogeneous 2nd order linear differential equation. Solving the differential equation means finding an equation which relates the charge to time.

2. Oscillators
Remember in physics that a simple harmonic oscillator has the equation of
mẍ  + kx = 0
where m is the mass, and k is the spring constant. Notice that this is a 2nd order differential equation! Solving this makes you find x in terms of t. A damped oscillator has an extra term in it,
mẍ + bẋ + kx = 0
where b is the drag constant. A forced oscillator, in turn would be
mẍ  + kx = F(t)
where the force F is a function of time, probably a sine or cosine function. You could have guessed it, that a forced damped oscillator would be
mẍ + bẋ + kx = F(t)
With these information, you are able to model a second order differential equation once you know all the factors m, b, k and F.

There are a whole lot more of physics equations which requires differential equations, like the famous Schrödinger’s Equation and other higher level stuff, which requires higher level physics. I better stop here before I turn this into a physics lecture instead.

This chapter really isn’t hard to understand, and neither too hard to solve. The only problem is that you can get careless and make mistakes. I got a B+ last time for my Further Mathematics T paper 1 because I made a silly mistake in a question on Differential Equations, and it was 12 marks gone! Now that you know everything about differential equations, hope you will be more confident in exams.

## Monday, June 27, 2011

### 8.1 – First Order Linear Differential Equations

In Maths T, you learnt how to solve 2 types of differential equations, namely the separable variable and the homogeneous differential equations. In FMT, you will learn how to solve linear differential equations.

A differential equation is linear if it is of the form

where a is a function of x. It can be solved by introducing an Integrating Factor, e ∫ a dx.  This term is multiplied to the left and right of the equation, then we will get

integrating both sides, we get

Which is an expression of y in terms of x. This method is very simple, let me give you an example:

Find the general solution of the differential equation

We start by expressing it in the form

Which is

Now that we know the a, we can find the integrating factor,

Note that the integration in the integrating factor doesn’t need a constant, because it will eventually cancel out later. So multiplying it both sides,

Probably one of the easiest sections, so don’t make mistakes. Notice that the x is not handed over before the integration is done. A common mistake is that you tend to forget to multiply the integrating factor to the right hand side. So be extra careful in calculations. This is the general solution, and the particular solution can be found if more details are given (for example when y = 1, x = 1). Practise.

### 7.2 – Taylor Series

Generally, Taylor series has a lot of uses. We can use it to do one of the following:

A. DERIVE A GIVEN FUNCTION

You were given a list of Maclaurin series in the last section. Now I show them to you again below:

These are not all though. You can still find and derive the Taylor or Maclaurin series of other functions like sin-1 x, coth-1 x or lg x2. The method is the same, by listing down the Taylor or Maclaurin series of the functions. For example,
sin-1 x = a + bx + cx2 + dx3 + ex4 + …

and you substitute x = 0 to get a. To get b, you differentiate once and substitute x = 0, and c, differentiate twice, and etc. The coefficients a, b, c and so on might not have a certain order like the functions listed above, but at least you have a reasonable polynomial to estimate the function in the absence of a calculator.

Besides, you could also combine more than 2 functions to find a new Taylor series for them. For example, (1 + x)2 cos x can be derived from

Adding and subtracting of functions (like sin x + cos x) or even substitution of variables (like e8x or sin x2) can be easily derived too.

B. DIFFERENTIATE AND INTEGRATE THE SERIES TO GET OTHER RESULTS

Did you notice that the laws of calculus also obeys the rules of power series? Taking cos x for an example, differentiating both sides, gives

This is a very useful information. You can speed up the calculations if you were asked to derive the series of a function which relates to on of the known functions above. By the way, if you were able to find the listing of the polynomials, you would want to learn how to find the summation notation of the derived series as well. Read through your Maths T Sequence & Series, and try to make use of the knowledge you learn there.

C. FINDING LIMITS OF FUNCTIONS

When you are asked to find the limit of a complicated function as x → 0, you can actually make use of the Maclaurin series of the function. For example,

To help you, you might want to learn L’Hôpital’s rule as well. This rule comes really handy in this situation, it states that if f(a) = 0, g(a) = 0, and g’(a) ≠ 0, then

Use this rule when you get a 0/0 results. Remember that this rule only holds if the f(a) = 0 thingy is true.

D. SOLVING DIFFERENTIAL EQUATIONS NUMERICALLY

I believe you already know what are differential equations, just that you only know how to solve a little of them. So here, we are trying to estimate and represent a set of differential equations as a Taylor series, and thus try to estimate the function for values x close to a, when expanded at x = a. I’ll show you an example:

Find the Taylor’s series solution for y up to and including terms in x4 for the differential equation

Hence, find y correct to 9 d.p. when x = 0.01.

That’s all for this chapter. Still remember the derivations of Poisson Distribution? You probably could explain to your friends now using your knowledge on Power Series.

## Friday, June 24, 2011

### 7.1 – Taylor Polynomial

A power series is an expression of a function as a sum of infinite polynomials. Every differentiable function f(x) can somehow be approximated by a series of polynomials, such that f(x) = a + b(x-x0) + c(x-x0)2 + d(x-x0)3 + e(x-x0)4 + … + f(x-x0)n

When x is close to x0, and where a f are constants. If you remembered the Binomial Expansion for real numbers, the function (1+x)r can be represented by the series

Compare the Binomial Series above with the formula for f(x). You see that it is just a special case of the above function, such that x0 is zero, and the constants are defined in a special relation.

Our question is this: Since we could represent the above bracketed polynomial function as an infinite series of polynomials, so is it possible that we represent other functions, like sin x, ln x, ex or anything else? If it is doable, how do we determine the constants a, b, c and so on as in the function f(x) above?

Before we get into our topic Taylor polynomials, let me introduce to you Taylor’s Theorem with Remainder. The theorem states that if a certain function f(x) is (n+1)-times differentiable, then

Let me explain this a little. The term a is used when we measure the f(x) close to it. For example, when a = 0, we substitute it into the series, and the new expression will be  definitely quite accurate for estimating values x which are close to a (of course, for certain functions, the value x is accurate for whatever value a. We’ll discuss this in the later section). This means, we vary a to approximate the different values of the same function.

Then, the term f’(a), f’’(a) are the 1st and 2nd derivatives of the function f(x). Note that the term f(n)(x), the ‘n’ has a bracket, to tell us that it is not the ‘nth power of f’, but the nth derivative of f. The entire series is what we called as Taylor series. All those terms between the equal sign and the Rn are called as the Taylor polynomial, and sometimes we denote this whole chunk of polynomial as pn(x). Writing the whole equation in another form, we have

Now, the term Rn(x) is what we call as the remainder term. Since the Taylor series is an infinite series, we won’t possibly write down all the terms of the series. So sometimes we just set our limits, for example, we want the series corrected till the 6th order. So in this case, we see that Rn(x) is the difference between f(x) and the sum of its first 6 polynomials.

The remainder term, could also be written as

I’ll try to give you an illustration to make you understand how this Taylor Series thingy work. By the way, we are not required to prove the formula for Taylor series. For an example, take the function

Using Taylor’s Theorem, we find the Taylor series expanded at x = 0 (which means, a = 0) for this function. By the way, there is a special name for the Taylor series expanded at x = 0, which is named Maclaurin Series. We find f’(x), f’’(x) and so on, substituting them into the formula, we get
f(x) = x + x2 + x3 + x4 + …

Notice that this function could be expanded by binomial expansion, which is faster. Now look at the graph below.

Notice that the blue line sketches the exact graph of the function f(x). As I said earlier, the Taylor series is only an estimation. This means that, the more Taylor polynomial terms we keep, the more accurate the Taylor series estimates the function f(x). Look and see that the graph of degree 1, and degree 2 are actually quite far off from representing f(x), but is quite accurate for values of x near 0. As the degree of polynomial increases, the graph of the Taylor series will eventually be the same as the actual function f(x).

So now, we want to learn how to find the series for some functions that we know of. Let’s try ex. Since there can be an infinite amount of Taylor series expanded at any a, we shall focus on deriving the Maclaurin series of functions.

Recalling the formula,

We find that ex will still be itself after infinite derivatives, and e0 = 1. So plugging in what we have to, we get the Maclaurin series

Try finding the Maclaurin expansion for other functions, ln (1 - x), sinh x, and any other functions you can think of. Note that not all Maclaurin series of functions could have such beautiful series. Some might end up with non-ordered coefficients.

Below is a list of common Maclaurin expansions:

I want you to note a few things:
1. There is no Maclaurin expansion for ln x, because ln 0 is not defined.
2. Notice that the Maclaurin expansion similarities for trigonometric and hyperbolic functions. Here you are able to proof the hyperbolic-trigonometric identities, which relates both the functions.
3. Some expansions are either odd or even. In other cases, there might be missing a power as well, so it is normal for a function not to have all the powers of x.

REMAINDER ESTIMATION THEOREM

If a function f(x) can be differentiated n + 1 times on an interval I containing a & if M is an upper bound for fn+1(x) on I, i.e., | f(n+1)(x) | ≤ M,

then

Ignore the alien language first. Continuing from the previous part, the remainder of the series is actually quite significant. When you use a Taylor series to estimate something, you are interested in knowing the error you estimate, or the difference between your estimate and the actual value. If you remembered from the previous section, the remainder is given by the formula

The formula gives the exact error when f(x) is approximated by the nth Taylor sum. The problem is that it is too difficult to evaluate it this way, so we are going to find an overestimate of the remainder instead. We look at the magnitude of the (n + 1)th derivative of f(t) as t varies between a and x, and overestimate that by a single number M (known as upper bound, as stated above). So here, we are saying that the remainder is definitely smaller or equal to the upper bound, and thus the formula above,

This information is important, as we will use it to
1. Estimate the error between the function and the series
2. Approximate a function to n decimal places

I understand that this might be hard for you to catch, so I will give you 2 examples here.

EXAMPLE 1 (ESTIMATE ERROR)
Find the Taylor series of the function ln x expanded at x = 1, to get a cubic approximation, and estimate the error for ln 2.

Have I taught you how to find a Taylor series for a function?
We first list the function in terms of what we are looking for. In this case, since it is expanded at x = 1, so the terms are powers of (x – 1). It will be in terms of x or (x + 5) if it is expanded at x = 0 and x = –5 respectively, so
ln x = a + b(x-1) + c(x-1)2 + d(x-1)3

Now, we need to find the constants a, b, c and d. You can find all of them by substituting x=1, and by differentiating the left and right side of the function. Which means,

which gives you

and then

To go on, we need to use the formula above. To find M, we need to first find f(n+1)(x), which is –6x-4. Remember the part above which says | f(n+1)(x) | ≤ M, we find that the maximum value of –6x-4 is 6 if we use values 1 ≤ x ≤ 2 (interval I containing a), so we have

Thus, ln 2 = 5/6 within ± 1/4.

EXAMPLE 2 (Approximating decimal places)
Use an nth Maclaurin polynomial for ex to approximate e to 5 decimal places accuracy. Find n.

(Note that if you are finding f(n+1)(x) = cosn x or sinn x, then M ≤ 1 instead. Useful information.) Now, the different thing here compared to the previous example is that we don’t know n, so we can’t substitute n for any value (in fact, we are looking for n!). But we do have another piece of information, which is, to 5 decimal places. We take that decimal place, give it a ± 50%, and now the we know that the remainder must be smaller than 0.000005. So we have

By trial and error, we find that n = 9, then the equation holds. Therefore,

To summarize things up, this is what your checklist when you are dealing with such related questions:

STEP 1: Write down the series f(x), f(c) (the function substituted with the value you want),
STEP 2: Find the interval [a, x] (a is what the series is expanded at, and c is within this limit)..
STEP 3: Find M (the upper bound), which is f(n+1)(x) ≤ [something]
STEP 4: Write down the equation
|Rn (x)| ≤ [the equation above]
STEP 5:
If required, write down
[the equation above] ≤ [amount of decimal points ± 50%]
STEP 6:
Continue on the estimation.

So now you know the mystery of how calculators calculate your cos x, sin x and all those weird functions. They all make use of Taylor series.