Let $n\geq 2$, $f(x)$ is a rational polynomial with degree $n$, and $x_1,\cdots,x_n$ are the complex roots of $f(x)$. If exists $1\leq i<j\leq n, x_i=x_j$, show that $f(x)$ is reducible in $\Bbb Q$.
My attempt: Argue by contradition. We assume $$f(x)=(x-x_i)^2(x-\bar x_i)^2g(x)$$ for some $x_i\in\Bbb C$ and $g(x)$ is a real polynomial. Then $f$ is reducible in $\Bbb R$.
What to do next?
Hint: consider $f'$ and $\mathbf{gcd}_{\Bbb R[X]}(f,f')$. Now, both $f$ and $f'$ are in $\Bbb Q[X]$, so what does that tell you about $\mathbf{gcd}_{\Bbb Q[X]}(f,f')$?
Remark. Recall that the derivative of a polynomial $f = a_0+a_1x+ \ldots a_n x^n$ is $$ f' := a_1+2a_2x + \ldots + na_n x^{n-1} $$
Here's a general fact about derivatives and multiple roots over $\Bbb Q$. Everything that follows can be made more general, but let's stick with polynomials over $\Bbb Q$ for a moment.
Note that "algebraic derivatives" as defined above still satisfy the usual rules $(f+g)' = f'+g'$ and $(fg)' = f'g'$. You can prove this inspecting the coefficients at both sides. Here is a characterization of double roots in terms of derivatives:
Lemma. The following are equivalent,
Proof. If $(X-\alpha)^2$ divides $f$ in $\Bbb C$, then $f = (X-\alpha)^2 g$ and taking derivatives we see that $$f' = (X-\alpha)^2 g' + 2(X-\alpha)g$$ is divisible by $X-\alpha$, hence $f'(\alpha) = 0$. Reciprocally, if $f'(\alpha) = 0$ dividing $f$ by $(X-\alpha)^2$ we get
$$ f = (X-\alpha)^2 q + r \tag{1} $$
with $r = 0$ or $\deg r \leq 1$. and taking derivatives,
$$ f' = (X-\alpha)^2q' + 2(X-\alpha)q + r' $$ hence evaluating at $\alpha$ yields $0 = f'(\alpha) = r'(\alpha)$. By degree considerations on $r$ it must be $r' = 0$, hence $r$ is constant. Evaluating at $(1)$ gives then $0 = f(\alpha) = r(\alpha)$ and thus $r = 0$, as desired. $\square$
Now, a double root $\alpha$ of $f$ is a common root of $f'$ and $f$, hence $X-\alpha \mid \mathbf{gdc}_{\Bbb C[X]}(f,f')$.
Note that $f$ and $f'$ are polynomials in $\Bbb Q[X]$ and $\Bbb C[X]$ and in both rings one can consider their greatest common divisor. If a polynomial divides both $f$ and $f'$ in $\Bbb Q[X]$, so it does over $\Bbb C[X]$. In particular $\mathbf{gdc}_{\Bbb Q[X]}(f,f') \mid f,f'$ in $\Bbb C[X]$ and so $\mathbf{gdc}_{\Bbb Q[X]}(f,f') \mid \mathbf{gdc}_{\Bbb C[X]}(f,f')$.
However, since there exists $g,h \in \Bbb Q[X]$ for which $\mathbf{gdc}_{\Bbb Q[X]}(f,f') = fg+f'h$ and $\mathbf{gdc}_{\Bbb C[X]}(f,f')$ divides both factors, we get the other division, hence
$$ \mathbf{gdc}_{\Bbb C[X]}(f,f') = \mathbf{gdc}_{\Bbb Q[X]}(f,f') =: (f,f'). $$
In particular, the former was already in $\Bbb Q [X]$. By the lemma, the polynomial $f$ has no double roots if and only if $(f,f') = 1$. In particular $f$ has no double roots if it is irreducible (here we use that $f'\neq 0$, essentially the same argument can be made in any field of characteristic zero). The contrapositive is what you needed.