Let $X$ be a scheme finite type over a field $k$ such that each of its irreducible components $X\_i$ is quasi-affine. Is it true that $X$ is quasi-affine?



A Non-quasi-affine scheme with quasi-affine irreducible components
I am just writing my comment as an answer. Probably this example has appeared before on MO. Let $\mathbb{P}^3\_k$ denote the projective space $\text{Proj}\ k[s\_1,s\_2,t\_1,t\_2]$. Let $\overline{X}$ denote the closed, reduced subscheme $$\overline{X} =\text{Zero}(s\_1s\_2) = \overline{X}\_1 \cup \overline{X}\_2, \ \ \overline{X}\_1 = \text{Zero}(s\_2), \ \ \overline{X}\_2 = \text{Zero}(s\_1).$$ This is a union of two hyperplanes, $\overline{X}\_1$ and $\overline{X}\_2,$ whose intersection is a line, $$\overline{L} = \overline{X}\_1\cap \overline{X}\_2 = \text{Zero}(s\_1,s\_2) = \text{Proj} \ k[t\_1,t\_2].$$ Inside $\overline{X}\_1$, define $C\_1$ to be the closed subscheme that is a line, $$C\_1 = \text{Zero}(s\_2,t\_1).$$ Inside $\overline{X}\_2$, define $C\_2$ to be the closed subscheme that is a line, $$C\_2=\text{Zero}(s\_1,t\_2).$$ Note that $C\_1\cap \overline{X}\_2$ is the singleton set of $p\_2=[0,0,0,1]$, and $C\_2\cap \overline{X}\_1$ is the singleton set of $p\_1=[0,0,1,0].$ Define $C$ to be the closed union of $C\_1$ and $C\_2$ in $\overline{X}$. 


Define $X$ to be the open complement in $\overline{X}$ of the closed subset $C$. By construction, $X$ is quasi-projective. Moreover, $X$ is the union of the two irreducible components, $$X\_1 = \overline{X}\_1\setminus(C\_1\cup \{p\_1\}), \ \ X\_2 = \overline{X}\_2 \setminus (C\_2\cup \{p\_2\}).$$  

The intersection of the two irreducible components is $$L=\overline{L}\setminus\{p\_1,p\_2\}.$$ 


Each of the two irreducible components is isomorphic to a punctured affine plane. In particular, $\mathcal{O}\_{X\_1}(X\_1)$ equals $k[s\_1/t\_1,t\_2/t\_1]$. Similarly, $\mathcal{O}\_{X\_2}(X\_2)$ equals $k[s\_2/t\_2,t\_1/t\_2]$. Finally, the intersection $L$ is a twice-punctured projective line with coordinate ring $\mathcal{O}\_L(L)$ equal to $k[t\_2/t\_1,t\_1/t\_2]$. The restriction map $\rho\_1$, resp. $\rho\_2$, to $\mathcal{O}\_L(L)$ from $\mathcal{O}\_{X\_1}(X\_1)$, resp. from $\mathcal{O}\_{X\_2}(X\_2)$, is the $k$-algebra map that sends $s\_1/t\_1$ to $0$, resp. that sends $s\_2/t\_2$ to $0$, and that sends $t\_2/t\_1$ to itself, resp. that sends $t\_1/t\_2$ to itself. The fibre product of these restriction maps is the $k$-algebra $$\mathcal{O}\_X(X) = \{(f\_1,f\_2)\in \mathcal{O}\_{X\_1}(X\_1)\times \mathcal{O}\_{X\_2}(X\_2) : \rho\_1(f\_1) = \rho\_2(f\_2)\}.$$ This is infinitely generated as a $k$-algebra by the following monomials, $$\frac{s\_1}{t\_1}, \ \frac{s\_2}{t\_2}, \ \left(\frac{s\_1^mt\_2}{t\_1^{m+1}}\right)\_{m\geq 1}, \left(\frac{s\_2^nt\_1}{t\_2^{n+1}}\right)\_{n\geq 1}. $$ In particular, the image in $\mathcal{O}\_L(L)$ of $\mathcal{O}\_X(X)$ equals the constant subfield $k$. Thus, $X$ is not quasi-affine.


