Let's start with verifying that these two equations are solutions to the homogeneous equation. This fact means that both fulfill the following case:
`xy'' -(1+x)y' + y = 0`
Before we continue, just remember that the homogeneous solution is automatically part of the general solution! This is true because if the equations above bring the DE to zero, then they can be added willy-nilly to the general solution and they won't affect the outcome! Just putting that out there.
So, verifying the homogeneous solution for `y_1`:
`xy_1'' - (1+x)y_1' + y_1 = 0`
`y_1' = 1`
`y_1'' = 0`
`x(0) - (1+x)(1) + (1+x) = 0`
`-1-x + 1 + x = 0`
And there we have it verified for `y_1`! Moving on.
Let's show it for `y_2`:
`xy_2'' - (1+x)y_2' + y_2 = 0`
Remember, because `y_2 = e^x` we know each of its derivatives are the same:
`x(e^x) - (1+x)e^x + e^x = 0`
`xe^x - e^x -xe^x + e^x = 0`
And, now we have it verified for `y_2`.
Now, we have to find the general solution. Variation of parameters will be the easiest way to take care of this. The general proof is likely in your textbook, and we don't have room here for it, so I'll just show the formula and how to use it.
`y_p(x) = -y_1int(y_2*f(x))/W dx + y_2int(y_1*f(x))/W dx`
Where `f(x)` is the nonhomogeneous part of our differential equation, and `W` is the Wronskian. So, we get the following:
`f(x) = x^2e^(2x)`
`W = y_1y_2' - y_1'y_2=(1+x)e^x - e^x = xe^x`
So, using our homogeneous solution at the f(x) and W we just found, we can calculate the particular solution:
`y_p = -(1+x)int(e^x*x^2e^(2x))/(xe^x) dx + e^x int((1+x)(x^2e^(2x)))/(xe^x) dx`
`y_p = -(1+x)int(xe^(2x))dx + e^x int xe^x + x^2e^x dx`
Now, you can use integration by parts to solve for the integrals; however, again, we don't have the space! So, we'll use what we engineers used to love before certain computer programs came around. An integral table (see link below):
`y_p = -(1+x)(e^(2x)/4 (2x-1) + e^x(e^x(x-1) + e^x(x^2-2x+2))`
`y_p = -(1+x)((xe^(2x))/2 - e^(2x)/4) + e^x(xe^x - e^x + x^2e^x -2xe^x +2e^x)`
`y_p = -(xe^(2x))/2 + e^(2x)/4 - (x^2e^(2x))/2 + (xe^(2x))/4 + xe^(2x) - e^(2x) + x^2e^(2x) - 2xe^(2x) + 2e^(2x)`
Ugh, that's long, but it looks like we have a lot of terms that are "like," so we can keep simplifying:
`y_p = 1/2 x^2e^(2x) - 5/4 xe^(2x) + 5/4 e^(2x)`
Now, we just combine this with our homogeneous solution. Recall, our generalized homogeneous solution will take the following form:
`y_h = c_1y_1 + c_2y_2`
So, we finally have our generalized solution:
`y = y_h+y_p=c_1(1+x)+c_2e^x + 1/2x^2e^(2x) - 5/4xe^(2x) + 5/4e^(2x)`
That was a lot of work, but we finally have our general solution. Now, in general, these problems are very long, but the cool thing about this method is that it works every time if you've figured out your homogeneous solution!
I hope that helps!