Second order ODEs
Linear ODEs
Recall that in general a linear ODE of order \(n\) can be written in the form
Any linear ODE has general solution in the form
where the complementary function is the general solution to the homogeneous equation
while the particular integral is any solution of the original equation.
Second order linear homogeneous ODEs with constant coefficients
Second order linear homogeneous ODEs with constant coefficients (i.e. the functions \(a_j(x)\) are constants) can be written as
where \(a,b\) are constants.
Such ODEs are solved by considering the so-called auxiliary equation \(m^2+am+b=0\). We can solve this quadratic (by factorising, completing the square or using the quadratic formula) to find the two roots \(m_1\) and \(m_2\). Then
If \(m_1,m_2\) are both real, the general solution is of the form
\[ y=Ae^{m_1x}+Be^{m_2x}. \]If \(m_1=m_2\) (i.e. a repeated root), the general solution is of the form
\[ y=(A+Bx)e^{m_1x}. \]If \(m_1,m_2\) are complex conjugates, i.e. \(m_1=\alpha+i\beta\) and \(m_2=\alpha-i\beta\), then the general solution is of the form
\[ y=e^{\alpha x}\left(C\cos\beta x+D\sin\beta x\right). \]
Second order linear inhomogeneous ODEs with constant coefficients
We now consider equations of the form
Recall that the right hand side function \(f(x)\) is usually called the forcing term and that solutions of linear inhomogeneous ODEs are of the form
The complementary function is the solution to the homogeneous ODE
so can be found by our method for solving homogeneous second order ODEs (i.e. by considering the auxiliary equation).
To find the particular integral, we use the method of undetermined coefficients. This involves making an educated guess of the form of the particular integral (which will contain some unknown constants), before substituting this form into the ODE and comparing coefficients of various terms to obtain the particular solution.
How to choose the form of the particular integral
The choice of which form of particular integral \(y_p\) to try depends on the forcing term \(f(x)\).
If \(f(x)=\alpha x^n\), try
\[ y_p=a_0+a_1x+\ldots+a_{n-1}x^{n-1}+a_nx^n. \]If \(f(x)=\alpha \sin(\beta x)\) or \(f(x)=\alpha\cos(\beta x)\), try
\[ y_p=a_1\sin(\beta x)+a_2\cos(\beta x). \]If \(f(x)=\alpha e^{\beta x}\), try
\[ y_p=ae^{\beta x}. \]
Then substitute into the differential equation and compare coefficients to determine the values of any arbitrary constants.
Below are a couple of examples to illustrate how.
Example
Consider
This has auxiliary equation \(m^2-2m-3=0,\) which has roots \(m_1=3\) and \(m_2=-1\), so the complementary function is
Now suppose the particular integral is of the form \(y_p=ae^{2 x}\). Substitution of this into the ODE gives
For this to be satisfied, we see that \(a=-\frac{1}{3}\), and so the particular integral is \(y=-\frac{1}{3}e^{2x}\). Consequently the general solution of the ODE is
Example
Consider
This has the same auxiliary equation and so the same complementary function as the previous example. Now suppose the particular integral is of the form \(y_p=a_1\sin(3x)+a_2\cos(3x)\). Substitution of this into the ODE gives
which can be rewritten (by collecting coefficients of \(\sin\) and \(\cos\) terms) as
Consequently we need to find constants \(a_1,a_2\) so that \(6a_1+12a_2=0\) and \(6a_2-12a_1=2\). This is a pair of simultaneous equations with solution \(a_1=-\frac{2}{15},a_2=\frac{1}{15}.\) Therefore the particular integral is
Finally, \(y=y_c+y_p\), so the general solution is
If the forcing term is a sum of these types of function
If the forcing term is a sum of these types of function, try a sum of the suggested trial functions. For instance, if the forcing term is \(x+\sin x\), try
If the forcing term is a product of a polynomial with either an exponential or trigonometric function, try a product of such functions. For example, if the forcing term is \(xe^x\), try
IMPORTANT: cases for which the above forms do NOT work
There are some situations for which the forms of particular integral suggested above are insufficient:
When the usual form for the particular integral is the same form as the complementary function then we must modify the trial function by multiplying the usual form by \(x^k\), where \(k\) is is the number of times that a root of the auxiliary equation corresponding to the form of the trial function occurs.
Example
Consider
This has auxiliary equation \(m^2-2m+1=0,\) which has repeated root \(m_1=m_2=1\), so the complementary function is
Our usual trial function for the particular integral would be of the form \(y_p=ae^{x}\) BUT a term of this form is already included in the complementary function. Similarly a term of the form \(axe^x\) is included in the complementary function. Therefore \(ae^x\) and \(axe^x\) are solutions of the corresponding homogeneous equation
so are not useful as trial functions for the particular integral.
We should therefore try
[Note that this is the usual form multiplied by \(x^2\), because the root occurred twice.]
Example
Consider
This has auxiliary equation \(m^2+4=0,\) which has complex conjugate roots \(m_1=2i,m_2=-2i\), so the complementary function is
Since the forcing term is of this form, we should try
as our trial function.