<s>[INST] Quadratic equations having a common root. I have a cubic polynomial $f(x)=x^3+px^2+qx+72$ which is divisible by both $x^2+ax+b$ and $x^2+bx+a$ (where a,b,p,q are constants and a$ \neq $b).I have to find the sum of the squares of the the roots of the cubic polynomial.
I tried to attempt it like this.
Since the quadratics divide the polynomial its roots must be the same as the roots of the quadratics. 
Let the roots of the first quadratic be A and B and that of second quadratic be D and E.
Now for having 3 roots of the cubic polynomial one root of the 2 quadratics must be common.Then suppose B=D.
Now from the first quadratic $A+B=-a$ and $AB=b$.From second quadratic $B+E=-b$ and $BE=a$.
We need the sum of squares of the roots of the cubic polynomial i.e. $A^2+B^2+E^2$.We have $A^2+B^2+E^2=(A+B+E)^2-2(AB+BE+AE)$.We have $A+B+E=-p$ and $AB+BE+AE=q$.So $A^2+B^2+E^2=-p-2q$.
I don't know how to proceed.
 [/INST] The roots are 1, 8, 9. From here you can simply sum the cubes.
Now for the solution:
As you noted your two quadratics have a common root. Let this root be called $y$. Then $y^2 + ay + b = 0$ and $y^2 + by + a = 0$. This is a system of two equations. Solving we get $(a-b)y = (a-b)$. Since $a \neq b$ we conclude $y=1$.
Now since $1$ is a root of $x^2 + ax +b$ we conclude $1+a+b = 0$ or $a+b = -1$.
Furthermore since the quadratics divide the cubic we have $(x-1)(x^3+px^2+qx+72) = (x^2+ax+b)(x^2+bx+a)$. This gives us that $ab = -72$. But now we have two equations for $a,b$. We solve and get that $a = 8$ and $b = -9$ or $a = -9$ and $b = 8$.
We will use $a = 8$ and $b = -9$. From here it is a simple matter to factor the two quadratics and find the roots.
</s>