Skip to main content
2 of 3
added 24 characters in body; added 1 characters in body
Sándor Kovács
  • 42.9k
  • 2
  • 109
  • 155
  1. Obviously if $X$ is not affine, then $U=X$ is an open subset which is not affine (see Kevin's comment above) but this might feel cheating.

  2. A more general example along the lines of Robin's example is the following:

Let $X$ be an arbitrary $S_2$ affine scheme of dimension at least $2$. (If you don't know what $S_2$ is, take normal, or smooth). Let $Z\subset X$ be a non-empty closed subscheme of codimension at least $2$. Then $U=X\setminus Z\subset X$ is a proper open subset which is affine.

Here is why it's not affine: Assume that $X={\rm Spec} A$ is affine and let $\iota:U\hookrightarrow X$ be the natural embedding. By the $S_2$ property it follows that $\iota_*\mathcal O_U\simeq \mathcal O_X$, and consequently the induced morphism on global sections $\Gamma(U, \mathcal O_U)\to A$ is an isomorphism, but then if $U$ were affine, then this would imply that the embedding $\iota$ is an isomorphism, which is not true by construction.

Sándor Kovács
  • 42.9k
  • 2
  • 109
  • 155