next up previous
Next: The Exact Solution of Up: Solution of the Gamblers Previous: Definition and Exact Solution

A Really Brief Review of the Solution of Linear Second Order Constant Coefficient Ordinary Differential Equations

The problem we need to solve in the previous section is a very close cousin to a second order two point boundary value problem. These types of problems are generally seen in an introductory course in ordinary differential equations. In this section we will review just enough about two point boundary value problems to allow us to determine a method for solving the finite difference equation we have in the Gambler's Ruin problem.

Let's just start with an example of a linear, second order, constant coefficient ordinary differential equation. The example will review the pertinent part of the solution process.

Example 1   Consider the second order ordinary differential equation

\begin{displaymath}
y''(t) - 3 y'(t) + y(t) = 0
\end{displaymath}

with the initial conditions $y(0)=1$ and $y'(0)=0$. Find the solution.

To find the solution we simply assume the solution form

\begin{displaymath}
y(t) = C e^{r t}.
\end{displaymath}

Substituting into the differential equation gives the equation

\begin{displaymath}
( r^2 - 3 r + 1 ) C e^{rt} = 0
\end{displaymath}

Since the exponential function is never zero and the constant will be assumed to be nonzero, the other factor must be zero. Thus we have

\begin{displaymath}
r = {{ 3\pm\sqrt{5} }\over 2}
\end{displaymath}

and thus the solution is

\begin{displaymath}
y(t) = C_1 e^{ {{ 3+\sqrt{5} }\over 2} t } + C_2 e^{{{ 3-\sqrt{5} }\over 2}}
\end{displaymath}

with the coefficients determined by the initial conditions.

The functions in Mathematica make it easy to solve the ordinary differential equation in the above example. In particular, the command would be

  DSolve[ { y''[t]-3*y'[t]+y[t]==0, y[0]==1, y'[0]==0 }, y[t], t]
The syntax of the command is that the first argument must be a list of equations. The second argument is the quantity you wish to solve for and the third argument is the independent variable in the function. A more thorough explanation of how to use this command is given in the appendices. This command will do all the work including finding the unknown constants in the solution. The homework problems at the end of the section include some solutions of differential equations using DSolve.

Now let's consider a two point boundary value problem which is closely related to the finite difference equation we are need to solve.

Example 2   Solve the differential equation

\begin{displaymath}
py'' - y' + (1-p) y = 0
\end{displaymath}

with $y(0)=0$ and $y(c)=1$. If we apply the same process as above we will obtain the quadratic equation

\begin{displaymath}
p r^2 - r + q = 0
\end{displaymath}

Solving gives

\begin{displaymath}
r = -1 + {1\over p} \makebox{ and } r = 1
\end{displaymath}

So the solution is given by

\begin{displaymath}
y(t) = C_1 e^{(-1+1/p)t} + C_2 e^{t}
\end{displaymath}

Applying the boundary conditions gives
$\displaystyle y(0)$ $\textstyle =$ $\displaystyle C_1 + C_2 = 0$  
$\displaystyle y(c)$ $\textstyle =$ $\displaystyle C_1 e^{(-1+1/p)c} + C_2 e^c = 1$  

We would finish the problem by computing the solution of the system of equations for $C_1$ and $C_2$.

Again, we could us Mathematica to solve the ordinary differential equation in the example above. The command would look like the following.

  DSolve[ { p*y''[t]-y'[t]+(1-p)y[t]==0, y[0]==0, y[c]==1 }, y[t], t]
The output will be a form that is similar to the form above or can be manipulated to that form. See the chapter notebook for the command the output of the command.


next up previous
Next: The Exact Solution of Up: Solution of the Gamblers Previous: Definition and Exact Solution
Joe Koebbe 2003-10-01