In order for a linear constant-coefficient difference equation to be useful in analyzing a LTI system, we must be able to find the systems output based upon a known input, \(x(t)\), and a set of initial conditions. Two common methods exist for solving a LCCDE: the direct method and the indirect method, the latter being based on the Laplace-transform. Below we will briefly discuss the formulas for solving a LCCDE using each of these methods.
Direct Method
The final solution to the output based on the direct method is the sum of two parts, expressed in the following equation:
\[y(t)=y_{h}(t)+y_{p}(t) \nonumber \]
The first part, \(y_{h}(t)\), is referred to as the homogeneous solution and the second part, \(y_{h}(t)\), is referred to as particular solution. The following method is very similar to that used to solve many differential equations, so if you have taken a differential calculus course or used differential equations before then this should seem very familiar.
Homogeneous Solution
We begin by assuming that the input is zero, \(x(t)=0\). Now we simply need to solve the homogeneous differential equation:
\[\sum_{k=0}^{N} a_{k} y(t-k)=0 \nonumber \]
In order to solve this, we will make the assumption that the solution is in the form of an exponential. We will use lambda, \(\lambda\), to represent our exponential terms. We now have to solve the following equation:
\[\sum_{k=0}^{N} a_{k} \lambda^{t-k}=0 \nonumber \]
We can expand this equation out and factor out all of the lambda terms. This will give us a large polynomial in parenthesis, which is referred to as the characteristic polynomial. The roots of this polynomial will be the key to solving the homogeneous equation. If there are all distinct roots, then the general solution to the equation will be as follows:
\[y_{h}(t)=C_{1}\left(\lambda_{1}\right)^{t}+C_{2}\left(\lambda_{2}\right)^{t}+\ldots+C_{N}\left(\lambda_{N}\right)^{t} \nonumber \]
However, if the characteristic equation contains multiple roots then the above general solution will be slightly different. Below we have the modified version for an equation where \(\lambda_1\) has \(K\) multiple roots:
\[y_{h}(t)=C_{1}\left(\lambda_{1}\right)^{t}+C_{1} t\left(\lambda_{1}\right)^{t}+C_{1} t^{2}\left(\lambda_{1}\right)^{t}+\ldots+C_{1} t^{K-1}\left(\lambda_{1}\right)^{t}+C_{2}\left(\lambda_{2}\right)^{t}+\ldots+C_{N}\left(\lambda_{N}\right)^{t} \nonumber \]
Particular Solution
The particular solution, \(y_p(t)\), will be any solution that will solve the general differential equation:
\[\sum_{k=0}^{N} a_{k} y_{p}(t-k)=\sum_{k=0}^{M} b_{k} x(t-k) \nonumber \]
In order to solve, our guess for the solution to \(y_p(t)\) will take on the form of the input, \(x(t)\). After guessing at a solution to the above equation involving the particular solution, one only needs to plug the solution into the differential equation and solve it out.
Indirect Method
The indirect method utilizes the relationship between the differential equation and the Laplace-transform, discussed earlier, to find a solution. The basic idea is to convert the differential equation into a Laplace-transform, as described above, to get the resulting output, \(Y(s)\). Then by inverse transforming this and using partial-fraction expansion, we can arrive at the solution.
\[L\left\{\frac{d}{d t} y(t)\right\}=s Y(s)-y(0) \nonumber \]
This can be interatively extended to an arbitrary order derivative as in Equation \ref{11.39}.
\[L\left\{\frac{d^{n}}{d t^{n}} y(t)\right\}=s^{n} Y(s)-\sum_{m=0}^{n-1} s^{n-m-1} y^{(m)}(0) \label{11.39} \]
Now, the Laplace transform of each side of the differential equation can be taken
\[L\left\{\sum_{k=0}^{n} a_{k} \frac{d^{k}}{d t^{k}} y(t)\right\}=L\{x(t)\} \nonumber \]
which by linearity results in
\[\sum_{k=0}^{n} a_{k} L\left\{\frac{d^{k}}{d t^{k}} y(t)\right\}=L\{x(t)\} \nonumber \]
and by differentiation properties in
\[\sum_{k=0}^{n} a_{k}\left(s^{k} L\{y(t)\}-\sum_{m=0}^{k-1} s^{k-m-1} y^{(m)}(0)\right)=L\{x(t)\}. \nonumber \]
Rearranging terms to isolate the Laplace transform of the output,
\[L\{y(t)\}=\frac{L\{x(t)\}+\sum_{k=0}^{n} \sum_{m=0}^{k-1} a_{k} s^{k-m-1} y^{(m)}(0)}{\sum_{k=0}^{n} a_{k} s^{k}}. \nonumber \]
Thus, it is found that
\[Y(s)=\frac{X(s)+\sum_{k=0}^{n} \sum_{m=0}^{k-1} a_{k} s^{k-m-1} y^{(m)}(0)}{\sum_{k=0}^{n} a_{k} s^{k}} \label{11.44}. \]
In order to find the output, it only remains to find the Laplace transform \(X(s)\) of the input, substitute the initial conditions, and compute the inverse Laplace transform of the result. Partial fraction expansions are often required for this last step. This may sound daunting while looking at Equation \ref{11.44}, but it is often easy in practice, especially for low order differential equations. Equation \ref{11.44} can also be used to determine the transfer function and frequency response.
As an example, consider the differential equation
\[\frac{d^{2}}{d t^{2}} y(t)+4 \frac{d}{d t} y(t)+3 y(t)=\cos (t) \nonumber \]
with the initial conditions \(y^{\prime}(0)=1\) and \(y(0)=0\). Using the method described above, the Laplace transform of the solution \(y(t)\) is given by
\[Y(s)=\frac{s}{\left(s^{2}+1\right)(s+1)(s+3)}+\frac{1}{(s+1)(s+3)}. \nonumber \]
Performing a partial-fraction decomposition, this also equals
\[Y(s)=0.25 \frac{1}{s+1}-0.35 \frac{1}{s+3}+0.1 \frac{s}{s^{2}+1}+0.2 \frac{1}{s^{2}+1}. \nonumber \]
Computing the inverse Laplace transform,
\[y(t)=\left(0.25 e^{-t}-0.35 e^{-3 t}+0.1 \cos (t)+0.2 \sin (t)\right) u(t). \nonumber \]
One can check that this satisfies that this satisfies both the differential equation and the initial conditions.