Polynomial expressions in localized ideal Let $A$ be a commutative ring and $S\subset A$ a multiplicatively closed subset. Fix a polynomial $f\in A[X]$ and define $I$ to be the ideal generated by elements of the form $f(a)$ with $a\in A$.
My question is:

Does the localized ideal $I_S$ contain all elements of the form $f(x)$ with $x\in A_S$?

This was motivated by this question/answer. There I prove the statement for polynomials of the form $f=X^n-X$. For $x=\frac{a}{s}\in A_S$ we have $$f(x)=\frac{1}{s^{n+1}}\left(sf(a)-af(s)\right)$$
And therefore $f(x)\in I_S$.
However I didn't manage to generalize this to arbitrary polynomials $f$. I would guess that one can explicitely write down some general formula for $f(\frac{a}{s})$ in terms of $f(a_i)$ where $a_i$ are suitable elements from $A$. But maybe there is also a 'nicer' proof that avoids these messy calculations (assuming the statement is indeed correct).
 A: Notation: For a ring $A$ and a polynomial $f \in A[X]$, let me define $I_{A,f} = \langle \{f(a)\}_{a \in A} \rangle$ to be the ideal of $A$ generated by the values of $f$. For any ring map $A \to B$, there is a natural $B$-module morphism $I_{A,f} \otimes_{A} B \to I_{B,f}$.
