### Instruction: Find the polynomial $p(x)$ such that
\[p(p(x)) = xp(x) + x^2.\].### Response: To find $p(x)$, I will try to guess its degree and then find its coefficients by comparing both sides of the equation.
If $p(x)$ has degree $n$, then $p(p(x))$ has degree $n^2$, and $xp(x) + x^2$ has degree $n+1$.
Therefore, the only possible value of $n$ that makes the degrees match is $n=1$, so $p(x)$ must be a linear polynomial of the form $p(x) = ax + b$.
Now I need to find $a$ and $b$.
I will plug in $p(x) = ax + b$ into both sides of the equation and simplify.
On the left side, I get
\[p(p(x)) = a(ax + b) + b = a^2 x + ab + b.\]
On the right side, I get
\[xp(x) + x^2 = x(ax + b) + x^2 = (a+1)x^2 + bx.\]
Comparing the coefficients of $x^2$, I get $a+1 = 0$, so $a = -1$.
Comparing the coefficients of $x$, I get $a^2 = b$, so $b = (-1)^2 = 1$.
Therefore, I have found the polynomial $p(x) = -x + 1$.