Polynomial ring with isomorphic quotients [duplicate]

If $R$ is a commutative ring and $f(x), g(x) \in R[x]$ two polynomials such that $R[x]/f(x)\cong R[x]/g(x)$ as $R$-algebras, what can we say about $f$ and $g$?

Or given $f(x)\in R[x]$, what can we say about the set $\{g \in R[x]\mid R[x]/f(x) \cong R[x]/g(x)\}$?

Can we conclude that $\mathrm{deg}(f) = \mathrm{deg}(g)$? Is there an automorphism of $R[x]$ taking $f$ to $g$?

I'm most concerned about the cases where $R=k$ is a field, $R=\mathbb{Z}$, or $R=\mathcal{O}_k$ is the ring of integers of a number field, but I'd be interested in the most general results possible.


Many things can be said about the question, but I will let you think about some of them. Let me at least point you in some direction. First, if $R$ has nilpotents, then clearly $\deg f$ need not be the same as $\deg g$. For example, if $0\neq a\in R$ is a nilpotent, then easy to check that you can take $f=x, g=x+ax^2$.
So, assume that $R$ has no non-trivial nilpotents. Marco Lecci's argument says that $\deg f=\deg g$ if $R$ is a field and that can be easily adapted even if $R$ is an integral domain. Let $a$ be the leading coefficient of $f$ and let $P$ be a prime ideal not containing $a$ (which exists since $a$ is not nilpotent). Going mod $P$, we have the same situation, but over a domain. Also, the degree of $f$ is unchanged. This implies $\deg f\leq \deg g$. Situation is symmetric (do this with the leading coefficient of $g$) and thus we get equality.


Let $f(X), g(X) \in R[X]$ s.t $ R[X]/\langle f(X)\rangle\simeq R[X]/\langle g(X)\rangle$ the image of $f(X)$ by the compositor R-algebras morphisms $R[X] \twoheadrightarrow R[X]/\langle f(X)\rangle \simeq R[X]/\langle g(X)\rangle$ is $0$ in $R[X]/\langle g(X)\rangle$, so $f(X)\in \langle g(X)\rangle$, by the same argument $f(X)\in \langle g(X)\rangle$; so $f(X)=l(X)g(X)$ and $g(X)=q(X)f(X)$, then $f(X)=l(X)q(X)f(X)$, therefore $(l(X)q(X)-1)f(X)=0$ in $R[X]$. So if $R$ is a domain then $(l(X)q(X)-1)=0$, so $l(X)$ and $q(X)$ are units in $R[X]$, therefore units in $R$, we conclude in particular $\deg f=\deg g$.