The user is asking for the general solution to the second-order linear non-homogeneous differential equation:
dx2d2y+y=cos(x).
-
Identify the type of ODE:
- It's linear because y′′ and y are to the first power.
- It has constant coefficients (1 and 1).
- It is non-homogeneous because the RHS is , not .
dx2d2y+y
we must solve for the complementary function (yc) and the particular integral (yp). The general solution is the sum of these two parts: y.
Step 1: Find the Complementary Function (yc)
First, we solve the homogeneous equation (setting the right-hand side to 0):
dx2d2y+y
The auxiliary equation is:
m2+1=0
m2=−1
Since the roots are complex (m=0±1i), the complementary function is of the form eαx(C. Here and .
yc=C1cos(x)+C
Step 2: Find the Particular Integral (yp)
We need to find a specific solution to the non-homogeneous equation. We use the method of undetermined coefficients.
Normally, for a right-hand side of cos(x), we would try a solution of the form yp=Acos(x)+B. However, and are already part of the complementary function ().
When the trial function overlaps with the complementary function, we must multiply the trial function by the lowest power of x that removes the overlap. In this case, we multiply by x.
Modified trial solution:
yp=x(Acos(x)+Bsin(x))
Now, find the first and second derivatives of yp:
First derivative (yp′):
Use the product rule (uv)′=:
Second derivative (yp′′):
Differentiate yp′ again:
Substitute into the original ODE:
Substitute yp′′ and yp into :
[−2Asin(x)+2Bcos(x)−
The terms with x cancel out:
−2Asin(x)+2Bcos(x)=cos(x)
Solve for coefficients A and B:
Equate the coefficients of sin(x) and cos(x) on both sides:
- Coefficient of sin(x): −2A=0⟹A=0
- Coefficient of cos(x:
Substitute A and B back into the particular integral expression:
yp=x
Step 3: General Solution
Combine the complementary function and the particular integral:
y=yc+yp
Final Answer:
y=C1cos(x)+C2