First-order equation : y' + p(x)y = q(x) The complementary solution to our original (inhomogeneous) equation is the general solution of the corresponding homogeneous equation (written below): : y' + p(x)y = 0 This homogeneous differential equation can be solved by different methods, for example
separation of variables: :\frac{d}{dx} y + p(x)y = 0 :\frac{dy}{dx}=-p(x)y :{dy \over y} = -{p(x)\,dx}, :\int \frac{1}{ y} \, dy = -\int p(x) \, dx :\ln |y| = -\int p(x) \, dx + C :y = \pm e^{-\int p(x) \, dx +C } = C_0 e^{-\int p(x) \, dx} The complementary solution to our original equation is therefore: :y_c = C_0 e^{-\int p(x) \, dx} Now we return to solving the non-homogeneous equation: : y' + p(x)y = q(x) Using the method variation of parameters, the particular solution is formed by multiplying the complementary solution by an unknown function
C(
x): :y_p = C(x) e^{-\int p(x) \, dx} By substituting the particular solution into the non-homogeneous equation, we can find
C(
x): : C' (x) e^{-\int p(x) \, dx} - C(x) p(x) e^{-\int p(x) \, dx} + p(x) C(x) e^{-\int p(x) \, dx} = q(x) : C' (x) e^{-\int p(x) \, dx} = q(x) : C' (x) = q(x) e^{\int p(x) \, dx} : C(x) =\int q(x) e^{\int p(x) \, dx} \, dx + C_1 We only need a single particular solution, so we arbitrarily select C_1=0 for simplicity. Therefore the particular solution is: :y_p =e^{-\int p(x) \, dx} \int q(x) e^{\int p(x) \, dx} \, dx The final solution of the differential equation is: :\begin{align} y &= y_c + y_p\\ &=C_0 e^{-\int p(x) \, dx} + e^{-\int p(x) \, dx} \int q(x) e^{\int p(x) \, dx} \, dx \end{align} This recreates the method of
integrating factors.
Specific second-order equation Let us solve : y''+4y'+4y = \cosh x We want to find the general solution to the differential equation, that is, we want to find solutions to the homogeneous differential equation : y''+4y'+4y=0. The
characteristic equation is: : \lambda^2+4\lambda+4=(\lambda+2)^2=0 Since \lambda=-2 is a repeated root, we have to introduce a factor of
x for one solution to ensure linear independence: u_1 = e^{-2x} and u_2 =x e^{-2x}. The
Wronskian of these two functions is : W=\begin{vmatrix} e^{-2x} & xe^{-2x} \\ -2e^{-2x} & -e^{-2x}(2x-1)\\ \end{vmatrix} = -e^{-2x}e^{-2x}(2x-1)+2xe^{-2x}e^{-2x} = e^{-4x}. Because the Wronskian is non-zero, the two functions are linearly independent, so this is in fact the general solution for the homogeneous differential equation (and not a mere subset of it). We seek functions A(x) and B(x) so A(x) u_1(x)+B(x) u_2(x) is a particular solution of the non-homogeneous equation. We need only calculate the integrals :A(x) = - \int {1\over W} u_2(x) b(x)\,\mathrm dx,\; B(x) = \int {1 \over W} u_1(x)b(x)\,\mathrm dx Recall that for this example :b(x) = \cosh x That is, :A(x) = - \int {1\over e^{-4x}} xe^{-2x} \cosh x \,\mathrm dx = - \int xe^{2x}\cosh x \,\mathrm dx = -{1\over 18}e^x\left(9(x-1)+e^{2x}(3x-1)\right)+C_1 :B(x) = \int {1 \over e^{-4x}} e^{-2x} \cosh x \,\mathrm dx = \int e^{2x}\cosh x\,\mathrm dx ={1\over 6}e^x\left(3+e^{2x}\right)+C_2 where C_1 and C_2 are constants of integration.
General second-order equation We have a differential equation of the form :u''+p(x)u'+q(x)u=f(x) and we define the linear operator :L=D^2+p(x)D+q(x) where
D represents the
differential operator. We therefore have to solve the equation L u(x)=f(x) for u(x), where L and f(x) are known. We must solve first the corresponding homogeneous equation: :u''+p(x)u'+q(x)u=0 by the technique of our choice. Once we've obtained two linearly independent solutions to this homogeneous differential equation (because this ODE is second-order) — call them
u1 and
u2 — we can proceed with variation of parameters. Now, we seek the general solution to the differential equation u_G(x) which we assume to be of the form :u_G(x)=A(x)u_1(x)+B(x)u_2(x). Here, A(x) and B(x) are unknown and u_1(x) and u_2(x) are the solutions to the homogeneous equation. (Observe that if A(x) and B(x) are constants, then Lu_G(x)=0.) Since the above is only one equation and we have two unknown functions, it is reasonable to impose a second condition. We choose the following: :A'(x)u_1(x)+B'(x)u_2(x)=0. Now, :\begin{align} u_G'(x) &= \left (A(x)u_1(x)+B(x)u_2(x) \right )' \\ &= \left (A(x)u_1(x) \right )'+ \left (B(x)u_2(x) \right )'\\ &=A'(x)u_1(x)+A(x)u_1'(x)+B'(x)u_2(x)+B(x)u_2'(x)\\ &=A'(x)u_1(x)+B'(x)u_2(x)+A(x)u_1'(x)+B(x)u_2'(x) \\ &= A(x)u_1'(x)+B(x)u_2'(x) \end{align} Differentiating again (omitting intermediary steps) :u_G
(x)=A(x)u_1(x)+B(x)u_2''(x)+A'(x)u_1'(x)+B'(x)u_2'(x). Now we can write the action of
L upon
uG as :Lu_G=A(x)Lu_1(x)+B(x)Lu_2(x)+A'(x)u_1'(x)+B'(x)u_2'(x). Since
u1 and
u2 are solutions, then :Lu_G=A'(x)u_1'(x)+B'(x)u_2'(x). We have the system of equations :\begin{bmatrix} u_1(x) & u_2(x) \\ u_1'(x) & u_2'(x) \end{bmatrix} \begin{bmatrix} A'(x) \\ B'(x)\end{bmatrix} = \begin{bmatrix} 0 \\ f \end{bmatrix}. Expanding, :\begin{bmatrix} A'(x)u_1(x)+B'(x)u_2(x)\\ A'(x)u_1'(x)+B'(x)u_2'(x) \end{bmatrix} = \begin{bmatrix} 0\\f\end{bmatrix}. So the above system determines precisely the conditions :A'(x)u_1(x)+B'(x)u_2(x)=0. :A'(x)u_1'(x)+B'(x)u_2'(x)=Lu_G=f. We seek
A(
x) and
B(
x) from these conditions, so, given :\begin{bmatrix} u_1(x) & u_2(x) \\ u_1'(x) & u_2'(x) \end{bmatrix} \begin{bmatrix} A'(x) \\ B'(x)\end{bmatrix} = \begin{bmatrix} 0\\ f\end{bmatrix} we can solve for (
A′(
x),
B′(
x))T, so :\begin{bmatrix} A'(x) \\ B'(x) \end{bmatrix} = \begin{bmatrix} u_1(x) & u_2(x) \\ u_1'(x) & u_2'(x) \end{bmatrix}^{-1} \begin{bmatrix} 0\\ f \end{bmatrix} =\frac{1}{W} \begin{bmatrix} u_2'(x) & -u_2(x) \\ -u_1'(x) & u_1(x) \end{bmatrix} \begin{bmatrix} 0\\ f \end{bmatrix}, where
W denotes the
Wronskian of
u1 and
u2. (We know that
W is nonzero, from the assumption that
u1 and
u2 are linearly independent.) So, : \begin{align} A'(x) &= - {1\over W} u_2(x) f(x), & B'(x) &= {1 \over W} u_1(x)f(x) \\ A(x) &= - \int {1\over W} u_2(x) f(x)\,\mathrm dx, & B(x) &= \int {1 \over W} u_1(x)f(x)\,\mathrm dx \end{align} While homogeneous equations are relatively easy to solve, this method allows the calculation of the coefficients of the general solution of the
inhomogeneous equation, and thus the complete general solution of the inhomogeneous equation can be determined. Note that A(x) and B(x) are each determined only up to an arbitrary additive constant (the
constant of integration). Adding a constant to A(x) or B(x) does not change the value of Lu_G(x) because the extra term is just a linear combination of
u1 and
u2, which is a solution of L by definition. ==See also==