Remark: If $(\deg f)! \in A^{\times}$ (e.g. if $f$ is linear), then $I_{A,f}$ is the ideal generated by the coefficients of $f$, hence $I_{A,f} \otimes_{A} B \to I_{B,f}$ is surjective for any ring map $A \to B$.
Proof: Let $f(X) = a_{d}X^{d} + \dotsb + a_{1}X + a_{0}$; then $I_{A,f} \subseteq \langle a_{d},\dotsc,a_{1},a_{0} \rangle$. We plug in $X=0,1,\dotsc,d$ to get $\begin{bmatrix} f(0) \\ f(1) \\ \vdots \\ f(d) \end{bmatrix} = V \cdot \begin{bmatrix} a_{0} \\ a_{1} \\ \vdots \\ a_{d} \end{bmatrix}$ where $V$ is the Vandermonde matrix corresponding to $0,1,\dotsc,d$. The determinant of $V$ is $\pm \prod_{0 \le i < j \le d} (i-j)$, which is invertible in $A$ by assumption; hence $V \in \mathrm{GL}_{d+1}(A)$ and so we can solve for $a_{0},\dotsc,a_{d}$ as $A$-linear combinations of $f(0),\dotsc,f(d)$. $\square$
Claim: For any multiplicative subset $S \subset A$, we have an equality $S^{-1}(I_{A,f}) = I_{S^{-1}A,f}$ of ideals of $S^{-1}A$.
Proof: Let $f(X) = a_{n}X^{n} + a_{n-1}X^{n-1} + \dotsb + a_{1}X + a_{0}$. We will show that \begin{align*} \textstyle f(x/s) = \frac{1}{s^{n}}(a_{n}x^{n} + a_{n-1}x^{n-1}s + \dotsb + a_{1}xs^{n-1} + a_{0}s^{n}) \end{align*} is an $S^{-1}A$-linear combination of $f(x),f(xs),\dotsc,f(xs^{n})$. Thus we want to solve the vector equation \begin{align*} \begin{array}{@{}c@{}}{\begin{bmatrix} a_{0} & a_{1}x & \dotsb & a_{n}x^{n}\end{bmatrix}}\\ \vphantom{\vdots} \\ \\ \\ \end{array} \begin{bmatrix} s^{n} \\ s^{n-1} \\ \vdots \\ 1 \end{bmatrix} = \begin{array}{@{}c@{}}{\begin{bmatrix} a_{0} & a_{1}x & \dotsb & a_{n}x^{n} \end{bmatrix}}\\ \vphantom{\vdots} \\ \\ \\ \end{array} \begin{bmatrix} 1 & 1 & \dotsb & 1 \\ 1 & s & \dotsb & s^{n} \\ \vdots & \vdots & \ddots & \vdots \\ 1 & s^{n} & \dotsb & s^{n^{2}} \end{bmatrix} \begin{bmatrix} b_{0} \\ b_{1} \\ \vdots \\ b_{n} \end{bmatrix} \end{align*} for $b_{i} \in S^{-1}A$. In fact we solve the equation \begin{align*} \begin{bmatrix} s^{n} \\ s^{n-1} \\ \vdots \\ 1 \end{bmatrix} = \begin{bmatrix} 1 & 1 & \dotsb & 1 \\ 1 & s & \dotsb & s^{n} \\ \vdots & \vdots & \ddots & \vdots \\ 1 & s^{n} & \dotsb & s^{n^{2}} \end{bmatrix} \begin{bmatrix} b_{0} \\ b_{1} \\ \vdots \\ b_{n} \end{bmatrix} \end{align*} in $\mathbb{Z}[s,s^{-1}]$ where we view $s$ as an indeterminate. For this, we recall that the inverse of the Vandermonde matrix \begin{align*} \begin{bmatrix} 1 & 1 & \dotsb & 1 \\ x_{0} & x_{1} & \dotsb & x_{n} \\ \vdots & \vdots & \ddots & \vdots \\ x_{0}^{n} & x_{1}^{n} & \dotsb & x_{n}^{n} \end{bmatrix} \end{align*} has entries \begin{align*} v_{i,j} = (-1)^{n-j} \frac{e_{n-j}(\{x_{0},\dotsc,x_{n}\} \setminus \{x_{i}\})}{\prod_{m \ne i} (x_{i}-x_{m})} \end{align*} for $i,j=0,1,\dotsc,n$, where $e_{i}$ denotes the $i$th elementary symmetric polynomial (defined as $\prod_{m=1}^{n}(X-x_{i}) = \sum_{i=0}^{n}(-1)^{i}e_{i}(\{x_{1},\dotsc,x_{n}\})X^{n-i}$). In our case, we have $x_{i} = s^{i}$ for $i=0,1,\dotsc,n$. Thus we get the formula \begin{align*} b_{i} &= \frac{1}{\prod_{m \ne i} (s^{i}-s^{m})}\sum_{j=0}^{n} s^{j}(-1)^{n-j}e_{n-j}(\{x_{0},\dotsc,x_{n}\} \setminus \{x_{i}\}) \\ &= s^{n}\frac{\prod_{m \ne i} (\frac{1}{s}-s^{m})}{\prod_{m \ne i} (s^{i}-s^{m})} \\ &= \pm s^{???} \frac{\prod_{m \in \{1,\dotsc,n+1\}\setminus \{i+1\}} (1-s^{m})}{\prod_{0 \le m < i} (1-s^{i-m})\prod_{i < m \le n} (1-s^{m-i})} \\ &= \pm s^{???} \frac{\prod_{m=1}^{n+1} (1-s^{m})}{\prod_{m=1}^{i+1}(1-s^{m}) \prod_{m=1}^{n-i}(1-s^{m})} \end{align*} so it suffices to show that, for any $n,k$, the polynomial $\prod_{m=1}^{k} (1-s^{m})$ divides $\prod_{m=n-k+1}^{n} (1-s^{m})$ in $\mathbb{Z}[s]$. (This seems related to the fact that binomial coefficients are integers but I don't know of a proof that can be made to work here, for example it is not always true that we can rearrange $k$ consecutive integers $n-k+1,\dotsc,n$ so that $m$ divides the $m$th integer $n-k+\sigma(m)$, see $\binom{7}{3} = \frac{7 \cdot 6 \cdot 5}{3 \cdot 2 \cdot 1}$.) So instead let $\Phi_{d}(s) \in \mathbb{Z}[s]$ be the $d$th cyclotomic polynomial, which is irreducible and satisfies $1-s^{n} = \prod_{d | n} \Phi_{d}$ for any $n$. For any $d,k$, the order of $\Phi_{d}$ dividing $\prod_{m=1}^{k}(1-s^{m})$ is $\lfloor \frac{k}{d} \rfloor$ so we conclude using that $\lfloor \frac{k}{d} \rfloor + \lfloor \frac{n-k}{d} \rfloor \le \lfloor \frac{n}{d} \rfloor$ for any $d,n,k$. $\square$
Remark: The analogous statement is true for multivariate polynomials as well, for example the above shows that $f(\frac{x}{s},\frac{y}{t})$ can be written as an $S^{-1}A$-linear combination of $f(s^{i}x,\frac{y}{t})$ for $i \ge 0$, each of which can be written as an $S^{-1}A$-linear combination of $f(s^{i}x,t^{j}y)$ for $j \ge 0$, etc.
