Given \( y = x + \frac{1}{x} \), we are asked to simplify the expression \( x^4 + x^3 - 4x^2 + x + 1 \).
Start by expanding \( y = x + \frac{1}{x} \), and then manipulate the given expression by substituting \( y \) and simplifying it accordingly. Ultimately, the simplification leads to the answer \( x^2(y^2 + y - 6) \).