Calculating the cohomology of projective varieties I have a question about the following method of calculating the cohomology of a projective variety. Fix a field $k$, and let $f\in k[x_0,\ldots,x_n]$ be homogeneous and prime of degree $d$, so if we let $X\subset\mathbb{P}_k^n$ be the codimension $1$ subvariety cut out by $f$, if we consider the very ample sheaf $\mathscr{O}_X(1)$, people seem to calculate the cohomology $H^i(X,\mathscr{O}_X(a))$ by using the short exact sequence $$0\to\mathscr{O}_{\mathbb{P}^n}(a-d)\xrightarrow{f}\mathscr{O}_{\mathbb{P}^n}(a)\to\mathscr{O}_X(a)\to 0$$ but my question is, how can we consider $\mathscr{O}_X(a)$ as a sheaf on $\mathbb{P}^n$, and if we do consider this as a sheaf on $X$, then how do we use the long exact sequence of cohomology?
 A: [Edited to incorporate some of the comments.]
We define $\mathcal O_X (a)$ to be $$ \mathcal O_X (a) \cong i^\star O_{\mathbb P^n} (a),$$ where $i : X \hookrightarrow \mathbb P^n$ is the natural closed immersion.
Note that the cohomology of $\mathcal O_X (a)$ (considered as a sheaf on $X$) is the same as the cohomology of the push-forward $i_\star \mathcal O_X(a)$ (considered as a sheaf on $\mathbb P^n$)!
[For example, cohomology can be computed using flabby resolutions, and under the closed immersion $i$, a flabby resolution of $\mathcal O_X (a)$ on $X$ pushes forward to a flabby resolution of $i_\star \mathcal O_X(a)$ on $\mathbb P^n$. Alternatively, we could use the fact that cohomology can be computed by Cech cohomology on an open affine cover: if $\{ U_\alpha\}$ is an open affine cover for $\mathbb P^n$, then $\{ i^{-1}(U_\alpha) \}$ is an open affine cover for $X$, since $i$ is a closed immersion.]
So we may as well compute the cohomology of $i_\star \mathcal O_X(a)$, since this is easier!
To do this, first note that
$$ i_\star \mathcal O_X (a) \cong i_\star( i^\star O_{\mathbb P^n} (a)) \cong i_\star (O_X \otimes i^\star O_{\mathbb P^n} (a) ) \cong i_\star O_X \otimes O_{\mathbb P^n}(a),$$
by the push-pull formula.
Next, observe that, since $X$ is the vanishing locus of $f$, where $f$ is a degree $d$ homogeneous polynomial, there is a natural short exact sequence,
$$ 0 \to \mathcal O_{\mathbb P^n} (-d) \overset{f}{\to} \mathcal O_{\mathbb P^n} \to i_\star \mathcal O_X \to 0.$$
Tensoring this SES with $O_{\mathbb P^n} (a)$, you get the SES,
$$ 0 \to \mathcal O_{\mathbb P^n} (a-d) \overset{f}{\to} \mathcal O_{\mathbb P^n} (a) \to i_\star\mathcal O_X \otimes O_{\mathbb P^n} (a) \to 0.$$
Finally, the LES associated to this SES contains portions that look like:
$$ \dots \to H^i(\mathcal O_{\mathbb P^n} (a)) \to H^i (\mathcal O_X (a)) \to H^{i+1} (O_{\mathbb P^n} (a-d) )\to \dots $$
[Remember, $H^i (\mathcal O_X (a)) = H^i(i_\star \mathcal O_X(a)) = H^i (i_\star \mathcal O_X \otimes O_{\mathbb P^n}(a))$.]
But we know what $H^i(\mathcal O_{\mathbb P^n} (a))$ and $H^{i+1} (O_{\mathbb P^n} (a-d) )$ are: they are given by the standard formula for the cohomology of line bundles on projective space, in Hartshorne Chapter III.5! And they are quite often zero. This will help you determine (or at least restrict the possibilities for) $H^i (\mathcal O_X (a))$.
For instance, if $X$ is a quartic K3 surface embedded in $\mathbb P^3$, you should be able to use this trick to show that $h^{0,1}(X) = h^1(\mathcal O_X) = 0$.
