# Solution for y'' + y = sin(x) using method of undetermined coefficients

• timsea81
In summary: I don't quite understand what it is doing, but I'll assume it is to create a linearly independent expression that is still a solution to the original nonhomogeneous equation, but is not contained within Yh due to the multiplication by x, which would make it linearly dependent (right?).I think I'm getting hung up on the fact that the solution I chose was the same form as Yh and therefore I had to multiply through by x, but that seems like a huge coincidence. Is this something that, if I had chosen the solution Yp = C'cos(x) + D'sin(x), I would have had to multiply through by x^2?In summary, when using the method of undetermined coefficients
timsea81
y" + y = sin(x)

## Homework Statement

Solve y" + y = sin(x) for y=y(x) using the method of undetermined coefficients

## The Attempt at a Solution

The homogeneous solution Yh = Asin(x) + Bcos(x)

The particular solution Yp = Csin(x).

Y''p = -Csin(x)
Y''p + Yp = -Csin(x) + Csin(x) = 0

No C exists to make Y''p + Yp = sin(x) for all x

What am I doing wrong?

because the sin(x) gives an undetermined coefficient set {sin(x), cos(x)} and a member of this set (in this case both) satisfies the homogeneous solution Yh = Asin(x) + Bcos(x), you must multiply every member of the UC set by x. So now your UC set is {xsinx, xcosx}

Does that make sense? I tried to follow your notation pattern, mine is slightly different.

Thanks for the help. I thought it might be something along those lines but I still get a trivial answer:

Yp = Csin(x) + Dcos(x)
y''p = -Csin(x) - Dcos(x)

y''p + Yp = (C-C)sin(x) + (D-D)cos(x) = 0

Wait, I just read what you wrote a little more carefully and noticed the extra "x" in the set {xsin(x), xcos(x)}

a) Where does this "x" come from?
b) Does this mean I chose a particular solution of the form C(x)sin(x) + D(x)cos(x)?

Perhaps my biggest downfall is not really understanding what I am doing, just doing it. Aka, I'm an algorithm applier. So, I cannot tell you where the x comes from, only that you need to multiply every term in the UC set by x if one member of the UC set will satisfy the "complementary" part of the solution. Let's level on notation and terms first so we are sure to be talking about the same things here, especially with the terms being similar in multiple parts.
Your solution will be of the form $y=y_c+y_p$ where $y_c$ is the "complementary" part and $y_p$ is the "particular" part. I am using the method of undetermined coefficients from section 4.6 in my book, but they are presented in 4.5 as well, where 4.5 uses a more elementary technique. I never did section 4.5, so hopefully you and I are on the "same page" lol...

For my notation, I would first say $y_c=C_1\cos{x} +C_2\sin{x}$
Then, the sinx in the original problem gives a UC set of {sinx, cosx}. Since I see those terms in my $y_c$ equation, I must multiply the set by x, getting {xsinx, xcosx}.
Now, I will find $y_p$
$y_p=Ax\sin{x} +Bx\cos{x}$
and then you do $Ax\sin{x} +Bx\cos{x} = \sin{x}$ and solve all that jazz for A and B

EDIT: Err, I mean you take the derivative two times and do all that jazz to find A and B, you know what I mean?

So, does that help clarify everything? Sorry I can't tell you why, just what and how.

Last edited:

timsea81 said:
Thanks for the help. I thought it might be something along those lines but I still get a trivial answer:

Yp = Csin(x) + Dcos(x)
y''p = -Csin(x) - Dcos(x)

y''p + Yp = (C-C)sin(x) + (D-D)cos(x) = 0

Wait, I just read what you wrote a little more carefully and noticed the extra "x" in the set {xsin(x), xcos(x)}

a) Where does this "x" come from?
The explanation is on the longish side. It has to do with how you deal with repeated roots of the characteristic equation.

