First, expand the term being squared on the right hand of the equation using this rule:
(a - b)^2 = a^2 - 2ab + b^2(a−b)2=a2−2ab+b2
Substituting xx for aa and 22 for bb gives:
y = (x + 5)(x - 2)^2y=(x+5)(x−2)2
y = (x + 5)(x^2 - (2 * x * 2) + 2^2)y=(x+5)(x2−(2⋅x⋅2)+22)
y = (x + 5)(x^2 - 4x + 4)y=(x+5)(x2−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))y=(x+5)(x2−4x+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))(x×x2)−(x×4x)+(x×4)+(5×x2)−(5×4x)+(5×4)
y = x^3 - 4x^2 + 4x + 5x^2 - 20x + 20y=x3−4x2+4x+5x2−20x+20
We can now group and combine like terms in descending order by the power of the exponent for the xx variables::
y = x^3 - 4x^2 + 5x^2 + 4x - 20x + 20y=x3−4x2+5x2+4x−20x+20
y = x^3 + 1x^2 + (-16)x + 20y=x3+1x2+(−16)x+20
y = x^3 + x^2 - 16x + 20y=x3+x2−16x+20