Find the general solution of x(x+1) y'' + (x+2) y' - y = x +…
Find the general solution of $x(x+1)\,y'' + (x+2)\,y' - y = x + \frac1x$, given that the corresponding homogeneous equation has a polynomial particular solution.
Explanation of Method
Reduction of order from the polynomial solution $y_1=x+2$ gives $y_2=1/x$; full variation of parameters then produces the particular solution.
Step 1: Finding the polynomial homogeneous solution
Try $y_1=ax+b$ in $x(x+1)y''+(x+2)y'-y=0$; with $y_1'=a$, $y_1''=0$: \[0+(x+2)a-(ax+b) = 2a-b = 0 \implies b=2a.\]
Choosing $a=1$: $y_1=x+2$. Verify: $0+(x+2)\cdot1-(x+2)=0. $\checkmark$$
Step 2: Reduction of order
Set $y=(x+2)v$, so $y'=v+(x+2)v'$, $y''=2v'+(x+2)v''$. Substituting into the homogeneous equation, the $v$ terms cancel, leaving: $x(x+1)(x+2)\,v'' + \bigl[2x(x+1)+(x+2)^2\bigr]v' = 0.$
Since $2x(x+1)+(x+2)^2=3x^2+6x+4$: $x(x+1)(x+2)\,v'' + (3x^2+6x+4)\,v' = 0.$
Step 3: Solve for $w=v'$
Since $\dfrac{3x^2+6x+4}{x(x+1)(x+2)}=\dfrac2x-\dfrac1{x+1}+\dfrac2{x+2}$: \[\ln|w| = -2\ln|x|+\ln|x+1|-2\ln|x+2|+\mathrm{const} \implies w = A\,\frac{x+1}{x^2(x+2)^2}.\]
Step 4: Integrate for $v$
Since $\dfrac{x+1}{x^2(x+2)^2}=\dfrac1{4x^2}-\dfrac1{4(x+2)^2}$: $v = A\left(-\frac1{4x}+\frac1{4(x+2)}\right)+B.$
Step 5: Second homogeneous solution
Multiply through by $y_1=x+2$, combining the $A$-bracket into a single fraction rather than distributing term-by-term: \[(x+2)\!\left(-\frac1{4x}+\frac1{4(x+2)}\right) = \frac14\!\left(-\frac{x+2}{x}+1\right) = \frac14\cdot\frac{-(x+2)+x}{x} = -\frac1{2x}.\] So $y=(x+2)v=-\dfrac{A}{2x}+B(x+2)$; up to a constant multiple, the new solution is $y_2=1/x$.
Step 6: Verify $y_2=1/x$
\[ y_2'=-\frac1{x^2},\qquad y_2''=\frac2{x^3}. \]
\[ x(x+1)\cdot\frac2{x^3}+(x+2)\!\left(-\frac1{x^2}\right)-\frac1x = \frac{2(x+1)-(x+2)}{x^2}-\frac1x = \frac{x}{x^2}-\frac1x = 0.\ \checkmark \]
Step 7: Wronskian
\[ W(y_1,y_2) = (x+2)\!\left(-\frac1{x^2}\right)-\frac1x = -\frac{x+2}{x^2}-\frac1x = -\frac{2(x+1)}{x^2} \neq 0. \]
Step 8: Variation of parameters — setup
Write $y^*=u_1(x+2)+u_2\cdot\dfrac1x$. The standard-form right-hand side is $\dfrac{x+1/x}{x(x+1)}=\dfrac{x^2+1}{x^2(x+1)}$. By Cramer's rule, using the Wronskian above: $u_1' = \frac{x^2+1}{2x(x+1)^2}, \qquad u_2' = -\frac{(x+2)(x^2+1)}{2(x+1)^2}.$
Step 9: Integrate $u_1$
Since $\dfrac{x^2+1}{x(x+1)^2}=\dfrac1x-\dfrac2{(x+1)^2}$: \[u_1' = \frac12\!\left(\frac1x-\frac2{(x+1)^2}\right) \implies u_1 = \frac12\ln x + \frac1{x+1}.\]
Step 10: Integrate $u_2$
Expanding $(x+2)(x^2+1)=x^3+2x^2+x+2$ and dividing by $(x+1)^2=x^2+2x+1$ gives quotient $x$ and remainder $2$, i.e.\ $x^3+2x^2+x+2=x(x+1)^2+2$, so
\[ u_2' = -\frac{x(x+1)^2+2}{2(x+1)^2} = -\frac{x}2-\frac1{(x+1)^2} \implies u_2 = -\frac{x^2}4+\frac1{x+1}. \]
Step 11: Assemble $y^*$
\[ y^* = \left(\frac{\ln x}2+\frac1{x+1}\right)(x+2) + \left(-\frac{x^2}4+\frac1{x+1}\right)\frac1x = \frac{(x+2)\ln x}2 + \frac{x+2}{x+1} - \frac{x}4 + \frac1{x(x+1)}. \]
Combine the two rational pieces over a common denominator: \[\frac{x+2}{x+1}+\frac1{x(x+1)} = \frac{x(x+2)+1}{x(x+1)} = \frac{(x+1)^2}{x(x+1)} = \frac{x+1}{x} = 1+\frac1x.\]
\[ y^* = \frac{(x+2)\ln x}2 - \frac{x}4 + 1 + \frac1x. \]
Step 12: General solution
The solution is recorded in the result below.
Result
Final answer:
\[\boxed{\,y = C_1(x+2) + \frac{C_2}{x} + \frac{(x+2)\ln x}{2} - \frac{x}{4} + 1\,}\]
Remark
Caution. Reading the bracket term-by-term instead suggests $y_2=(x+2)/x$; direct substitution shows this does not satisfy the homogeneous equation (it leaves a residual $-1$). Combining the fraction as above, as done here, gives the correct $y_2=1/x$.
Simplifying. Of the two extra pieces $1+1/x$, only $1/x$ is a multiple of the homogeneous solution $y_2$ and can be dropped into $C_2$; the constant $1$ is not itself a solution of the homogeneous equation (substituting $y=1$ leaves a residual $-1$), so it cannot be absorbed and must remain part of $y^*$. Direct substitution confirms $y^*=\frac{(x+2)\ln x}2-\frac{x}4+1$ satisfies $x(x+1)y''+(x+2)y'-y=x+1/x$ exactly, whereas dropping the constant $1$ leaves a residual of $1$ on the left-hand side.