Variation of parameter VS Undetermined Coefficients

In summary, the method of variation of parameters and the method of undetermined coefficients are both techniques used to solve certain types of differential equations. Variation of parameters is applicable to a broader class of equations, particularly non-homogeneous linear differential equations, by allowing the coefficients of the complementary solution to vary rather than remain constant. Undetermined coefficients, on the other hand, is typically used for linear differential equations with specific forms of non-homogeneous terms, such as polynomials, exponentials, and sines or cosines, where the form of the particular solution is guessed based on the non-homogeneous part. While both methods aim to find particular solutions, their applicability and approach differ significantly.
  • #1
Davidian
4
2
TL;DR Summary: Variation of parameter VS Undetermined Coefficients

Hi all,

Suppose we want to solve the following ODE
2y''+y'-y=x+7
with two different methods: undetermined coefficients and variation of parameters.
The solutions to the homogeneous problem are given by y_1(x)=exp(-x) and y_2(x)=exp(x/2) and their Wronskian is (3/2)exp(-x/2).
Undetermined coefficients: by assuming the particular solution to be of the form Ax+B, we find y_p(x)=-x-8 so that the solution is given by
y(x)=c1exp(-x)+c2exp(x/2)-x-8

Variation of parameters: by applying the formula we have u1(x)=-(2/3)(x+6)exp(x) and u2(x)=-(2/3)(2x+18)exp(-x/2) so that if we write
y(x)=u1(x)y1(x)+u2(x)y2(x)=c1exp(-x) +c2exp(x/2) -2x-16
so there is a mismatch of a factor 2 in the particular solution.

Am I doing something silly?

Thanks,
Davide
 
Physics news on Phys.org
  • #2
Have you checked which of your solutions actually satisfies the ODE?

That aside, if you don't show your working we can't find where or why you went wrong. I suspect, however, that to use variation of parameters you must rewrite the ODE as [tex]
y'' + \tfrac12y' - \tfrac12 y = \tfrac12(x + 7)[/tex] so that the coefficient of [itex]y'[/itex] is 1.
 
Last edited:
  • #3
Hello @Davidian ,
:welcome: ##\qquad##!​

Davidian said:
TL;DR Summary: Variation of parameter VS Undetermined Coefficients

Hi all,

Suppose we want to solve the following ODE
$$2y''+y'-y=x+7$$
with two different methods: undetermined coefficients and variation of parameters.
Notice how the legibility improves by using a little ##\LaTeX## ?
The link is to the lower left of the editing window :smile:

The solutions to the homogeneous problem are given by ##y_1(x)=e^{-x} ## and ##y_2(x)=e^{x/2}## and their Wronskian is ##{3\over 2} e^{-x/2}##.

Undetermined coefficients: by assuming the particular solution to be of the form ##Ax+B##, we find ##y_p(x)=-x-8## so that the solution is given by $$y(x)=c_1\,e^{-x}+c_2\, e^{x/2}-x-8$$
Agree.

