<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] Suppose $\alpha$ is the common root for the two quadratics $g(x)$ and $h(x)$. Then 
\begin{align*}
g(\alpha)=\alpha^2+a\alpha+b &=0\\
h(\alpha)=\alpha^2+b\alpha+a &=0
\end{align*}
Then solving for $\alpha$ gives $\alpha=1$ (assuming $a\neq b$). This also tells us
$$a+b=-1.$$
This means the quadratic equation $g(x)=0$ has roots $1,b$ and the quadratic 
equation $h(x)=0$ has roots $1,a$. Thus the three roots of the cubic are $1,a,b$. 
So sum of squares is 
$$1+a^2+b^2=1+(a+b)^2-2ab=1+1-2(-72)=146.$$
</s>