Series Solutions to Differential Equations
Prerequisites:

Ability to represent at least one function by a power series, such as 1/(1x)=1+x+x^{2}+..., and the idea of an interval of convergence.

Knowing that e^{x} is the solution to d/dx f = f with initial condition f(0)=1.

Knowing that sin(x) is the solution to (d/dx)^{2} f = f with initial conditions f(0)=0 f'(0)=1.

Knowing that cos(x) is the solution to (d/dx)^{2} f = f with initial conditions f(0)=1 f'(0)=0.
Corequisite: Knowing what a differential equation is. If you are not familiar with this term, ask your instructor for a brief definition.
Goals:
 Learn how to use series to solve differential equations.
 Find series representations for e^{x}, sin(x), and cos(x).
Realistic action computer games and flight simulators are just two of the myriad applications that require fast, realtime 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+x^{2}), 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 e^{x}, sin(x), and cos(x) since we know differential equations which have these functions as solutions.
For example, e^{x} is the solution to d/dx f = f with initial condition f(0)=1. Hence, if e^{x} is repesented by the series a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+a_{4}x^{4}..., then we must have
d/dx(a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+a_{4}x^{4}+...)=a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+a_{4}x^{4}+...
Which gives
a_{1}+2a_{2}x+3a_{3}x^{2}+4a_{4}x^{3}+...=a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+...
Since the coefficients of each power must be the same on both sides of the equation we get:
a_{1}=a_{0}
2a_{2}=a_{1}
3a_{3}=a_{2}
4a_{4}=a_{3}
...
In general, (n)a_{n}=a_{n1}.
To find the value of all the coefficients we need to use the initial condition f(0)=1 to find a_{0}. Putting 0 in for x in the series representing f, gives f(0)= a_{0}+a_{1}0+a_{2}0^{2}+a_{3}0^{3}+a_{4}0^{4}...=a_{0}. Hence, a_{0}=1.
Since we know the value of a_{0}, we can find the value of a_{1} which gives us the value of a_{2} and so on:
a_{0} = 1
a_{1} = a_{0} =1
2a_{2} = a_{1} => a_{2}=1/2
3a_{3} = a_{2} => a_{3}=(1/3)(1/2)=1/3!
4a_{4} = a_{3} => a_{4}=1/4!
...
In general, a_{n}=1/n!. Hence we conjecture that e^{x} is represented by the series:
e^{x}=1+x+(1/2)x^{2}+(1/3!)x^{3}+(1/4!)x^{4}+...
The relation above, which gives the value of a_{n} 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);
 After pasting this code into Maple, press <enter> (or <return>). When Maple executes the commands, you should see the graph of e^{x} in red and the graph of the n^{th} 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?
 Explain how the approximation when n=0 is related to the graph of e^{x} at x=0.
 Explain how the approximation when n=1 is related to the graph of e^{x} at x=0.
 What is the smallest value of n where the graph of the PartialSum essentially indistinguishable from the graph of e^{x} 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)=a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+a_{4}x^{4}...
(d/dx)f(x)=a_{1}+2a_{2}x+3a_{3}x^{2}+4a_{4}x^{3}+...
And this time take one more derivative to get:
(d/dx)^{2}f(x)=2a_{2}+(2)(3)a_{3}x+(3)(4)a_{4}x^{2}+...
 Since f satisfies (d/dx)^{2} f = f, 2a_{2}+(2)(3)a_{3}x+(3)(4)a_{4}x^{2}+...=(a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+a_{4}x^{4}...).Look above where we found the series representation for e^{x}. Look at the part where we set the coefficients of like powers of x equal to get a relation that gives a_{1} in terms of a_{0}, a_{2} in terms of a_{1} and so on. Repeat that technique here to get a_{2} in terms of a_{0}, a_{3} in terms of a_{1}, and, in general, the recursion relation giving a_{n} in terms of a_{n2}.
Note that specifying a_{0} determines all the even coeficients and specifying a_{1} determines all the odd coeficients. Since the differential equation is second order, two arbitrary constants, a_{0} and a_{1}, are needed to specify the solution.
Write out the specific solutions for a_{2} in terms of a_{0} and a_{3} in terms of a_{1}. Also write out the general term that solves for a_{n} in terms of a_{n2}. Show your work.
 Use sin(0)=0 to find a_{0} following the technique of the solution for e^{x} above. What can you say about all the even numbered coefficients of the series for sin(x)?
 Use the fact that (d/dx)sin(x)_{x=0}=1, and (d/dx)f(x)=a_{1}+2a_{2}x+3a_{3}x^{2}+4a_{4}x^{3}+... to find a_{1}.
 Write the series representation for sin(x) in ... notation.
 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).
 Use cos(0)=1 to find a_{0} for the representation of cos(x) using the same technique as was used to find a_{0} for the series representing e^{x} and the one representing sin(x).
 Use the fact that (d/dx)cos(x)_{x=0}=0, and (d/dx)f(x)=a_{1}+2a_{2}x+3a_{3}x^{2}+4a_{4}x^{3}+... to find a_{1}. What can you say about all the odd numbered coefficients of the series for cos(x)?
 Write the series representation for cos(x) in ... notation.
 Write the series representation for cos(x) in sigma notation.
 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.
 What degree of the polynomial is needed to make the sin and the partial sum essentially indistinguishable on the interval shown on your graph?
 Repeat the last two questions for the cosine.
Last Update: 2007/06/03