Variation of parameters: by applying the formula we have $$\begin{align*} u_1(x)&=-{\textstyle {2\over 3}}(x+6)\,e^{x}\qquad \sf \text{and} \\u_2(x)&=-{\textstyle {2\over 3}} (2x+18)\, e^{x/2}\end{align*}$$
I'm lost. What formula is that ? In my book (Stewart, Calculus, 5e) ##u_1## and ##u_2## have to satisfy$$u_1' y_1+ u_2' y_2 = 0 \quad{\sf\text{and}}\quad u_1'y_1' + u_2' y_2' ={\textstyle {1\over 2}}(x+7)$$but your ##u## don't satisfy the first one ...
(so I didn't bother to check the second :smile:)

##\ ##
 
  • #4
Thanks for the reply: here are the calculations.
The characteristic polynomial is given by
$$
\lambda^2+\lambda-1=0,
$$
whose roots are ##\lambda=-1## and ##\lambda=-1/2##. The solution to the homogeneous problem is
$$
y(x)=c_1e^{-x}+c_2e^{x/2}.
$$
and the Wronskian is
$$
e^{-x}\frac{1}{2}e^{x/2} +e^{-x}e^{x/2}=\frac{3}{2}e^{-x/2}.
$$
Assuming the particular solution of the form
$$
y_p(x)=Ax+B,
$$
and inserting in the original problem gives
$$
A-Ax-B=x+7,
$$
which gives ##A=-1## and ##B=-8##. Combining these results gives
$$
y(x)=c_1e^{-x}+c_2e^{x/2}-x-8.
$$
I want to solve the same problem with the Variation of Parameters method. So I start by assuming ##\ y_1(x)=e^{-x}## and ##\ y_2(x)=e^{x/2}##, and thus the first coefficient is
$$
u_1(x)=-\int \frac{e^{x/2}(x+7)}{W(x)}dx=-\frac{2}{3}\int e^{x}(x+7)dx=-\frac{2}{3}(x+6)e^x+c_1
$$
while the second is
$$
u_2(x)=\int \frac{e^{-x}(x+7)}{W(x)}dx=-\frac{2}{3}\int e^{-x/2}(x+7)dx=-\frac{2}{3}(2x+18)e^{-x/2}+c_2
$$
Combining all pieces gives
$$
y(x)=\left(-\frac{2}{3}(x+6)e^x+c_1\right)e^{-x}+\left(-\frac{2}{3}(2x+18)e^{-x/2}+c_1\right)e^{x/2}
$$
which becomes
$$
-\frac{2}{3}x-4+c_1e^{x}-\frac{4}{3}x-12 +c_2e^{x/2}.
$$
Combining all terms gives
$$
y(x)=c_1e^{-x}+c_2e^{x/2}-2x-16
$$
so a mismatch of a factor two in the particular solution.

The solution obtained with the Undetermined Coefficients method satisfies the differential equation, while the solution obtained with the Variation of the Parameters method does not satisfy the differential equation. In fact it gives the rest ##(x+7)## which depends on the factor two that I found in the solution with the second method.

Davide
 
Last edited by a moderator:
  • #5
BvU said:
Hello @Davidian ,
:welcome: ##\qquad##!​
Notice how the legibility improves by using a little ##\LaTeX## ?
The link is to the lower left of the editing window :smile:Agree.I'm lost. What formula is that ? In my book (Stewart, Calculus, 5e) ##u_1## and ##u_2## have to satisfy$$u_1' y_1+ u_2' y_2 = 0 \quad{\sf\text{and}}\quad u_1'y_1' + u_2' y_2' ={\textstyle {1\over 2}}(x+7)$$but your ##u## don't satisfy the first one ...
(so I didn't bother to check the second :smile:)

##\ ##
Thank you for your reply.

The formula is the generic one for the method
$$
u_1(x)=-\int\frac{y_2(x)g(x)dx}{W(x)}+c_1,
$$
while for
$$
u_2(x)=\int\frac{y_1(x)g(x)dx}{W(x)}+c_2,
$$
where ##\ g(x)## is the non homogeneous term. It is the same as the solution of the two conditions you posed, apart from the factor 1/2 in front of the second.

Thanks,
Davide
 
Last edited:
  • #6
Good to see you speak ##\TeX## :smile:. But: enclose in double $ for displayed math and in double # for in-line math.
Tex tip: {\textstyle {1\over 2 }} (##{\textstyle {1\over 2 }}##) in displayed math looks better than {\displaystyle {1\over 2 }} (##{\displaystyle {1\over 2 }}##) .

Davidian said:
..
The characteristic polynomial is given by ##\lambda^2+\lambda-1=0,##
whose roots are ##\lambda=-1## and ##\lambda=-1/2##. The solution to the homogeneous problem is
$$
y(x)=c_1e^{-x}+c_2e^{x/2} $$and the Wronskian is
$$
e^{-x}\frac{1}{2}e^{x/2} +e^{-x}e^{x/2}=\frac{3}{2}e^{-x/2}.
$$
Assuming the particular solution of the form ##y_p(x)=Ax+B##, and inserting in the original problem gives ##
A-Ax-B=x+7##, which gives ##A=-1## and ##B=-8##. Combining these results gives
$$
y(x)=c_1e^{-x}+c_2e^{x/2}-x-8.
$$
And agreed.

I want to solve the same problem with the Variation of Parameters method. So I start by assuming ##y_1(x)=e^{-x}## and ##y_2(x)=e^{x/2}##, and thus the first coefficient is $$
u_1(x)=-\int \frac{e^{x/2}(x+7)}{W(x)}dx=-\frac{2}{3}\int e^{x/2}(x+7)dx=-\frac{2}{3}(x+6)e^x+c_1
$$while the second is$$
u_2(x)=\int \frac{e^{-x}(x+7)}{W(x)}dx=-\frac{2}{3}\int e^{-x/2}(x+7)dx=-\frac{2}{3}(2x+18)e^{-x/2}+c_2
$$Combining all pieces gives $$
y(x)=\left(-\frac{2}{3}(x+6)e^x+c_1\right)e^{-x}+\left(-\frac{2}{3}(2x+18)e^{-x/2}+c_1\right)e^{x/2}
$$which becomes$$
-\frac{2}{3}x-4+c_1e^{x}-\frac{4}{3}x-12 +c_2e^{x/2}.
$$Combining all terms gives$$
y(x)=c_1e^{-x}+c_2e^{x/2}-2x-16
$$so a mismatch of a factor two in the particular solution.

The solution obtained with the Undetermined Coefficients method satisfies the differential equation, while the solution obtained with the Variation of the Parameters method does not satisfy the differential equation. In fact it gives the rest ##(x+7)## which depends on the factor two that I found in the solution with the second method.
Well, there must be a bug in there somewhere, but I have to chew on it (rusty... :frown: )

##\ ##
 
  • #7
I think I understood my mistake.
The solutions ##\ u_1(x)## and ##\ u_2(x)## can be obtained by using the formula I posted only if the coefficients of the second order term is equal to 1. In my example, I need to divide everything by a factor 2.

Thanks for your help!
Davide
 
Last edited:
  • Like
Likes berkeman and BvU
  • #8
Good thing you found it... would have taken me a while...

##\ ##
 

FAQ: Variation of parameter VS Undetermined Coefficients

What is the main difference between the method of variation of parameters and the method of undetermined coefficients?

The main difference lies in their applicability and approach. The method of undetermined coefficients is typically used for linear differential equations with constant coefficients and specific types of non-homogeneous terms (like polynomials, exponentials, sines, and cosines). In contrast, the method of variation of parameters is more general and can be applied to a wider range of non-homogeneous differential equations, including those with variable coefficients and more complex non-homogeneous terms.

When should I use the method of undetermined coefficients?

The method of undetermined coefficients should be used when the non-homogeneous term of the differential equation is a simple function such as a polynomial, exponential, sine, or cosine, and the differential equation has constant coefficients. This method is straightforward and efficient for these types of equations.

When is the method of variation of parameters preferred?

The method of variation of parameters is preferred when the non-homogeneous term is not a simple function like those suitable for undetermined coefficients, or when the differential equation has variable coefficients. This method is more versatile and can handle a broader class of differential equations.

Can both methods be used for the same differential equation?

In some cases, both methods can be applied to the same differential equation, especially if the equation has constant coefficients and a simple non-homogeneous term. However, the method of undetermined coefficients is usually simpler and more straightforward in such cases, so it is often preferred when applicable.

What are the limitations of the method of undetermined coefficients?

The method of undetermined coefficients is limited to linear differential equations with constant coefficients and specific types of non-homogeneous terms. It cannot be used for equations with variable coefficients or for non-homogeneous terms that do not fit the simple forms (polynomials, exponentials, sines, and cosines). For more complex non-homogeneous terms, the method of variation of parameters is required.

Back
Top