\documentclass[12pt]{article}
\newcommand{\vs}{\vspace{.1in}}

\begin{document}
\begin{center}
{\bf Stony Brook University ~~~~ MAT 127 ~~~~ Calculus C}
\vs

{\bf Power series solutions for initial-value problems.}
\end{center}
\vs

{\bf The Method.} Power series give a very general method for
solving initial-value problems. For convenience in notation, we will take the
initial value or values to be given at $x=0$. 

An initial-value problem that we cannot solve with this term's methods
is
$$y'' + y  =  \sin x$$
$$y(0) = 0,~~ y'(0) = 0$$

(This problem models a harmonic oscillator with period $2\pi$
starting from rest and being driven at its natural
frequency).
 
The power series method consists in taking $y$ to be given by an unknown
power series in $x$:
$$y = c_0 + c_1x + c_2x^2 + c_3x^3 + c_4x^4 + \dots$$
and then using the equation and the initial conditions to solve for
the coefficients $c_0, c_1, c_2, \dots$. Here it is immediate that
$c_0 = y(0) = 0$, and that $c_1 = y'(0) = 0$, but the equation
will force relations between the $c$s which allow them all to
be calculated.



Differentiating the power series twice, term by term, we get:
\begin{eqnarray*}
y' &=& c_1 + 2c_2x + 3c_3x^2 + 4c_4x^3 +  5c_5x^4 + \dots\\
y'' &=& 2c_2 + 2\cdot 3c_3x + 3\cdot 4c_4x^2 + 4\cdot 5c_5x^3 + 5\cdot 6c_6x^4
+ \dots~ .
\end{eqnarray*}


Now we can write $y''+y$ as a single power
series by adding the coefficients of like powers as usual:
\begin{eqnarray*} 
y'' + y & = & 2c_2 + c_0 + (2\cdot 3c_3+c_1)x + (3\cdot 4c_4+c_2)x^2 +  \\  
 & &(4\cdot 5c_5+c_3)x^3 + (5\cdot 6c_6+c_4)x^4 + \dots. 
\end{eqnarray*}

We know $\sin x$ has the Maclaurin series 
$$\sin x = x -\frac{x^3}{3!}+\frac{x^5}{5!}-\dots$$
so our differential equation becomes an equation between two
power series. The two sides of the equation
can be equal
for all values of $x$ only if all
like coefficients on left and right are equal.
This gives a system of equations:

\begin{eqnarray*}
2c_2 + c_0 &=& 0\\
2\cdot 3c_3+c_1 &=& 1\\
3\cdot 4c_4+c_2 &=& 0\\
4\cdot 5c_5+c_3 &=& -\frac{1}{3!}\\
5\cdot 6c_6+c_4 &=& 0\\
6\cdot 7c_7+c_5 &=& \frac{1}{5!}\\
\dots & & 
\end{eqnarray*}

We already know $c_0 = 0$ and $c_1 = 0$ from our initial conditions.
Furthermore the equations for even indices all have right-hand side 0;
and since $c_0=0$, it follows that $c_2=0$, so $c_4=0$, ... . All the
even-indexed coefficients are 0.
For the odd coefficients we may solve the system recursively:
$$
\begin{array}{ccccccc}
 & & & &c_1 &=& 0\\
& & & & & & \\
2\cdot 3c_3+c_1 &=& 1&{\rm so}&
c_3 &=& \frac{\displaystyle 1}{\displaystyle 3!}\\
& & & & & & \\
4\cdot 5c_5+c_3 &=& -\frac{\displaystyle 1}{\displaystyle 3!}&{\rm so}&
c_5 &=& -\frac{\displaystyle 2}{\displaystyle 5!}\\
& & & & & & \\
6\cdot 7c_7+c_5 &=& \frac{\displaystyle 1}{\displaystyle 5!} & {\rm so}& 
c_7&= & \frac{\displaystyle 3}{\displaystyle 7!} \\


& & & & \dots & & 
\end{array}
$$

This pattern will continue, as can easily be checked, giving

$$c_1 = 0, ~~~~~ c_{2n+1} = (-1)^{n+1}\frac{\displaystyle n}{\displaystyle (2n+1)!} {\rm ~for~} n\geq 1.$$ 

 It follows from the ratio test that the function given by
$$f(x) = \sum_{n=0}^{\infty}c_nx^n$$
with these coefficients is defined for all values of $x$. It is the
solution to our initial value problem.

In certain cases it is possible to identify the solution in terms
of known functions. This particular initial value problem 
can also be solved by the method
of variation of parameters, yielding the solution:
$$f(x)=\frac{1}{2}\sin x -\frac{1}{2}x\cos x.$$
The Maclaurin series for this $f(x)$ is exactly the series
we calculated.  
\vspace{.1in}

{\bf Exercises:}
\begin{enumerate}
\item Verify that the Maclaurin series for $f(x)=\frac{1}{2}\sin x 
-\frac{1}{2}x\cos x$ is exactly the power series we calculated
as solution to $y''+y=\sin x,~~y(0)=0, ~~y'(0)=0$.
\item Use the power series method to solve the initial value
problem
$$y' = y,~~~y(0)=1$$
and identify the solution as an elementary function.

\item Use the power series method to solve the initial value
problem
$$y' = ky, ~~~y(0)=C$$
and identify the solution as before.

\item Use the power series method to solve the initial value
problem
$$y''+y=0,~~~y(0)=1,~~ y'(0)=0$$
and identify the solution as an elementary function.

\item Use the power series method to solve the initial value
problem
$$y''+y=0,~~~y(0)=0, ~~y'(0)=1$$
and identify the solution as an elementary function.

\item Use the power series method to solve the initial value
problem
$$y''+k^2y=0,~~~y(0)=A,~~ y'(0)=B$$
and identify the solution in terms of elementary functions.

\item Use the power series method to solve the initial value
problem
$$y''+ y=x,~~~y(0)=0,~~ y'(0)=0$$
(consider $x$ as a power series with $c_1 = 1$ and all other
coefficients zero)
and identify the solution as the power series of $f(x) = x-\sin x$. 

\end{enumerate}











\end{document}