Here is the short version. If the characteristic equation of the DE has a factor (x - r), then the associated solution set of the homogeneous equation contains erx. If the characteristic equation has a repeated factor (x - r)2, then the associated solution set of the homogeneous equation contains erx and xerx.

Similarly, if there is a repeated factor (x - r)3, the solution set contains erx, xerx, and x2erx.

This pattern continues in the same way.
timsea81 said:
b) Does this mean I chose a particular solution of the form C(x)sin(x) + D(x)cos(x)?
No, if your notation is what I think it is. I am interpreting C(x) and D(x) as functions of x. What you want is Cxsin(x) + Dxcos(x) for your particular solution.

ArcanaNoir said:
Perhaps my biggest downfall is not really understanding what I am doing, just doing it. Aka, I'm an algorithm applier. So, I cannot tell you where the x comes from, only that you need to multiply every term in the UC set by x if one member of the UC set will satisfy the "complementary" part of the solution. Let's level on notation and terms first so we are sure to be talking about the same things here, especially with the terms being similar in multiple parts.
Your solution will be of the form $y=y_c+y_p$ where $y_c$ is the "complementary" part and $y_p$ is the "particular" part. I am using the method of undetermined coefficients from section 4.6 in my book, but they are presented in 4.5 as well, where 4.5 uses a more elementary technique. I never did section 4.5, so hopefully you and I are on the "same page" lol...

For my notation, I would first say $y_c=C_1\cos{x} +C_2\sin{x}$
Then, the sinx in the original problem gives a UC set of {sinx, cosx}. Since I see those terms in my $y_c$ equation, I must multiply the set by x, getting {xsinx, xcosx}.
Now, I will find $y_p$
$y_p=Ax\sin{x} +Bx\cos{x}$
and then you do $Ax\sin{x} +Bx\cos{x} = \sin{x}$ and solve all that jazz for A and B

EDIT: Err, I mean you take the derivative two times and do all that jazz to find A and B, you know what I mean?

So, does that help clarify everything? Sorry I can't tell you why, just what and how.

Yes, what you are saying makes sense. I don't expect a full answer to "why" in the thorough sense, but what you're saying is that because Yp happens to be the same as Yh (or Yc in your notation) in that it is some linear combination of sin(x) and cos(x), you have to multiply the x through Yp to get some new expression to work with.

Unfortunately, I'm still not getting the right answer. This approach reduces to:
Y''p + Yp = (A+B)cos(x) + (A-B)sin(x) = sin(x)
This tells me that A+B=0 and A-B=1? That can't be.

Mark44 said:
The explanation is on the longish side. It has to do with how you deal with repeated roots of the characteristic equation.

Here is the short version. If the characteristic equation of the DE has a factor (x - r), then the associated solution set of the homogeneous equation contains erx. If the characteristic equation has a repeated factor (x - r)2, then the associated solution set of the homogeneous equation contains erx and xerx.

Similarly, if there is a repeated factor (x - r)3, the solution set contains erx, xerx, and x2erx.

This pattern continues in the same way.

No, if your notation is what I think it is. I am interpreting C(x) and D(x) as functions of x. What you want is Cxsin(x) + Dxcos(x) for your particular solution.

If I understand you correctly, this is an explanation of the methods for finding Yh. There are 3 cases:
#1: roots m and n are real and distinct --> y=Ae^mx + Be^nx
#2: roots are real and equal m --> y=e^mx(A+Bx)
#3: roots are complex a+bi and a-bi --> y=e^ax[Acos(bx)+Bsin(bx)]

This is an example of case 3 but I'm not having trouble with the homogeneous solution (Yh or Yc). I'm having trouble with the particular solution Yp.

And yes, my notation was off in the expression "C(x)sin(x) + D(x)cos(x)" I meant a constant C or D times x, not functions of x; C(x) and D(x)

I got A=0 and B=-1/2
Maybe you did a derivative wrong?
What did you have for y''p?

