Let $R$ be a commutative ring with $1$ and $I$, $J$ ideals in $R$.
For a prime ideal $P$, let $I_P=(R-P)^{-1}I$ be the localization of $I$ at $P$.
Question:
If $I_P=J_P$ for all prime ideals $P$ then is $I=J$?
My first attempt at a solution: take $x\in I$ then for each prime $P$ write $x/1=y/s$ for some $y\in J$ and $s\in R-P$. Then for some $t\in R-P$, $xst=yt\in J$ where $y,s,t$ all depend on $P$. From this can I deduce that $x\in J$?
Is there a better way to show this?
Thank you!
The answer is yes.
Suppose $I\nsubseteq J$, and let $x\in I\setminus J$. Consider the ideal $(J:x)=\{a\in R:ax\in J\}$. Notice that $(J:x)\subsetneq R$, and let $P$ be a prime ideal such that $(J:x)\subseteq P$. As you observed, from $I_P=J_P$ it follows that there is $u\in R\setminus P$ such that $ux\in J$, that is, $u\in(J:x)$, a contradiction.
The other containment can be proved analogously.