So by only two distinct roots I meant that the polynomial, say $f(x)$, is of the form $f(x) = (x-a)^{p}(x-b)^{q}$. Now, I also wish to know this if $a, b \in \mathbb{C}$. That is it is possible that $a$ has a non-zero imaginary part while $b$ is an integer and vice versa. It would really help if there was some easy method to find it out. Also I would like to know the suitability of the term only two distinct roots. Thank you for the help!
Tell if a polynomial has only two distinct roots
algebra-precalculuspolynomials
Related Solutions
A complex number $x_0$ is a root of multiplicity $m>1$ of $a(x)$ if and only if $a(x)=(x-x_0)^mb(x)$ for some polynomial $b(x)$ with $b(x)\not=0$. By considering the derivative of $a(x)$ we find that $$a'(x)=m(x-x_0)^{m-1}b(x)+(x-x_0)^{m}b'(x)=(x-x_0)^{m-1}(mb(x)+(x-x_0)b'(x)).$$ Hence $x_0$ is a root of $a'(x)$ of multiplicity $m-1>0$.
So a multiple root of $a(x)$ can be found by checking whether $a(x)$ and $a'(x)$ have a common root, i.e. by finding the roots of the greatest common divisor of $a(x)$ and $a'(x)$.
In your case $a(x)=4 x^4 + 5 x^2 + 7 x + 2$, and it follows that $$\gcd(a(x),a'(x))=2x+1.$$ Therefore $x=-1/2$ is a multiple root of $a(x)$ (of multiplicity $2$).
Im coming from differential topology so Im not sure this is the way you want to think about this. But anyway lets denote the space of normalized polynomials of degree $d$ by $$ V_d := \{ z^d + a_{d-1} z^{d-1} + ... + a_0 \; | \; a_i \in \mathbb{C} \} \overset{\sim}{=} \mathbb{C}^d $$ as an affine space of (real) dimension $2d$. Since we want to think about roots, consider the smooth submersion (elementary symmetric polynomials appear in coordinates) \begin{align*} q:\mathbb{C}^d &\to V_d \\ (b_1,\ldots,b_d) &\mapsto (z-b_1) \ldots (z-b_d) \end{align*} and the smooth map $$ p:\mathbb{C}^d \to \mathbb{C} \\ (b_1, \ldots , b_d) \mapsto \prod\limits_{i,j} (b_i - b_j)$$ You can proove that $0$ is a regular value so $p^{-1}(0) \subset \mathbb{C}^d $ is submanifold of codimension $2$. Now $q:p^{-1}(0) \to V_d$ is an embedding and its image $V_d^0$ is the space of polynomials with multiple roots. Now you can consider your $F$ as a (hopefully smooth (better holomorphic)) map $$F: \mathbb{C} \to V_d \\ \lambda \mapsto F_\lambda$$
For $\lambda \in \mathbb{C}$ we have that $$ F_\lambda \in V^0_d \Leftrightarrow \exists z_0 \in \mathbb{C}: F_\lambda(z_0) = 0 \text{ and } \frac{\partial F_\lambda}{\partial z}(z_0) = 0$$ Your condition that $F$ is non-singular shows that for any $\lambda$ with $F_\lambda \in V^0_d$ we must have $\frac{\partial F}{\partial \lambda}(\lambda) =F'(\lambda) = D_\lambda F \neq 0$ (as a polynomial, since we know there exists $z_0$ with $\frac{\partial F}{\partial \lambda}(\lambda,z_0 ) \neq 0$). That is, the map $F: \mathbb{C} \to V_d$ is transversal to $V_d^0$. So $$F^{-1}(V^0_d) = \{\lambda \in \mathbb{C} \;| \; F(\lambda,z) \text{ has less than } d \text{ distinct roots} \}$$ is smooth submanifold of $\mathbb{C}$ with (real) codimension $2$, i.e. its a zero dimensional submanifold, i.e. its a discrete set of points.
Best Answer
Polynomial $f \in \mathbb{C}[x]$ has exactly $\deg f-\deg (\gcd(f,f'))$ distinct (complex) roots.
Proof (sketch). Write $f(x)=(x-\alpha_1)^{k_1}\cdots(x-\alpha_n)^{k_n}$ where $\alpha_i$ are distinct roots and $k_i\geq 1$ their multiplicities, then you can show $\gcd(f(x),f'(x))=(x-\alpha_1)^{k_1-1}\cdots(x-\alpha_n)^{k_n-1}$ and so $f(x)/\gcd(f(x),f'(x))$ is just $(x-\alpha_1)\cdots(x-\alpha_n)$, also called squarefree part of $f$. Its degree $n$ is number of distinct roots of $f$. $\square$
In your case you need to check $\deg f-\deg (\gcd(f,f'))=2$. For this note that $\gcd(f,f')$ can be computed efficiently using Euclid's algorithm for polynomials. If you need the exact roots $a,b$, you can extract them from $f/\gcd(f,f')$ using the quadratic formula.
Example. Consider $f(x)=x^6-9x^5 + 33x^4 - 63x^3 + 66x^2 - 36x + 8$. Then $$f'(x)=6x^5 - 45x^4 + 132x^3 - 189x^2 + 132x - 36$$ and $\gcd(f(x),f'(x))=x^4 - 6x^3 + 13x^2 - 12x + 4$. Hence $\deg f-\deg \gcd(f,f')=2$ and so $f$ has exactly two distinct roots. Furthemore $f(x)/\gcd(f(x),f'(x))=x^2-3x+2$ and so the two roots are $a=1$ and $b=2$. With a bit more work we can find the exponents. Let $f(x)=(x-a)^p(x-b)^q$, then it can be shown that $$\frac{f'(x)}{\gcd(f(x),f'(x))}=(p+q)x-(qa+pb).$$ In the example $f'(x)/\gcd(f(x),f'(x))=6x-9$ and so by comparing the coefficients we get $p=q=3$, i.e. $f(x)=(x-1)^3(x-2)^3$.
Using for example PARI/GP the number of distinct roots by the above method can be computed as: