If a polynomial $g$ divides $f$ and $f'$, then $g^2$ divides $f$? Here's a homework problem from Artin's Algebra that I'm having a lot of trouble with

Let $f(x) \in F[x]$ (where $F$ is a field of characteristic $0$).  If $g$ is an irreducible polynomial that is a common divisor $f$ and $f'$, then $g^2$ divides $f$ (where $f'$ denotes the derivative of $f$ in $F[x]$).

Let $K$ be an extension of $F$ such that $f$ splits completely in $K$.  So we can write $f(x) = \prod_{i=1}^n (x - \alpha_i)$ for some $\alpha_i \in K$.  Because $g$ divides $f$ in $F[x]$, we know that $g$ divides $f$ in $K[x]$.  Since $g$ divides $f$ we can write $g(x) = \prod_{j=1}^m (x - \alpha_{i_j})$.  Because $g$ is a common divisor of $f$ and $f'$, the roots $\alpha_i$ have some multiplicity greater than $1$, so that $(x - \alpha_i)^2$ divide $f$ for each $i$ (**).  Then $g^2$ divides $f$.
I think this is the right idea, although it feels like there are some holes in the argument (specifically the sentence marked with (**) at the end).  I also don't think I used the assumption that $g$ is irreducible.  Does this look OK?
 A: You need to be much more careful with the (**) step.  Specifically what if there are repeated roots?  For example $f = (x - 1)^3$ and $g = (x - 1)^2$ would break your argument.  Of course that's not a counterexample to the theorem because the $g$ I listed isn't irreducible.
I think passing to a field extension is more complicated than this proof needs to be.  My suggestion is to start by saying $f = gk$ and then take the derivative of $f$ using the product rule.  You'll want to eventually conclude that $g$ divides $k$ so that then $g^2$ divides $f$.
A: There are already good answers to the actual question but let me show why characteristic zero is required for the exercise.   
Let $F$ be an imperfect field of characteristic $p\gt 0$ and let $a\in F$ be an element which is not the $p$-th power of an element of $F$: in other words $a\in F\setminus F^p$.
The polynomial $f(x)=g(x)=x^p-a\in F[x]$ is then irreducible (see here) .
But although $g$ divides $f$ (since $g=f$) and also divides $f'$ (since $f'=0$), $g^2=f^2$ does not divide $f$: the statement in the exercise fails in positive characteristic.
A: Derive the relation $f(x) = g(x) k(x)$.
Then, observe that the polynomials $g$ and $g'$ are relatively prime (since $g$ is irreducible). 
A: Since $g(x)$ divides $f(x)$, one has $f(x) = g(x)h(x)$ for some $h(x)$. Taking derivatives, one has 
$$f'(x) = g'(x)h(x) + g(x)h'(x)$$ 
Since $g(x)$ divides $f'(x)$, it divides $f'(x) - g(x)h'(x) = g'(x)h(x)$. Since $g(x)$ is irreducible, it is prime, so since it divides $g'(x)h(x)$ it must divide $g'(x)$ or $h(x)$. 
But $g'(x)$ is of lower degree than $g(x)$, so $g(x)$ must divide $h(x)$. Hence $f(x) = g(x)h(x) = g(x)^2p(x)$ for some polynomial $p(x)$.
