Method of Undetermined Coefficient and Variations of Parameters
Contents
Method of Undetermined Coefficient and Variations of Parameters#
Method of Undetermined Coefficients (sec 2.9)#
If \(r(x)\) is a function s.t. \(r'(x)\) is like \(r(x)\), e.g. \(e^{\lambda x}\), \(\sin(\omega x)\), \(\cos(\omega x)\), \(x^n\)… we can choose \(y_P(x)\) based on \(r(x)\) \
Rules (from textbook)#
Table 2.1:
If \(r(x)=\) |
Choose \(y_P(x)=\) |
---|---|
$\(ke^{rx}\)$ |
$\(ce^{rx}\)$ |
\(kx^n\) (\(n=0,1,2...\)) |
\(K_nx^n + K_{n-1}x^{n-1} + ... + K_1x + K_0\) |
\(k\cos(\omega x)\) or \(k\sin(\omega x)\) |
\(K\cos(\omega x) + M\sin(\omega x)\) |
\(ke^{\alpha x}\cos(\omega x)\) or \(ke^{\alpha x}\sin(\omega x)\) |
\(e^{\alpha x}(K\cos(\omega x) + M\sin(\omega x))\) |
Here are some additional rules; we’ll see why these are important later:
Basic Rule. If \(r(x)\) is one of the functions in the first column in Table 2.1, choose in the same line and determine its undetermined coefficients by substituting \(y_p\) and its derivatives into the differential equation.
Modification Rule. If a term in your choice for \(y_p\) happens to be a solution of the homogeneous ODE corresponding to (4), multiply this term by x (or by \(x^2\) if this solution corresponds to a double root of the characteristic equation of the homogeneous ODE).
Sum Rule. If is a sum of functions in the first column of Table 2.1, choose for the sum of the functions in the corresponding lines of the second column.
\(\underline{\text{Recap}}\):
Given \(y'' + ay' + by = r(x) \hspace{3cm} (*)\)
Solve \(y'' + ay' + by = 0\) to get \(y_H(x) = c_1y_1 + c_2y_2\)
Then choose \(y_P(x)\) based on \(r(x)\)
Plug back into \((*)\) to check:
Therefore, \(y_P'' + ay_P' + by_P = r(x)\) and \(y_P\) is a linear solution to the problem (which is why only some functions work)
Example: \(y'' + 2y' - 3y = 4e^{2x}\)#
Find \(y_H(x)\)
Choose \(y_P(x)\) based on \(r(x)\)
\(\implies\) Since \(r(x) = 4e^{2x}\), let’s pick \(y_p(x) = Ke^{2x}\), where \(K\) is the undetermined coefficient (not arbitrary)Find \(K\) from non-homogeneous ODE
Write down general solution
Still need 2 IC’s to find \(c_1\) and \(c_2\)
Non-homogeneous Linear \(2^\circ\) ODEs Continued#
\(\underline{\text{Caution}}\): If you choose a \(y_P(x)\) that is not linearly independent of \(y_1\) and \(y_2\), things will go wrong.
Example: \(y'' - 4y = 4e^{2x}\)#
Solve \(y'' - 4y = 0\)
Choose \(y_P(x)\) based on \(r(x)\)
Since \(r(x) = 4e^{2x}\), choose \(y_P(x) = Ke^{2x}\) as before.
SPOILER: \(Ke^{2x}\) is not linearly independent of \(y_1(x) = e^{2x}\)Find \(K\) from non-homogeneous ODE
Step back:
If \(y_p\) isn’t linearly independent, it can be absorbed into \(y_H(x)\).
Solution: If \(y_P(x)\) is linearly dependent on \(y_1(x)\) or \(y_2(x)\), multiply \(y_P(x)\) by \(x\) to obtain a linearly independent new \(y_P(x)\) based on Reduction of Order.
Therefore, choose \(y_P(x) = Kxe^{2x}\). Then,
Find \(K\)
General Solution
Another place to be careful:
\(\implies\) Double roots yields a homogeneous solution
\(\implies\) Again, you must be careful to select \(y_P(x)\) s.t. it is linearly independent.
\(\implies\) if \(r(x) \propto e^{\lambda x} \) or \(xe^{\lambda x}\), then \(y_P(x) = Kx^2e^{\lambda x}\) (Obtained from a second reduction of order)
More complex example: \(y'' + 2y' -3y = -3x^2 + \sin(x)\)#
Solve the homogeneous ODE
Choose \(y_P(x)\) based on \(r(x)\)
\(\underline{\text{Rule}}\): If \(r(X)\) is a sum of wo functions, then \(y_P(x)\) should be a sum of the corresponding functions.
Find undetermined coefficients from ODE
Plugging into ODE:
Rearrange to collect ‘like’ terms
Determine the values of the coefficients on each \(f(x)\) that will solve the equation
\(-3Ax^2 = -3x^2 \implies A = 1\)
\((4A-3B)x - 0\) because \(r(x)\) has no ‘\(x\)’ term . Hence, \(4-3B = 0 \implies B = \frac{4}{3}\)
\(2A + 2B - 3C = 0 \implies 2+\frac{8}{3} - 3C = 0 \implies C=\frac{14}{9}\)
\(-K -2M -3K = 1 \implies 2M = -4K -1 \implies M = -2K -\frac{1}{2}\)
(315)#\[\begin{align} -M + 2K -3M = 0\\ 2K = 4M\\ K = 2(-2K-\frac{1}{2}) = -4K-1\\ \implies K = -\frac{1}{5}\\ \implies M = -\frac{1}{10} \end{align}\](316)#\[\begin{align} \therefore y_P(x) = -3x^2 + \frac{4}{3}x + \frac{14}{9}-\frac{1}{10}(2\sin x + \cos x) \end{align}\]
Write down the general solution
Variation of Parameters#
Non-homogeneous, linear \(2^\circ\) ODEs are solvable with Method of Undetermined Coefficients only when \(r(x)\) is one of the functions discussed.
If \(r(x)\) is something different, we need an alternate method \(\rightarrow\) variation of parameters.
Requires calculation of the Wronskian of the ODE
The value of the Wronskian answers the question: Does a solution exist for the homogeneous equation \(y'' + p(x)y' + q(x)y = 0\) ? (specifically at initial condition \(x=x_0\))
For \(y(x) = c_1y_1(x) + c_2y_2(x)\), the Wronskian is defined as a determinant:
If \(W(y_1,y_2) = 0\) at \(x=x_0\), then \(y_1\) and \(y_2\) are linearly dependent \(\rightarrow\) not good
If \(W(y_1,y_2) \neq 0\) on the interval of interest, which includes \(x_0\), then the solutions \(y_1\) and \(y_2\) are linearly independent.
Example#
Constant coefficient case with 2 distinct roots: \(y_1=\lambda_1e^{\lambda_1 x}\) and \(y_2 = \lambda_2e^{\lambda_2 x}\)
which never equals zero except for \(\lambda_2 = \lambda_1\) which by definition is not the case. Therefore, solution exists for all initial conditions.
Variation of Parameters (sec 2.10)#
For solving \(y'' + p(x)y' + q(x)y = r(x)\)
where \(p(x)\), \(q(x)\) and \(r(x)\) are continuous over some interval \(I\).
\(\implies\) Based on same idea as reduction of order
First, find \(y_H(x) = c_1y_1 + c_2y_2\)
Then we will base \(y_P(x)\) on \(y_H(x)\), \(\underline{\text{not}}\) \(r(x)\) like before
where \(u(x)\) and \(v(x)\) are “parameters” that replace \(c_1\) and \(c_2\) in \(y_H(x)\)
Since there is only one equation \((*)\) for \(y_P(x)\) and two unknown functions (\(u(x)\) and \(v(x)\)), there will likely be many choices of \(u\) and \(v\) that will work.
However, we can impose an additional constraint (since there is an extra degree of freedom) if we like
Choose this constraint to help simplify the solution method
That simplifies our first derivative
then,
We can then plug these terms back into non-homogeneous ODE:
Rearrange strategically:
By definition, \(y_1\) and \(y_2\) are solutions of homogeneous equation so \(y_1''+py_1'+qy_1=0\) and \(y_2''+py_2'+qy_2\). Thus
We now have two equations with two unknowns \(u\) and \(v\)
Could solve by Gauss Elimination or by something called Cramer’s rule, which says
for \(\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} b_1 \\b_2 \end{bmatrix}\)
that
and
and then
Therefore, V.O.P can be written as:
Nice solution technique because it’s general and can be used for any \(r(x)\)
Example#
First, let’s do one that can be solved with MUC or VoP
for either solution method, solve \(y''+y=0\) first
if using MUC, choose
substitute,
and
if using VoP, then
where
We know \(r(x)\), \(y(x)\) and \(y_2(x)\). Let’s find the Wronskian
Hence,
Then,
and
\(\underline{\text{Ques}}\): Which method would you prefer in this case? What if we had many undefined coefficients?
Example#
Now an example for which we can’t use MUC
Solve homogeneous case
Assume \(y_P(x) = u(x)y_1(x) + v(x)y_2(x)\)
Find Wronskian
Hence,
Then
Write down general solution
Still need two IC’s to find particular solution