Undetermined Coefficients
Undetermined coefficients can help us find a solution to a linear differential equation with constant coefficients 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). Undetermined Coefficients. In Justin Math: Calculus. https://justinmath.com/undetermined-coefficients/
Want to get notified about new posts? Join the mailing list.
In the previous post, we learned how to solve differential equations of the form
Now, we consider differential equations of the form
where the right hand side is no longer strictly $0$, but rather some function $f(x)$. The solution to such a differential equation is given by
where $y_0$ is the general solution to the “homogeneous” equation
and $y_f$ is a particular solution that satisfies the “inhomogeneous” equation
We already know how to use the characteristic polynomial to find $y_0$, and now we will learn how to use the method of undetermined coefficients to find $y_f$.
The method of undetermined coefficients involves guessing a solution $y_f(x)$ having the same form as $f(x)$, except possibly multiplied by some other coefficients. We then substitute this guess into the differential equation, and solve for the value of the coefficient that will make the guess correct.
Case of Exponential Function
For example, to find a particular solution to the differential equation $y’^\prime+2y’+y=1-2e^{3x}$, we can guess that $y_f(x)=A+Be^{3x}$ for some values of $A$ and $B$. Substituting our guess into the equation, we can solve for the correct values of $A$ and $B$.
Our particular solution is then given by $y_f(x)=1-\frac{1}{8}e^{3x}$. Then, using the characteristic polynomial method, we solve $y’^\prime+2y’+y=0$ to find $y_0(x)=(C_1+C_2)e^{-x}$. The full solution to the differential equation $y’^\prime+2y’+y=1-2e^{3x}$ is then given by
Case of Trig Functions with Same Angle
In cases where $f(x)$ contains $\sin \theta$ or $\cos \theta$, we include both $\sin \theta$ and $\cos \theta$ in our guess for $y_0$.
For example, to find a particular solution to the differential equation $y’’^\prime-3y’^\prime+2y’=-3\cos 2x$, we need to construct a guess that contains both $\sin 2x$ and $\cos 2x$. Our guess, then, is
We substitute this guess into the differential equation and simplify.
Equating coefficients on the left and right sides of the equation yields a system of equations for $A$ and $B$.
Solving this system, we find $A=\frac{3}{40}$ and $B=-\frac{9}{40}$. The particular solution is then $y_f(x) = \frac{3}{40} \sin 2x - \frac{9}{40} \cos 2x$.
Using the characteristic polynomial to solve $y’’^\prime-3y’^\prime+2y’=0$ yields $y_0(x)=C_1+C_2 e^x + C_3 e^{2x}$, and the full solution of the differential equation $y’’^\prime-3y’^\prime+2y’=-3\cos 2x$ is then given by
Case of Trig Functions with Different Angles
When we have multiple values of $\theta$, we end up with even more unknown coefficients in our guess.
For example, to find a particular solution to the differential equation $y’^\prime-2y=4\sin 3x - \cos 5x$, we need to construct a guess that contains both $\sin \theta$ and $\cos \theta$, for both $\theta = 3x$ and $\theta = 5x$. Our guess, then, is
We substitute this guess into the differential equation and simplify.
Equating coefficients on the left and right sides of the equation yields $A=-\frac{4}{11}$, $B=0$, $C=0$, and $D=\frac{1}{27}$. The particular solution is then $y_f(x) = -\frac{4}{11} \sin 3x + \frac{1}{27} \cos 5x$.
Using the characteristic polynomial to solve $y’^\prime-2y=0$ yields $y_0(x) = C_1e^{\sqrt{2} x} + C_2e^{-\sqrt{2} x}$, and the full solution of the differential equation $y’^\prime-2y=4\sin 3x -\cos 5x$ is then given by
Case of Polynomial Functions
Lastly, the differential equation $y’^\prime+y’=x^3-2x+e^{2x}$ has a polynomial and an exponential term, so our guess for the particular solution needs to contain a polynomial and an exponential term.
The polynomial in the differential equation is of degree $3$, and the differential equation itself is of degree $2$, so our guess needs to contain a polynomial of degree $3+2=5$.
We substitute this guess into the differential equation and simplify.
Equating coefficients on the left and right sides of the equation yields $A=0$, $B=\frac{1}{4}$, $C=-1$, $D=2$, $E=-4$, and $G=\frac{1}{6}$. The coefficient $F$ can still be any number, so we leave it as-is. The particular solution is then
Using the characteristic polynomial to solve $y’^\prime+y’=0$ yields $y_0(x) = C_1 + C_2 e^has {-x}$, and the full solution of the differential equation $y’^\prime+y’=x^3-2x+e^{2x}$ is then given by
To eliminate redundancy, we can lump the $F$ constant into the $C_1$ constant, since $C_1+F$ is itself just another constant.
Exercises
Use the method of undetermined coefficients to solve the following differential equations. (You can view the solution by clicking on the problem.)
$\begin{align*} 1) \hspace{.5cm} y''+y=4e^{5x} \end{align*}$
Solution:
$\begin{align*} y=C_1 \cos x + C_2 \sin x + \frac{2}{13}e^{5x} \end{align*}$
$\begin{align*} 2) \hspace{.5cm} y'+3y=\sin(2x) \end{align*}$
Solution:
$\begin{align*} y=C_1e^{-3x}+\frac{3\sin 2x - 2\cos 2x}{13} \end{align*}$
$\begin{align*} 3) \hspace{.5cm} y''-y'=\cos(\pi x) \end{align*}$
Solution:
$\begin{align*} y=C_1e^x + C_2 - \frac{\sin (\pi x)+ \pi \cos (\pi x)}{\pi + \pi^3} \end{align*}$
$\begin{align*} 4) \hspace{.5cm} y'''-2y'=x^2+1 \end{align*}$
Solution:
$\begin{align*} y=C_1e^{\sqrt{2}x} + C_2e^{-\sqrt{2}x} + C_3 - \frac{1}{6}x^3-x \end{align*}$
$\begin{align*} 5) \hspace{.5cm} 2y'-y=\sin(x)-\cos(2x) \end{align*}$
Solution:
$\begin{align*} y=C_1 e^{\frac{1}{2}x}-\frac{\sin x + 2 \cos x}{5} + \frac{\cos(2x)-4\sin(2x)}{17} \end{align*}$
$\begin{align*} 6) \hspace{.5cm} 2y'+y=e^x+3\sin(x) \end{align*}$
Solution:
$\begin{align*} y=C_1e^{-\frac{1}{2}x} + \frac{1}{3}e^{x} + \frac{3\sin x- 6\cos x}{5} \end{align*}$
$\begin{align*} 7) \hspace{.5cm} 4y''-9y=2x^4-3x^2+\cos(x+1) \end{align*}$
Solution:
$\begin{align*} y=C_1e^{\frac{3}{2}x} + C_2e^{-\frac{3}{2}x} - \frac{2}{9}x^4-\frac{23}{27}x^2-\frac{1}{13}\cos(x+1)-\frac{184}{243} \end{align*}$
$\begin{align*} 8) \hspace{.5cm} y'+y=\sin(2x+1)+\cos(5x)+1 \end{align*}$
Solution:
$\begin{align*} y=C_1e^{-x} + \frac{5\sin(5x)+\cos(5x)}{26} + \frac{\sin(2x+1)-2\cos(2x+1)}{5}+1 \end{align*}$
This post is part of the book Justin Math: Calculus. Suggested citation: Skycak, J. (2019). Undetermined Coefficients. In Justin Math: Calculus. https://justinmath.com/undetermined-coefficients/
Want to get notified about new posts? Join the mailing list.