First, expand the term being squared on the right hand of the equation using this rule:
(a - b)^2 = a^2 - 2ab + b^2
Substituting x for a and 2 for b gives:
y = (x + 5)(x - 2)^2
y = (x + 5)(x^2 - (2 * x * 2) + 2^2)
y = (x + 5)(x^2 - 4x + 4)
Next, we can multiply the two remaining terms by multiplying each term in the parenthesis on the left by each term in the parenthesis on the left:
y = (color(red)(x) + color(red)(5))(color(blue)(x^2) - color(blue)(4x) + color(blue)(4))
Becomes:
(color(red)(x) xx color(blue)(x^2)) - (color(red)(x) xx color(blue)(4x)) + (color(red)(x) xx color(blue)(4)) + (color(red)(5) xx color(blue)(x^2)) - (color(red)(5) xx color(blue)(4x)) + (color(red)(5) xx color(blue)(4))
y = x^3 - 4x^2 + 4x + 5x^2 - 20x + 20
We can now group and combine like terms in descending order by the power of the exponent for the x variables::
y = x^3 - 4x^2 + 5x^2 + 4x - 20x + 20
y = x^3 + 1x^2 + (-16)x + 20
y = x^3 + x^2 - 16x + 20