This section provides an alternative way how to find a solution of the inhomogeneous equation when a solution of a corresponding homogeneous equation is known.

Return to computing page for the first course APMA0330
Return to computing page for the second course APMA0340
Return to Mathematica tutorial for the first course APMA0330
Return to Mathematica tutorial for the second course APMA0340
Return to the main page for the course APMA0330
Return to the main page for the course APMA0340

Inhomogeneous ODEs

For instance, construct a second-order linear ODE with variable coefficients that is arranged in advance to be operationally factorable into the following pair of first-order equations \begin{equation} \label{Eqfactor.1} y_1 = L_1 \left[ x, \texttt{D} \right] y(x) = \left[ \texttt{D} + a(x) \right] y(x) , \end{equation} and \begin{equation} \label{Eqfactor.2} L_2 \left[ x, \texttt{D} \right] y_1 (x) = \left[ x^n \texttt{D} + b(x) \right] y_1 (x) = f(x) , \end{equation} where \( \displaystyle \texttt{D} = {\text d}/{\text d}x \) is the derivative operator, and 𝑎(x), b(x), and f(x) are given continuous functions. Replacing y1(x) from Eq.\eqref{Eqfactor.1}, we obtain \[ \left[ x^n \texttt{D} + b(x) \right] \left[ \texttt{D} + a(x) \right] y(x) = f(x) . \] The operator multiplication of the term on the left-hand side requires some care. For instance, the latter leads to the following second-order (linODE) with variable coefficients: \[ \left\{ x^n \texttt{D}^2 + \left[ b(x) + x^n a(x) \right] \texttt{D} + \left[ x^n \left( \texttt{D}\,a(x) \right) + a(x)\,b(x) \right] \right\} y(x) = f(x) . \]

In the previous section, we factor the linear differential operators with variable coefficients of arbitrary order into a product of first order operator.

\begin{equation} \label{EqIn.1} L \left[ t, \texttt{D} \right] = \texttt{D}^n + a_{n-1} (t)\,\texttt{D}^{n-1} + \cdots + a_1 (t) \,\texttt{D} + a_0 (t) \,\texttt{I} , \qquad \texttt{D} = {\text d}/{\text d}t, \end{equation}
\( \texttt{D}^0 = \texttt{I} , \) the identity operator, and corresponding n-th order inhomogeneous equations
\begin{equation} \label{EqIn.2} L \left[ t, \texttt{D} \right] y = f \qquad \Longleftrightarrow \qquad y^{(n)} + a_{n-1}(t) \,y^{(n-1)} + \cdots + a_1 (t)\,y' + a_0 (t) \,y = f(t) . \end{equation}
It is well known that no general formula exists for the solution of the variable coefficient equation \eqref{EqIn.2}. If a fundamental set of solutions
\[ \varphi_1 (t) , \ \varphi_2 (t) , \ldots , \varphi_n (t) , \]
to the homogeneous equation \( L \left[ t, \texttt{D} \right] y = 0 \) is known, then the variation of parameters provides an algorithm to determine aparticular solution to the inhomogeneous equation \eqref{EqIn.2}.

This section gives an alternative approach for its determination based on factorization of the given differential ooperator \( L \left[ t, \texttt{D} \right] \) into a product of first order differential operators:

\begin{equation} \label{EqIn.3} L \left[ t, \texttt{D} \right] = L_1 \left[ t, \texttt{D} \right] L_2 \left[ t, \texttt{D} \right] \cdots L_n \left[ t, \texttt{D} \right] , \end{equation}
where each \( L_i \left[ t, \texttt{D} \right] , \quad i=1,2,\ldots , n, \) is a first order differential operator. Note that such representation \eqref{EqIn.3} is not unique unless L is a constant coefficient operator---it is not our concern because we discusses this case in the next section. Moreover, the product of linear operators in Eq.\eqref{EqIn.3} is not commutative, so you have to preserve the order of their multiplications.

To make our exposition clear, we consider first second order variable coefficient equations, then the Third order equations, and finally, the general case.


Second order differential operators

