Skip to main content
Engineering LibreTexts

4.8: Solving Linear Constant Coefficient Difference Equations

  • Page ID
    23133
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Introduction

    The approach to solving linear constant coefficient difference equations is to find the general form of all possible solutions to the equation and then apply a number of conditions to find the appropriate solution. The two main types of problems are initial value problems, which involve constraints on the solution at several consecutive points, and boundary value problems, which involve constraints on the solution at nonconsecutive points.

    The number of initial conditions needed for an \(N\)th order difference equation, which is the order of the highest order difference or the largest delay parameter of the output in the equation, is \(N\), and a unique solution is always guaranteed if these are supplied. Boundary value problems can be slightly more complicated and will not necessarily have a unique solution or even a solution at all for a given set of conditions. Thus, this section will focus exclusively on initial value problems.

    Solving Linear Constant Coefficient Difference Equations

    Consider some linear constant coefficient difference equation given by \(Ay(n)=f(n)\), in which \(A\) is a difference operator of the form

    \[A=a_{N} D^{N}+a_{N-1} D^{N-1}+\ldots+a_{1} D+a_{0} \nonumber \]

    where \(D\) is the first difference operator

    \[ D(y(n))=y(n)-y(n-1). \nonumber \]

    Let \(y_h(n)\) and \(y_p(n)\) be two functions such that \(Ay_h(n)=0\) and \(Ay_p(n)=f(n)\). By the linearity of \(A\), note that \(L(y_h(n)+y_p(n))=0+f(n)=f(n)\). Thus, the form of the general solution \(y_g(n)\) to any linear constant coefficient ordinary differential equation is the sum of a homogeneous solution \(y_h(n)\) to the equation \(Ay(n)=0\) and a particular solution \(y_p(n)\) that is specific to the forcing function \(f(n)\).

    We wish to determine the forms of the homogeneous and nonhomogeneous solutions in full generality in order to avoid incorrectly restricting the form of the solution before applying any conditions. Otherwise, a valid set of initial or boundary conditions might appear to have no corresponding solution trajectory. The following sections discuss how to accomplish this for linear constant coefficient difference equations.

    Finding the Homogeneous Solution

    In order to find the homogeneous solution to a difference equation described by the recurrence relation

    \[\sum_{k=0}^{N} a_{k} y(n-k)=f(n), \nonumber \]

    consider the difference equation

    \[\sum_{k=0}^{N} a_{k} y(n-k)=0. \nonumber \]

    We know that the solutions have the form \(c \lambda^n\) for some complex constants \(c, \lambda\). Since \(\sum_{k=0}^{N} a_{k} c \lambda^{n-k}=0\) for a solution it follows that

    \[ c \lambda^{n-N} \sum_{k=0}^{N} a_{k} \lambda^{N-k}=0 \nonumber \]

    so it also follows that

    \[ a_{0} \lambda^{N}+\ldots+a_{N}=0. \nonumber \]

    Therefore, the solution exponential are the roots of the above polynomial, called the characteristic polynomial.

    For equations of order two or more, there will be several roots. If all of the roots are distinct, then the general form of the homogeneous solution is simply

    \[y_{h}(n)=c_{1} \lambda_{1}^{n}+\ldots+c_{2} \lambda_{2}^{n} . \nonumber \]

    If a root has multiplicity that is greater than one, the repeated solutions must be multiplied by each power of \(n\) from 0 to one less than the root multiplicity (in order to ensure linearly independent solutions). For instance, if \(\lambda_1\) had a multiplicity of 2 and \(\lambda_2\) had multiplicity 3, the homogeneous solution would be

    \[y_{h}(n)=c_{1} \lambda_{1}^{n}+c_{2} n \lambda_{1}^{n}+c_{3} \lambda_{2}^{n}+c_{4} n \lambda_{2}^{n}+c_{5} n^{2} \lambda_{2}^{n} \nonumber \]

    Example \(\PageIndex{1}\): Fibonacci Sequence

    Recall that the Fibonacci sequence describes a (very unrealistic) model of what happens when a pair rabbits get left alone in a black box... The assumptions are that a pair of rabits never die and produce a pair of offspring every month starting on their second month of life. This system is defined by the recursion relation for the number of rabit pairs \(y(n)\) at month \(n\)

    \[y(n)-y(n-1)-y(n-2)=0 \nonumber \]

    with the initial conditions \(y(0)=0\) and \(y(1)=1\).

    Note that the forcing function is zero, so only the homogenous solution is needed. It is easy to see that the characteristic polynomial is \(\lambda^{2}-\lambda-1=0\), so there are two roots with multiplicity one. These are \(\lambda_{1}=\frac{1+\sqrt{5}}{2}\) and \(\lambda_{2}=\frac{1-\sqrt{5}}{2}\). Thus, the solution is of the form

    \[ y(n)=c_{1}\left(\frac{1+\sqrt{5}}{2}\right)^{n}+c_{2}\left(\frac{1-\sqrt{5}}{2}\right)^{n}. \nonumber \]

    Using the initial conditions, we determine that

    \[c_{1}=\frac{\sqrt{5}}{5} \nonumber \]

    and

    \[c_{2}=-\frac{\sqrt{5}}{5} . \nonumber \]

    Hence, the Fibonacci sequence is given by

    \[y(n)=\frac{\sqrt{5}}{5}\left(\frac{1+\sqrt{5}}{2}\right)^{n}-\frac{\sqrt{5}}{5}\left(\frac{1-\sqrt{5}}{2}\right)^{n} . \nonumber \]

    Finding the Particular Solution

    Finding the particular solution is a slightly more complicated task than finding the homogeneous solution. It can be found through convolution of the input with the unit impulse response once the unit impulse response is known. Finding the particular solution ot a differential equation is discussed further in the chapter concerning the z-transform, which greatly simplifies the procedure for solving linear constant coefficient differential equations using frequency domain tools.

    Example \(\PageIndex{2}\)

    Consider the following difference equation describing a system with feedback

    \[y(n)−ay(n−1)=x(n). \nonumber \]

    In order to find the homogeneous solution, consider the difference equation

    \[y(n)−ay(n−1)=0. \nonumber \]

    It is easy to see that the characteristic polynomial is \(\lambda−a=0\), so \(\lambda =a\) is the only root. Thus the homogeneous solution is of the form

    \[y_h(n)=c_1a^n. \nonumber \]

    In order to find the particular solution, consider the output for the \(x(n)=\delta(n)\) unit impulse case

    \[ y(n)-a y(n-1)=\delta(n). \nonumber \]

    By inspection, it is clear that the impulse response is \(a^nu(n)\). Hence, the particular solution for a given \(x(n)\) is

    \[y_{p}(n)=x(n)*\left(a^{n} u(n)\right). \nonumber \]

    Therefore, the general solution is

    \[ y_{g}(n)=y_{h}(n)+y_{p}(n)=c_{1} a^{n}+x(n) *\left(a^{n} u(n)\right). \nonumber \]

    Initial conditions and a specific input can further tailor this solution to a specific situation.

    Solving Difference Equations Summary

    Linear constant coefficient difference equations are useful for modeling a wide variety of discrete time systems. The approach to solving them is to find the general form of all possible solutions to the equation and then apply a number of conditions to find the appropriate solution. This is done by finding the homogeneous solution to the difference equation that does not depend on the forcing function input and a particular solution to the difference equation that does depend on the forcing function input.


    This page titled 4.8: Solving Linear Constant Coefficient Difference Equations is shared under a CC BY license and was authored, remixed, and/or curated by Richard Baraniuk et al..

    • Was this article helpful?