Variation of Parameters
When we know the solutions of a linear differential equation with constant coefficients and right hand side equal to zero, we can use variation of parameters to find a solution when the right hand side is not equal to zero.
This post is part of the book Justin Math: Calculus. Suggested citation: Skycak, J. (2019). Variation of Parameters. In Justin Math: Calculus. https://justinmath.com/variation-of-parameters/
Want to get notified about new posts? Join the mailing list.
When we know the zero solutions $y_0$ of a differential equation $y’^\prime+a_1(x)y’+a_0(x)y=f(x)$, we can use a method called variation of parameters to find the particular solution. This method is especially useful in cases where we are unable to guess the particular solution through undetermined coefficients.
Derivation
Variation of parameters is similar to undetermined coefficients in that we guess a solution form that is relevant to the differential equation, and adjust it as needed to solve the differential equation.
However, variation of parameters is more general: the guess is of the form $y_f(x)=u_1(x)y_1(x)+u_2(x)y_2(x)$, where $y_1$ and $y_2$ are the two zero solutions of the differential equation $y’^\prime+a_1(x)y’+a_0(x)y=0$, and $u_1(x)$ and $u_2(x)$ are some unknown multiplier functions for which we need to solve.
If we also force $y_f’(x)=u_1(x)y_1’(x)+u_2(x)y_2’(x)$, then we can set up a system of equations to solve for $u_1$ and $u_2$. (To be clear, the formula for $y_f’$ does not come from differentiating – rather, it is a condition that we force, so that we obtain a solvable system of equations.)
The first equation comes from differentiating $y_f$:
The second equation comes from substituting our guess for $y_f$ into the differential equation and simplifying, using the fact that $y_1$ and $y_2$ are the zero solutions.
Our resulting system
is solved by
Integrating, we have
The particular solution is then
Demonstration
For example, to solve the differential equation $y’^\prime-2y’+y=\frac{e^x}{x}$, we start by solving $y’^\prime-2y’+y=0$ to find the zero solutions $y_1=e^x$ and $y_2 = xe^x$. After computing
we are able to compute $u_1$ and $u_2$:
We can then compute the particular solution:
Finally, we can write the full solution, and lump any constant terms to eliminate redundancy.
Another Demonstration
As another example, we solve the differential equation $y’^\prime-y’=xe^x \sin x$ in the same way. The zero solutions to $y’^\prime-y’=0$ are $y_1=e^x$ and $y_2=1$, and we have
Computing $u_1$ and $u_2$, we have
We can then compute the particular solution:
Finally, we can write the full solution, and lump any constant terms to eliminate redundancy.
Exercises
Use variation of parameters to solve the following differential equations. (You can view the solution by clicking on the problem.)
$\begin{align*} 1) \hspace{.5cm} y'' - 2y' + y = \frac{e^x}{x^2} \end{align*}$
Solution:
$\begin{align*} y = e^x \left( C_1 + C_2x - \ln x \right) \end{align*}$
$\begin{align*} 2) \hspace{.5cm} y'' - 2y' + y = e^x \ln x \end{align*}$
Solution:
$\begin{align*} y = \frac{1}{4}e^x \left( C_1 + C_2 x - 3x^2 + 2x^2 \ln x \right) \end{align*}$
$\begin{align*} 3) \hspace{.5cm} y'' - 4y = \frac{1}{1+e^{2x}} \end{align*}$
Solution:
$\begin{align*} y = \frac{1}{8}e^{2x} \left[ C_1 + \ln \left( e^{-2x}+1 \right) \right] - \frac{1}{8}e^{-2x} \left[ C_1 + \ln \left( e^{2x}+1 \right) \right] - \frac{1}{8} \end{align*}$
$\begin{align*} 4) \hspace{.5cm} y'' + 2y' + y = \frac{1}{(1+x^2)e^x} \end{align*}$
Solution:
$\begin{align*} y = \frac{1}{2}e^{-x} \left[ C_1 + C_2 x - \ln (1+x^2) + 2x \arctan x \right] \end{align*}$
$\begin{align*} 5) \hspace{.5cm} y'' + y = xe^x \cos x \end{align*}$
Solution:
$\begin{align*} y = C_1 \cos x + C_2 \sin x + \frac{1}{25}e^x \left[ (10x-14) \sin x + (5x-2) \cos x \right] \end{align*}$
$\begin{align*} 6) \hspace{.5cm} y'' - y' = x^2 e^x \sin x \end{align*}$
Solution:
$\begin{align*} y = C_1 + \frac{1}{2}e^x \left[ C_2 + (-x^2+4x+1)\sin x + (-x^2-2x+5) \cos x \right] \end{align*}$
This post is part of the book Justin Math: Calculus. Suggested citation: Skycak, J. (2019). Variation of Parameters. In Justin Math: Calculus. https://justinmath.com/variation-of-parameters/
Want to get notified about new posts? Join the mailing list.