ArcanaNoir said:
I got A=0 and B=-1/2
Maybe you did a derivative wrong?
What did you have for y''p?

Something wrong (see attached)

#### Attachments

• IMAG0301.jpg
16.8 KB · Views: 1,250

your yp' is okay but you make a couple mistakes getting to yp''

I got it now. I forgot to differentiate the 3rd and 6th term in the step from Yp' to Y''p.

glad to procrastinate from my own diffy-q :)

timsea81 said:
If I understand you correctly, this is an explanation of the methods for finding Yh. There are 3 cases:
#1: roots m and n are real and distinct --> y=Ae^mx + Be^nx
#2: roots are real and equal m --> y=e^mx(A+Bx)
#3: roots are complex a+bi and a-bi --> y=e^ax[Acos(bx)+Bsin(bx)]

This is an example of case 3 but I'm not having trouble with the homogeneous solution (Yh or Yc). I'm having trouble with the particular solution Yp.
In terms of the derivative operator D, your differential equation can be written as $$(D^2+1)y = \sin x.$$ If you apply (D2+1) one more time, you get
$$(D^2+1)(D^2+1)y = (D^2+1)\sin x = 0.$$ Why would you want to do this? Because (D2+1) annihilates the forcing function sin x, leaving you with a homogeneous equation, y'''' + 2 y'' + y = 0, which you know how to solve. The characteristic equation has repeated roots, so you'll find that y has the form
$$y(x) = Ax\sin x+Bx\cos x+C\sin x + D\cos x.$$ The last two terms correspond to the homogeneous solution of the original differential equation; the first two terms, to the particular solution.

## 1. What is the importance of the equation "Y + y = sin(x)" in science?

The equation "Y + y = sin(x)" is important in science because it represents a fundamental relationship between three variables – Y, y, and x. This equation is commonly used in physics, engineering, and other scientific fields to describe the relationship between a dependent variable (Y), an independent variable (x), and a constant (y).

## 2. What does the variable "x" represent in the equation "Y + y = sin(x)"?

The variable "x" in the equation "Y + y = sin(x)" represents the independent variable. It is the variable that is manipulated or controlled in an experiment or study. In this equation, "x" represents the angle in radians, which is used to calculate the sine function.

## 3. How is the equation "Y + y = sin(x)" used in real-world applications?

The equation "Y + y = sin(x)" has many real-world applications, particularly in physics and engineering. It is used to describe various physical phenomena, such as simple harmonic motion, waves, and oscillations. It also has practical applications in fields such as acoustics, electronics, and optics.

## 4. What is the difference between the variables "Y" and "y" in the equation "Y + y = sin(x)"?

The variables "Y" and "y" in the equation "Y + y = sin(x)" represent two different quantities. "Y" represents the dependent variable, which is affected by changes in the independent variable "x". On the other hand, "y" is a constant that does not change and is used to shift the sine function on the y-axis.

## 5. Can the equation "Y + y = sin(x)" be solved algebraically?

No, the equation "Y + y = sin(x)" cannot be solved algebraically because it has more than one variable. To solve this equation, numerical methods or graphing techniques are typically used. However, the equation can be rearranged to solve for one variable in terms of the others, such as solving for "x" in terms of "Y" and "y".

• Calculus and Beyond Homework Help
Replies
7
Views
667
• Calculus and Beyond Homework Help
Replies
7
Views
902
• Calculus and Beyond Homework Help
Replies
6
Views
755
• Calculus and Beyond Homework Help
Replies
18
Views
2K
• Differential Equations
Replies
52
Views
2K
• Calculus and Beyond Homework Help
Replies
7
Views
817
• Calculus and Beyond Homework Help
Replies
3
Views
1K
• Calculus and Beyond Homework Help
Replies
2
Views
375
• Calculus and Beyond Homework Help
Replies
12
Views
563
• Calculus and Beyond Homework Help
Replies
8
Views
936