Let $A$ be a commutative ring with $1$ and let $S=\{f^n|n\in\mathbb{N}_0\}$ for some $f\in A$ be a subset of $A$. Show that the localization $A_f:=S^{-1}A$ of $A$ in $S$ is isomorphic (as an $A$-algebra) to the quotient ring $A[X]/\langle fX-1\rangle$.
Clearly, $S$ is closed under multiplication and $1=f^0\in S$, so $S^{-1}A$ is well-defined. I have tried to establish an isomorphism by constructing an algebra homomorphism $g:A[X]\to S^{-1}A$ with kernel $\langle fX-1 \rangle$. The existence of such a homomorphism would imply the needed isomorphism because of the homomorphism theorem. I have tried using $$g:A[X]\to S^{-1}A,\ \ \ a_nX^n+\dots+a_1X+a_0 \mapsto \frac{a_n}{f^n}+\dots+\frac{a_1}{f^1}+\frac{a_0}{f^0}.$$ It is easy to show that $g$ is a homomorphism of algebras and that it is surjective ($\frac{a}{f^n}=g(aX^n)$ for all $a\in A, n\in\mathbb{N}_0$). It is also clear that $\langle fX-1\rangle\subset ker(g)$ since $$g(fX-1)=\frac{f}{f^1}+\frac{-1}{1}=\frac{f-f}{f}=\frac{0}{1}.$$ Now it only remains to show that $ker(g)\subset\langle fX-1\rangle$, but here I have some difficulties. From my understanding, if the statement that I try to show is true, then $ker(g)\subset\langle fX-1\rangle$ must also be true, so it should be possible to show this somehow. So far I have done the following:
Let $h=a_nX^n+\dots+a_1X+a_0\in ker(g)$, then we have \begin{align*} \frac{0}{1} & = \frac{a_n}{f^n}+\dots+\frac{a_1}{f^1}+\frac{a_0}{f^0}\\ & = \frac{a_nf^{n-1}\cdots f^0+a_{n-1}f^{n}f^{n-2}\cdots f^0+\dots+a_0f^n\cdots f^1}{f^n\cdots f^0}\\ & = \frac{a_n+a_{n-1}f+\dots+a_0f^n}{f^n}. \end{align*} Hence, by the definition of the equivalence classes (the elements of $S^{-1}A$) there exists some $m\in\mathbb{N}_0$ such that $$0 = a_nf^m+a_{n-1}f^{m+1}+\dots+a_0f^{n+m} = f^m(a_n+a_{n-1}f+\dots+a_0f^n).$$ All steps are equivalence transformations, so $h\in ker(g)$ means nothing else but that there exists some $m\in\mathbb{N}_0$ such that the last equation holds.
Now I don't know how to proceed. How can we show that this implies that $h\in\langle fX-1\rangle$?
Also, is there some more elegant (and maybe less constructional) proof for this problem?