The equations $x^3+5x^2+px+q=0$and $x^3+7x^2+px+r=0$ have 2 common roots, then find the third root of both equations 
The equations $x^3+5x^2+px+q=0$and $x^3+7x^2+px+r=0$ have 2 common roots, then find the third root of both equations       

From the first equation we can say, $\alpha\beta+\beta\gamma+\gamma\alpha=p/1=p$. Similarly from the second equation we know, $\alpha\beta+\beta\delta+\delta\alpha=p/1=p$
Hence,
$\alpha\beta+\beta\delta+\delta\alpha=\alpha\beta+\beta\gamma+\gamma\alpha$
$\delta(\beta+\alpha)=\gamma(\beta+\alpha)$
$\delta=\gamma$
Hence the third root of both equations should be equal, but $\alpha+\beta+\gamma=-5$ and $\alpha+\beta+\delta=-7$. Now, where did I go wrong?

$$
P(x) = x^3+5x^2+p x+q = (x-x_1)b(x)\\
Q(x) = x^3+7x^2+p x+r = (x-x_2)b(x)
$$
then
$$
Q(x)-P(x) = (x_1-x_2)b(x) = 2x^2+r-q
$$
and finally
$$
(x-x_1) = \frac{P(x)}{b(x)} = (x_1-x_2)\frac{x^3+5x^2+p x+q}{2x^2+r-q}\\
(x-x_2) = \frac{Q(x)}{b(x)} = (x_1-x_2)\frac{x^3+7x^2+p x+r}{2x^2+r-q}\
$$
so from any of those equations, equating to $0$ the polynomial coefficients we have
$$
2-x_1+x_2 = 0\\
5(x_1-x_2)+2x_1 = 0
$$
or
$$
2-x_1+x_2 = 0\\
7(x_1-x_2)+2x_2 = 0
$$
giving
$$
x_1 = -5,\ \ x_2 = -7
$$
