I'm not even sure where to begin... Help will be appreciated
$(x-a)^2(x-b) = x^3+px+q$
$(x-a)^2(x-b) = (x^2-2ax+a^2)(x-b) = x^3-(2a+b)x^2+(2ab+a^2)x-a^2b$
$-(2a+b) = 0$
$-a^2b = q$
This is a system of three equations in four variables. So, solve for $p$ in terms of $q$.
$x^3 + px + q = (x - a)^2(x - b) = (x^2 - 2ax + a^2)(x - b) = x^3 - bx^2 - 2ax^2 + 2abx + a^2x - a^2b =$
$x^3 - (2a + b)x^2 + a(a + 2b)x - a^2b.$ Straight forward.
The coefficients of the powers must be equal in the right hand and left expressions.
$\therefore q = - a^2b\ and\ p = a(a + 2b)\ and\ 2a + b = 0.$
$q = - a^2b\ and\ p = a(a + 2b)\ and\ 2a + b = 0.$
from the last one $b=-2a$
substitute that into the first two and you get