A second order variable coefficient differential equation in normal form
\[ y'' + a_1 (t) \,y' + a_0 (t)\,y = f(t) \]
can be easily breaken into the system of first order equations
\begin{equation} \label{EqIn.4} \frac{{\text d}y}{{\text d}t} + p(t) \, y(t) = x(t) , \qquad \frac{{\text d}x}{{\text d}t} + q(t) \, x(t) = f(t) . \end{equation}
Substituting x from the former equation into the latter one, we obtain
\[ y'' + \left[ p(t) + q(t) \right] y' + \left[ p' (t) + p(t)\,q(t) \right] y = f(t) . \]
For given p and q, this system provides the solution of required differential equation of the second order \( y'' + a_1 y' + a_0 y = f \) when
\[ q(t) = a_1 (t) - p(t), \qquad p' (t) + a_1 \,p(t) - p(t)^2 = a_0 (t) . \]
The latter equation is a Riccati equation in p(t), so no general formula of the solution is known. However, when one solution φ1(t) of the homogeneous equation \( y'' + a_1 y' + a_0 y = 0 \) is known, then the Riccati equation for p(t) is solvable, and we obtain an explicit formula for a particular solution
\[ y = \varphi (t) = \int {\text d}t \,\varphi_1 (t) \int {\text d}t \,\frac{\exp \left\{ -\int a_1 (t) \,{\text d} t \right\}}{\varphi (t)^2} \left[ \int \varphi_1 (t) \,\exp \left\{ \int a_1 (t)\, {\text d}t \right\} f(t)\,{\text d}t \right] . \]
If the given differential equation is in reduced form, \( y'' + a_0 y = f(t) \) so 𝑎1 = 0, we have
\[ y = \varphi (t) = \varphi_1 (t) \int {\text d}t \,\frac{1}{\varphi (t)^2} \left[ \int \varphi_1 (t) \, f(t)\,{\text d}t \right] . \]
With one known solution φ1(t), we can find another linearly independent solution:
\[ \varphi_2 (t) = \varphi_1 (t) \, \int \varphi_1^{-2} \, \exp \left\{ - \int a_1 (t) \, {\text d} t \right\} {\text d} t . \]
However, we don't need it because we know their Wronskian (aparantly the wronskian was not introduced by Józef Hoëné-Wroński) from Abel's formula
\[ W_2 (t) = \det \begin{bmatrix} \varphi_1 & \varphi_2 \\ \varphi'_1 & \varphi'_2 \end{bmatrix} = \varphi'_2 \varphi_1 - \varphi'_1 \varphi_2 = W\left( t_0 \right) exp \left\{ - \int a_1 (t)\,{\text d}t \right\} . \]
Then a particular solution becomes
\[ \varphi (t) = \varphi_1 \int {\text d}t \,\frac{W_2 (t)}{\varphi_1 (t)^2} \, \int {\text d}t \,\frac{\varphi_1 f(t)}{W_2 (t)} . \]
Instead of factorization by linear differential operators \eqref{EqIn.4}, we use factorization directly with derivative operators:
\begin{equation} \label{EqIn.5} \frac{{\text d}}{{\text d}t} \left\{ \frac{1}{p_2 (t)} \, \frac{{\text d}}{{\text d}t} \left( \frac{y(t)}{p_1 (t)} \right) \right\} = \frac{f(t)}{p_1 (t)\,p_2 (t)} , \end{equation}
\[ p_1 (t) = \varphi_1 (t) = W_1 (t) , \qquad p_2 (t) = \frac{{\text d}}{{\text d}t} \left( \frac{\varphi_2 (t)}{\varphi_1 (t)} \right) = \frac{W_2}{W_1} . \]
Note that W2(t) satisfies the first order differential equation:
\[ \frac{{\text d}W_2}{{\text d}t} + a_1 W_2 (t) = 0 . \]
Integration of Eq.\eqref{EqIn.5} yields
\[ y = p_1 (t) \int {\text d}t\, p_2 (t) \int {\text d}t\, \frac{f(t)}{p_1 (t)\,p_2 (t)} . \]

Example:    ■


Third order differential operators


n-th order differential operators

Let \( \varphi_1 , \varphi_2 , \ldots , \varphi_n \) be the fundamental set of solutions to the n-th order linear variable coefficient homogeneous equation \( L \left[ t, \texttt{D} \right] y = 0 , \) where the operator L is defined by Eq.\eqrefl{EqIn.1}. For any k functions from this fundamental set of solutions, we define the determinant:
\[ W_k \left[ \varphi_1 , \ldots , \varphi_k \right] (t) = \det \begin{bmatrix} \varphi_1 & \varphi_2 & \cdots & \varphi_k \\ \varphi'_1 & \varphi'_2 & \cdots & \varphi'_k \\ \vdots & \vdots & \ddots & \vdots \\ \varphi_1^{(k-1)} & \varphi_2^{(k-1)} & \cdots & \varphi_k^{(k-1)} \end{bmatrix} , \qquad k=1,2,\ldots , n. \]
Then their Wronskian will be just Wn. We define a sequence of functions \( p_1 (t), p_2 (t) , \ldots , p_n (t) \) recursively:
\begin{equation} \label{EqIn.n} p_1 (t) = W_1 (t) = \varphi_1 (t), \qquad p_k (t) = \frac{W_{k-2} W_k }{W^2_{k-1}} , \qquad k =1,2,\ldots , n . \end{equation}
The reciprocal of their product is
\[ \frac{1}{p_1 p_2 \cdots p_n} = \frac{W_{n-1}}{W_n} . \]


  1. Chen, W., Differential Operator Method of Finding A Particular Solution to An Ordinary Nonhomogeneous Linear Differential Equation with Constant Coefficients, SUNY Polytechnic Institute, Utica, NY, 2018.
  2. Mejlbro, L., Solution of linear ordinary differential equations by means of the method of variation of arbitrary constants, International Journal of Mathematical Education in Science and Technology, 1997, Vol. 28, No. 3, pp. 321--331. doi: 10.1080/0020739970280302


Return to Mathematica page
Return to the main page (APMA0330)
Return to the Part 1 (Plotting)
Return to the Part 2 (First Order ODEs)
Return to the Part 3 (Numerical Methods)
Return to the Part 4 (Second and Higher Order ODEs)
Return to the Part 5 (Series and Recurrences)
Return to the Part 6 (Laplace Transform)
Return to the Part 7 (Boundary Value Problems)