Vakil's FOAG Exercise 8.1.G Suppose $\mathscr{I}_{X/Y}$ is a sheaf of ideals corresponding to a closed embedding $\pi:X \rightarrow Y$. And suppose $\operatorname{Spec} B\subset Y$ is an affine open subscheme and $f\in B$. We denote $\mathscr{I}_{X/Y}(\operatorname{Spec} B)$ as $I(B)$. Then we have to show that the natural map $I(B)_f \rightarrow I(B_f)$ is an isomorphism.
Now, since $\pi$ is a closed embedding, we have the short exact sequence for $\operatorname{Spec} B \subset Y$,
$$0\rightarrow I(B)\rightarrow B\rightarrow A\rightarrow 0$$
where $\pi^{-1}(\operatorname{Spec} B)=\operatorname{Spec} A$. By the exactness of localization we get,
$$0\rightarrow I(B)_f\rightarrow B_f\rightarrow A_{\pi^{*}(f)}\rightarrow 0$$
where $\pi^{*}: B\rightarrow A$ is the local section map on $\operatorname{Spec} B$. On the other hand, for $\operatorname{Spec} B_f\subset Y$ we have the short exact sequence,
$$0\rightarrow I(B_f)\rightarrow B_f \rightarrow A_{\pi^{*}(f)}\rightarrow 0$$
Hence $I(B_f)$ is isomorphic to $I(B)_f$.
Please let me know if this solution is correct.
Secondly, if I weaken the condition of closed embedding to just $\pi$ being affine morphism, then I have the exact sequence
$$0\rightarrow I(B)\rightarrow B\rightarrow A$$
which upon localization gives
$$0\rightarrow I(B)_f\rightarrow B_f\rightarrow A_{\pi^{*}(f)}$$
giving us the required isomorphism in this weakened case also. Is this alright or am I missing something?
Thanks in advance!
 A: The idea of your solutions are correct. If I were your instructor and you were turning this in to me for a first-year course with no previous experience, I might ask for a little more in terms of justification - why does restricting to $\operatorname{Spec} B_f$ work the way you want it to, for instance? (Yes, it clearly does, but if you're newer, it's more important to be careful - and this justification shouldn't be so laborious.)
You may be interested to know that your attempt at a generalization can actually be pushed further. For any quasicompact morphism $f:X\to Y$, if we let $\mathcal{I}$ denote the kernel of the map $\mathcal{O}_Y\to f_*\mathcal{O}_X$, then $\mathcal{I}$ is quasicoherent sheaf, which means it will satisfy the property you want by very standard facts. (If your morphism is not quasicompact, you may run in to issues - the high-level picture here is that $I$ is the sheaf of ideals determining the scheme-theoretic image of the morphism $f$, which may behave somewhat wildly in the non-quasicompact case, as warned about in the StacksProject reference on the subject.)
