I'm having a problem with the following differential equation, from a Sixth Term Examination Paper question (STEP 3 2011 Q1). The problem arises with me trying to apply a technique in an earlier part of the question to a later part.
The third part of the question (iii) asks to find a general solution to the differential equation: $$(x+1)\frac{d^2y}{dx^2} + x\frac{dy}{dx} - y = (1+x)^2$$
An earlier part of the question (ii) asks to find a solution to a similar differential equation: $$(x+1)\frac{d^2y}{dx^2} + x\frac{dy}{dx} - y = 0$$ Using the substitution $y = ze^{-x}$, where $z$ is some function of $x$. I managed to get this to work, and using this substitution the equation turns into
$$\frac{d^2z}{dx^2} - \frac{x+2}{x+1}\frac{dz}{dx} = 0$$
Which is fairly straightforward to solve using methods such as the integrating factor, as this is just a first order differential equation in $\frac{dz}{dx}$.
However, applying this to the third part of the question (iii) I assumed that the equation would just turn into
$$\frac{d^2z}{dx^2} - \frac{x+2}{x+1}\frac{dz}{dx} = (1+x)^2$$
Since the $(1+x)^2$ on the right hand side does not depend on $y$.
However, this is wrong and the $(1+x)^2$ turns into $(1+x)e^x$. I don't know if I am just missing some step and rushing to the substitution but I don't see how to get this $(1+x)e^x$ function, and this solution from The Student Room skips over the step.
Please can you show me how the substitution results in $(1+x)e^x$?
$$(x+1)\frac{d^2y}{dx^2} + x\frac{dy}{dx} - y = (1+x)^2$$ If you change the variable then: $$y=ze^{-x}$$ $$y'=z'e^{-x}-ze^{-x}$$ $$y''=z''e^{-x}-2z'e^{-x}+ze^{-x}$$ So that the differential equation: $$(x+1)\frac{d^2y}{dx^2} + x\frac{dy}{dx} - y = (1+x)^2$$ Becomes: $$(x+1)(z''e^{-x}-2z'e^{-x}+ze^{-x}) + x(z'e^{-x}-ze^{-x})- ze^{-x} = (1+x)^2$$ You have to multiply the whole equation by the exponential $e^x$ since it's not zero on the RHS this explains the presence of the exponential on RHS. $$(x+1)(z''-2z'+z) + x(z'-z)- z =\color {red}{e^x} (1+x)^2$$ $$(x+1)z''- z'(x+2) =\color {red}{e^x} (1+x)^2$$ When you change the variable in the homogeneous equation you have on RHS: $$(x+1)(z''e^{-x}-2z'e^{-x}+ze^{-x}) + x(z'e^{-x}-ze^{-x})- ze^{-x} = 0$$ $$e^{-x}((x+1)(z''-2z'+z) + x(z'-z)- z) = 0$$ $$(x+1)(z''-2z'+z) + x(z'-z)- z = e^x \times 0$$ $$(x+1)z''-z'(x+2) = 0$$