On the construction of the polynomial for the step of contradiction in Hilbert's basis Theorem I don't understand a step in this proof of the Hilbert Basis Theorem. Here is the proof Planeth Math.
I don't understand why $ \mathrm{deg} (f_{N+1}-g)< \mathrm{deg}(f_{N+1}) $. This can only happen if $ g $ has the same degree as $ f_{N+1} $ and also the same leading term, but I don't know why.

I'll walk you through the proof (and will answer your question in a comment to this answer):
We claim that if $R$ is a Noetherian ring then so is the ring of polynomials $R[x]$.

Proof:
Our idea to prove this is to show that an arbitrary ideal of $R[x]$ is finitely generated.
To this end, let $I$ be an ideal of $R[x]$. Now we construct a sequence of polynomials $f_k$ as follows: Pick $f_1$ to be of minimal degree in $I$. Pick $f_{k+1}$ to be of minimal degree in $I \setminus \langle f_1 , \dots , f_k \rangle$. Note that by construction, $\mathrm{deg}(f_{k+1}) \geq \mathrm{deg}(f_i)$ for all $i \in \{1, \dots, k\}$.
Now if $f_k (x) = r_n x^n + \dots + r_1x + r_0$ then we denote by $a_k$ its leading coefficient $r_n$. Consider the set $J = \{a_1, a_2, \dots \}$. It's easy to see that this an ideal in $R$: If you add two of its elements $a_i + a_j$ then $a_i + a_j$ is the leading coefficient of $f_i + f_j$ and hence $J$ is closed with respect to addition. Also, if you multiply $a_i$ with an element in $R$, $ra_i$ is the leading coefficient of $r f_i$, so $J$ is also closed with respect to multiplication by elements of $R$. By assumption, $R$ is Noetherian, hence $J$ is finitely generated: $J = \langle a_1, \dots , a_N \rangle$.
We claim that $I = \langle f_1, \dots, f_N \rangle$.
By construction, $I \supset \langle f_1, \dots, f_N \rangle$.
For the other direction of inclusion assume that $I \supsetneq \langle f_1, \dots, f_N \rangle$. Then by the way we constructed $f_k$ we have $f_{N+1} \in I \setminus \langle f_1, \dots, f_N \rangle$. Now we construct a polynomial $g(x)$ with the same leading coefficient as $f_{N+1}$ as follows:
Note that $a_{N+1} = \sum_{i=1}^N a_i s_i$ for $s_i \in R, a_i \in J$ since $J$ is finitely generated. Define $g(x) := \sum_{i=1}^N a_i  f_i (x) x^{\mathrm{deg}(f_{N+1}) - \mathrm{deg} (f_i)} $. Then $g(x)$ has leading coefficient $a_{N+1}$ and the same degree as $f_{N+1}$. Hence $f_{N+1} - g(x)$ has degree strictly less than $f_{N+1}$ hence must be in $\langle f_1, \dots, f_N \rangle$, for if not, $f_{N+1}$ would not be of minimal degree in $I \setminus \langle f_1, \dots, f_N \rangle$. So we have $ f_{N+1}(x) - g(x) \in \langle f_1, \dots, f_N \rangle$.
By construction, we have $g(x) \in \langle f_1, \dots, f_N \rangle$. Therefore we also have $f_{N+1} \in \langle f_1, \dots, f_N \rangle$. But this is a contradiction since $f_{N+1} \in I \setminus \langle f_1, \dots, f_N \rangle$.
So we can conclude that we must have $I \subset \langle f_1, \dots, f_N \rangle$ and hence equality.
