Series Solutions to Differential Equations

Pre-requisites:

  1. Ability to represent at least one function by a power series, such as 1/(1-x)=1+x+x2+..., and the idea of an interval of convergence.
  2. Knowing that ex is the solution to d/dx f = f with initial condition f(0)=1.
  3. Knowing that sin(x) is the solution to (d/dx)2 f = -f with initial conditions f(0)=0 f'(0)=1.
  4. Knowing that cos(x) is the solution to (d/dx)2 f = -f with initial conditions f(0)=1 f'(0)=0.

Co-requisite: Knowing what a differential equation is. If you are not familiar with this term, ask your instructor for a brief definition.

Goals:

  1. Learn how to use series to solve differential equations.

  2. Find series representations for ex, sin(x), and cos(x).

Realistic action computer games and flight simulators are just two of the myriad applications that require fast, real-time solutions to differential equations that describe physical processes. Such applications often require a compromise between the speed and accuracy of a solution. Often series are used to provide a quick and sufficiently accurate approximation of the real process.

Series solutions to differential equations can also be used to find series that give solutions to differential equations "from scratch", i.e. we don't need to know the series representation of any particular function before we start, as opposed to the series representation of many functions such as 1/x, 1/(1+x2), ln(x), arctan(x) and others which all can be obtained from the Geometric Series by chain of substitutions or integrations or differentiations.

In this lab we will find series to represent ex, sin(x), and cos(x) since we know differential equations which have these functions as solutions.

For example, ex is the solution to d/dx f = f with initial condition f(0)=1. Hence, if ex is repesented by the series a0+a1x+a2x2+a3x3+a4x4..., then we must have

d/dx(a0+a1x+a2x2+a3x3+a4x4+...)=a0+a1x+a2x2+a3x3+a4x4+...

Which gives
a1+2a2x+3a3x2+4a4x3+...=a0+a1x+a2x2+a3x3+...

Since the coefficients of each power must be the same on both sides of the equation we get:
a1=a0
2a2=a1
3a3=a2
4a4=a3
...
In general, (n)an=an-1.

To find the value of all the coefficients we need to use the initial condition f(0)=1 to find a0. Putting 0 in for x in the series representing f, gives f(0)= a0+a10+a202+a303+a404...=a0. Hence, a0=1.

Since we know the value of a0, we can find the value of a1 which gives us the value of a2 and so on:

a0 = 1
a1 = a0 =1
2a2 = a1 => a2=1/2
3a3 = a2 => a3=(1/3)(1/2)=1/3!
4a4 = a3 => a4=1/4!
...

In general, an=1/n!. Hence we conjecture that ex is represented by the series:
ex=1+x+(1/2)x2+(1/3!)x3+(1/4!)x4+...

The relation above, which gives the value of an in terms of previous coefficents, is called a recursion relation. Such relations occur frequently in mathematics and computer science. For example, they come up when computing run times for loops or recursive algorithms in computer programs.

Copy and paste the code below into Maple and then answer the questions below on a separate paper that you will hand in.



restart: with(plots):

f:= x -> exp(x):                       #the function
n:= 2;                                 #the highest power to use in the partial sum approximation to the function.
PartialSum:=x->sum((1/i!)*(x)i,i=0..n);

fGraph:=plot(f,-2..2,y=-.5..10);
partialGraph:=plot(PartialSum,-2..2,y=-.5..10,color=blue);

display(fGraph,partialGraph);
  1. After pasting this code into Maple, press <enter> (or <return>). When Maple executes the commands, you should see the graph of ex in red and the graph of the nth partial sum of the power series in blue. Try various values for n. As n increases, do the partial sums seem to converge to the function?

  2. Explain how the approximation when n=0 is related to the graph of ex at x=0.

  3. Explain how the approximation when n=1 is related to the graph of ex at x=0.

  4. What is the smallest value of n where the graph of the PartialSum essentially indistinguishable from the graph of ex on the given window of width -2 to 2?

We can similarly find series for sin and cos. These functions satisfy the second order differential equation (d/dx)2 f = -f. Begin, as before, by writing:

f(x)=a0+a1x+a2x2+a3x3+a4x4...
(d/dx)f(x)=a1+2a2x+3a3x2+4a4x3+...
And this time take one more derivative to get:
(d/dx)2f(x)=2a2+(2)(3)a3x+(3)(4)a4x2+...
  1. Since f satisfies (d/dx)2 f = -f,
    2a2+(2)(3)a3x+(3)(4)a4x2+...=-(a0+a1x+a2x2+a3x3+a4x4...).
    Look above where we found the series representation for ex. Look at the part where we set the coefficients of like powers of x equal to get a relation that gives a1 in terms of a0, a2 in terms of a1 and so on. Repeat that technique here to get a2 in terms of a0, a3 in terms of a1, and, in general, the recursion relation giving an in terms of an-2.

    Note that specifying a0 determines all the even coeficients and specifying a1 determines all the odd coeficients. Since the differential equation is second order, two arbitrary constants, a0 and a1, are needed to specify the solution.

    Write out the specific solutions for a2 in terms of a0 and a3 in terms of a1. Also write out the general term that solves for an in terms of an-2. Show your work.

  2. Use sin(0)=0 to find a0 following the technique of the solution for ex above. What can you say about all the even numbered coefficients of the series for sin(x)?
  3. Use the fact that (d/dx)sin(x)|x=0=1, and (d/dx)f(x)=a1+2a2x+3a3x2+4a4x3+... to find a1.
  4. Write the series representation for sin(x) in ... notation.
  5. Write the series representation for sin(x) in sigma notation.

Notice that cos(x) also satisfies the same differential equation, (d/dx)2 f = -f, as sin(x), but with different initial conditions. We can use those different initial conditions to determine the series solution for cos(x).

  1. Use cos(0)=1 to find a0 for the representation of cos(x) using the same technique as was used to find a0 for the series representing ex and the one representing sin(x).
  2. Use the fact that (d/dx)cos(x)|x=0=0, and (d/dx)f(x)=a1+2a2x+3a3x2+4a4x3+... to find a1. What can you say about all the odd numbered coefficients of the series for cos(x)?
  3. Write the series representation for cos(x) in ... notation.
  4. Write the series representation for cos(x) in sigma notation.
  5. Change the Maple code above to show the graph of sin(x) and partial sums of its series for a period to the right and a period to the left of zero.
  6. What degree of the polynomial is needed to make the sin and the partial sum essentially indistinguishable on the interval shown on your graph?
  7. Repeat the last two questions for the cosine.
Last Update: 2007/06/03