I am trying to prove the following statement:
If the polynomial $f(x)$ of degree $n$ has roots $a_1,a_2,...,a_k$ with multiplicities $\alpha_1,\alpha_2,...,\alpha_k$ in a field $F$ (with $\alpha_i\geq 1$), then $f(x)$ has $(x-a_1)^{\alpha_1}\cdots (x-a_k)^{\alpha_k}$ as a factor. In particular, a polynomial of degree $n$ in one variable over a field $F$ has at most $n$ roots in $F$, even counted with multiplicity.
This is the proof that I wrote
For the first part, we proceed by induction on $k$. If $k=1$, then by definition, we may write $f(x)=(x-a_1)^{\alpha_1}q(x)$. Now, suppose that the statement is true for up to $k$ roots, and consider a collection of $k+1$ roots. Using the inductive hypothesis, we may write $$f(x)=(x-a_1)^{\alpha_1}\cdots (x-a_k)^{\alpha_k}q(x)\quad\text{ and }\quad f(x)=(x-a_{k+1})^{\alpha_{k+1}}q'(x)$$ Equating $$(x-a_1)^{\alpha_1}\cdots (x-a_k)^{\alpha_k}q(x)=(x-a_{k+1})^{\alpha_{k+1}}q'(x)$$ and using the fact that $(x-a_{k+1})$ is an irreducible element that is distinct from any on the left hand side gives us that $(x-a_{k+1})^{\alpha_{k+1}}\mid q(x)$, which proves the first statement.
Now, suppose that a polynomial $f(x)$ of degree $n$ as more than $n$ roots in $F$, counted with multiplicity. From what we showed, we must have $(x-a_1)^{\alpha_1}\cdots (x-a_k)^{\alpha_k}\mid f(x)$. But $F[x]$ is an integral domain so this is impossible, as the divisor has a higher degree than $f(x)$.
I was first wondering if the proof was correct. Moreover, in proving the first half of the statement I used the fact that an irreducible element is prime, which leverages the fact that $F[x]$ is a U.F.D. Is there a more general method of proof that works on general integral domains?