I was wondering if there was a way to find the common roots of 2 polynomials.
For example let $P_1(x) = x^5+x^3+2x^4-5x^2-7$ and $P_2(x) = 2x^7 +3x^3+4x^6+6x^2-14x^4-21$
Is there an algorithm or a method to find $P_1$ and $P_2$'s common roots?
I was wondering if there was a way to find the common roots of 2 polynomials.
For example let $P_1(x) = x^5+x^3+2x^4-5x^2-7$ and $P_2(x) = 2x^7 +3x^3+4x^6+6x^2-14x^4-21$
Is there an algorithm or a method to find $P_1$ and $P_2$'s common roots?
The general way to do this is to take the GCD of the two polynomials. In particular, one can apply the Euclidean algorithm to this, just like taking the GCD of two integers. In particular, the computation goes as follows: We start with $$\gcd(x^5+2x^4+x^3-5x^2-7,2x^7+4x^6-14x^4+3x^3+6x^2-21)$$ Then, we take the second polynomial mod the first. That is, we subtract multiples of $P_1$ from $P_2$ until we get a polynomial of degree 4. In particular, $P_2-(2x^2-2)P_1=5x^3+10x^2-35$, so we reduce the above to $$\gcd(5x^3+10x^2-35,x^5+2x^4+3x^3-5x^2-7)$$ Then, we take the polynomial remainder of the second polynomial mod the fist again, which results in $0$ since $$x^5+2x^4+3x^3-5x^2-7-(-1/5x^2-1/5)(5x^3+10x^2-35) = 0$$ thus, we can reduce to $$\gcd(0,5x^3+10x^2-35)$$ meaning that $5x^3+10x^2-35$ is the GCD of the two polynomials. This means that $x$ is a root of both $P_1$ and $P_2$ if and only if it is a root of $5x^3+10x^2-35$ or, equivalently, of $x^3+2x^2-7$.
This essentially works on the principle that if a polynomial has roots $r_1,\ldots,r_n$, then $(x-r_1)(x-r_2)\ldots (x-r_n)$ divides it. Thus, the product of all the shared roots must divide both polynomials and, in particular, must divide their GCD as well.
The general method for this is to consider that if the two polynomials $P_1$ and $P_2$ have a root in common, then the polynomial $$P_3=\lambda P_1+\mu P_2$$ also has the same common root for all choices of $\lambda$ and $\mu$.
So, for example, $$P_2-3P_1=P_3=2x^7+4x^6-3x^5-20x^4+21x^2$$
Now remove the factor $x^2$ since $x=0$ is clearly not the common root, and continue.
Subtracting $2P_1$ from this now gives $$P_4=-5x^3-10x^2+35$$
So the only common root of the original two polynomials is the single real root of the equation $$x^3+2x^2-7=0$$ which can be found as $1.4288...$