# Localization at an element is intersection of localizations at primes not containing the element

I'm working on the following problem with no luck.

Let $A$ be a domain. If $0 \neq f \in A$, then prove that $$A_{f} = \bigcap_{P \in\operatorname{Spec}(A), f \not\in P} { A_{P}}$$ and conclude that $A_{f}$ depends only on the open subset of $\operatorname{Spec}(A)$ that contains $f$.

I'm thinking about the fact that the primes of $A_{f}$ are in correspondence with the primes of $A$ that do not contain $p$, however I don't see it... probably it's more complicated than that...

Help please, thank you!

-

Since $A$ is an integral domain, we can embed $A$ and all its localisations into $K = \operatorname{Frac} A$. By construction, $$A[1/f] \subseteq \bigcap_{\substack{\mathfrak{p} \in \operatorname{Spec} A \\ f \notin \mathfrak{p}}} A_\mathfrak{p}$$ because $f$ is invertible in $A_\mathfrak{p}$ whenever $f \notin \mathfrak{p}$. Since the primes not containing $f$ correspond naturally to the primes of $A_f$, we may assume without loss of generality that $f$ is already invertible in $A$, in which case it is enough to prove that $$A = \bigcap_{\mathfrak{p} \in \operatorname{Spec} A} A_\mathfrak{p}$$ whenever $A$ is an integral domain. But if $a \in A$ and $a \notin \mathfrak{p}$ for all primes $\mathfrak{p}$, then $(a)$ cannot be contained in any maximal ideal, so Krull's theorem on maximal ideals implies $(a) = A$, i.e. $a$ is already invertible in $A$. Therefore the equation holds.