I want to show the part b) of the exercise 1.21 on sheaves in Hartshorne, that is $\mathcal{O}_X/\mathcal{I}_Y\cong i_*\mathcal{O}_Y$ with $i:Y\to X$ is the inclusion, $Y$ a closed subvariety of $X$ and $\mathcal{I}_Y$ the sheaf of ideals of $Y$.
To do so we can consider a map $\varphi_P:\mathcal{O}_{X,P}\to (i_*\mathcal{O}_Y)_P$ defined by $[U,s]\mapsto [U,s_{|U\cap Y}]$ which I do think is well defined, even if $U\cap Y=\emptyset$ for example. Now my problem is to show it's surjective.
Take $[U,t]\in (i_*\mathcal{O}_Y)_P$ with say $P\in Y$. We have $t\in \mathcal{O}_Y(U\cap Y)$. Why would $t$ necessarily be the restriction of some section of $\mathcal{O}_X(U)$ ? I don't see why we could extend $t$.
In the context of Hartshorne chapter I, all varieties are quasi-projective (see the definition just past remark I.3.1.1), and we have the following definition of a regular map:
Definition. (right before remark I.3.1.1) A function $f:Y\to k$ is defined to be regular at a point $P\in Y$ if there is an open neighborhood $U$ with $P\in U\subset Y$, and homogeneous polynomials $g,h\in k[x_0,\cdots,x_n]$ of the same degree, such that $h$ is nowhere zero on $U$, and $f=g/h$ on $U$.
These two facts will solve our problem. Since all varieties are projective, let $Y\subset X\subset \Bbb P^n$ where $Y\subset X$ is a closed immersion. Given a $P\in Y$ and a function $f\in\mathcal{O}_{Y,P}$, select a $U\subset Y$ and $g,h\in k[x_0,\cdots,x_n]$ so that $f=g/h$ on $U$ as guaranteed by the definition above. Now let $U'\subset X$ be any open subset with $U'\cap Y=U$. If $h=0$ intersects $U'$, we can shrink $U'$ by removing $V(h)\cap X$, since this is a closed subset missing $P$. Now consider the regular function $g/h$ on $U'\subset X$. This restricts to our original $f$ in the map $\mathcal{O}_{X,P}\to\mathcal{O}_{Y,P}$ and we have proven surjectivity. $\blacksquare$
It's important to be a touch careful when solving this problem since many tools one would want to use haven't been introduced yet. For instance, we don't know that closed immersions are affine yet at this point in the text.