The given differential equation is $(D^2 - 2D + 1)y = x^2e^x$. This is a second-order linear non-homogeneous differential equation. The general solution $y$ is the sum of the complementary function $y_c$ and the particular integral $y_p$. $y = y_c + y_p$
Step 1: Find the complementary function ($y_c$)
The auxiliary equation is obtained by setting the left side to zero: $$ D^2 - 2D + 1 = 0 $$ $$ (D-1)^2 = 0 $$ The roots are $D = 1, 1$ (repeated roots). For repeated roots $m_1 = m_2 = m$, the complementary function is $y_c = (c_1 + c_2x)e^{mx}$. So, $y_c = (c_1 + c_2x)e^x$.
Step 2: Find the particular integral ($y_p$)
The particular integral is given by $y_p = \frac{1}{D^2 - 2D + 1} x^2e^x = \frac{1}{(D-1)^2} x^2e^x$. Since the right-hand side is of the form $e^{ax}V(x)$, where $a=1$ and $V(x)=x^2$, and $a$ is a root of the auxiliary equation (repeated root), we use the shifting property: $$ y_p = e^{ax} \frac{1}{F(D+a)} V(x) $$ Here, $a=1$, so we replace $D$ with $D+1$: $$ y_p = e^x \frac{1}{((D+1)-1)^2} x^2 $$ $$ y_p = e^x \frac{1}{D^2} x^2 $$ Now, we need to integrate $x^2$ twice with respect to $x$. First integration: $$ \int x^2 \, dx = \frac{x^3}{3} $$ Second integration: $$ \int \frac{x^3}{3} \, dx = \frac{1}{3} \int x^3 \, dx = \frac{1}{3} \frac{x^4}{4} = \frac{x^4}{12} $$ So, $y_p = e^x \frac{x^4}{12} = \frac{x^4e^x}{12}$.
Step 3: Write the general solution
The general solution is $y = y_c + y_p$: $$ y = (c_1 + c_2x)e^x + \frac{x^4e^x}{12} $$