An integral domain $A$ is exactly the intersection of the localisations of $A$ at each maximal ideal This result appears to be ubiquitous as an algebra exercise. How do you prove this result?

Let $A$ be an integral domain with field of fractions $K$, and let $A_{\mathfrak{m}}$ denote the localisation of $A$ at a maximal ideal $\mathfrak{m}$ considered as a subring of $K$. Prove that $$A = \bigcap_{\mathfrak{m}} A_{\mathfrak{m}}\,,$$ where the intersection is taken over all maximal ideals $\mathfrak{m}$ of $A$.

 A: Or equivalently, suppose $z$ is not in $A$. Also consider the ideal $I=A:z=\{x\in A: xz \in A\}$. Then $I$ is a proper ideal since $1\not\in I$. Then there exists a maximal ideal $\mathfrak{m}$ containing $I$. The element $z$ must be not in $A_{\mathfrak{m}}$, otherwise, there exists some $s\not\in \mathfrak{m}$ such that $sz \in A$, hence $s\in I$ which contradicts the choice of the maximal ideal $\mathfrak{m}$.
A: Since $A$ is a domain, the localization map $A \to A_{\mathfrak m}$ is injective for every maximal ideal $\mathfrak m$, so $A \subseteq \cap_{\mathfrak m \in \text{mSpec} A} A_{\mathfrak m}$. The other inclusion is more interesting: suppose $z \in K$, with $z \in A_{\mathfrak m}$ for every maximal ideal $\mathfrak m$. Consider the $A$-ideal $I := A :_A Az = \{x \in A \mid xz \in A\}$. We want $1 \in I$, i.e. $I = A$. But to show this we can localize: $I_{\mathfrak m} = (A :_A Az)_{\mathfrak m} = A_{\mathfrak m} :_{A_{\mathfrak m}} A_{\mathfrak m}z = A_{\mathfrak m}$ (since $Az$ is a finitely generated $A$-module) for every maximal ideal ${\mathfrak m}$, so indeed $I = A$.
A: We may think of $\bigcap_{m}A_m$ as an $A$-module. It is clear that $A\subset \bigcap_{m}A_m$ is an $A$-submodule of $\bigcap_{m}A_m$. Our aim is to show that the $A$-module $M=\frac{(\bigcap_mA_m)}{A}$ is zero. This would establish what we want to prove.
From local-to-global principles, it suffices to show that $M_n$ is zero for every maximal ideal $n\subset A$. 
So, lets compute, $$ M_n=\left(\frac{\bigcap_mA_m}{A}\right)_n=\frac{(\cap_mA_m)_n}{A_n}.$$
Notice that the last equality follows from the fact that localization commutes with quotients (which is true as localization is exact functor). 
Now, it is clear that $(\bigcap_mA_m)_n\subset\bigcap_m (A_m)_n$, Hence,  $\frac{(\bigcap_mA_m)_n}{A_n}\subset \frac{\bigcap_m (A_m)_n}{A_n}= \frac{\bigcap_m (A_n)_m}{A_n}$ (we have changed the order of localization). Now, $\bigcap_m (A_n)_m\subset (A_n)_n=A_n$, and so $ \frac{\bigcap_m (A_n)_m}{A_n}\subset \frac{A_n}{A_n}=0$. 
Combining all these containement, we conclude that $M_n\subset \frac{(\cap_mA_m)_n}{A_n} \subset \frac{A_n}{A_n}=0$. That is, $M_n=0$ for every maximal ideal $n$, hence it is the zero $A$-module and so $A=\bigcap_m A_m$. 
