Bezout's identity in $F[x]$

Hint $\ $ Mimic the proof for integers: $ $ the set $\rm\,I = \{a\, p + b\, q\ :\ a,b \in F[x]\}\,$ is closed under mod (remainders), so a least (degree) element $\rm\:g\ne 0\:$ must divide every element $\rm\,f\,$ (else its remainder $\rm\,f\ mod\ g\, =\, f-q\,g\in I\,$ has smaller degree than $\rm\,g,\,$ contra leastness of $\rm\:g).\,$ Thus $\rm\,p,q\in I\,\Rightarrow\,g\mid p,q,\:$ so $\rm\:g = 1,\:$ by $\rm\:gcd(p,q) = 1.\:$ Thus $\rm\:1\in I,\:$ i.e. $\rm\:1 = a\, p + b\, q.$


From André Nicolas's hint, I tried to formulate a proof. Please check if the proof is good.

Proof:

Construct $X = \{p(x)r(x)+q(x)s(x)\;|\;r(x),s(x)\in F[x]\}$, since the degree of the elements in $X$ are natural numbers (well-ordered), find a non-zero element that has minimal degree, call it $w(x)$. Let $w(x)$ be modified that its leading coefficient is positive (if not take $-w(x)$). Use euclidean division to yield $p(x) = u(x)w(x)+s(x)$. Now $s(x) = p(x)-u(x)w(x) \in X$, also euclidean algorithm tells us $\deg s(x)<\deg w(x)$, but $w(x)$ is minimal degree of the non-zero elements of $X$, therefore $s(x) = 0$. That is $w(x)$ divides $p(x)$. Using argument we can show $w(x)$ devices $q(x)$. That is $w(x)$ is a common divisor of $p(x)$ and $q(x)$ with positive leading coefficient. Let $u(x)$ be any common divisor of $p(x)$ and $q(x)$, then $u(x)$ is also a divisor of all elements in $X$, namely $w(x)$. Since $w(x)$ divides every common divisor of $p(x)$ and $q(x)$, it is the greatest common divisor of $p(x)$ and $q(x)$. $w(x) =1 $. Since $w(x)\in X$, we find some $1 = w(x) = r(x)p(x)+s(x)q(x)$.