A possible proof that the affine line with double origin is not affine I'm trying to prove that the affine line with double origin is not an affine scheme.
Consider $X_1:=\text{Spec}(k[x])$ and the open subset $U_1:=X_1\setminus\{(x)\}$. In particular $\mathcal{O}_{X_1}(U_1)=k[x]_x$.
Similarly, $X_2:=\text{Spec}(k[y])$, $U_2:=X_2\setminus\{(y)\}$, so that $\mathcal{O}_{X_2}(U_2)=k[y]_y$.
The ring isomorphism $k[x]_x\to k[y]_y$ induces an isomorphism $\varphi:U_1\stackrel{\sim}{\to} U_2$. We define the line with double origin as the scheme
$$X=X_1\sqcup_\varphi X_2,$$
i.e. the gluing of $X_1$ and $X_2$ along $U_1\simeq U_2$ via $\varphi$.
Here is my strategy: if we remove one of the origins from $X$, say $(x)$, we get the usual line $\text{Spec}(k[y])$, whose set of global sections is $k[y]$. On the other hand, if $X$ is affine, i.e. $X\simeq \text{Spec}(A)$ for some ring $A$, then the closed point $(x)$ corresponds to a maximal ideal $\mathfrak{m}\subset A$. Hence the removal of $(x)$ gives the scheme $\text{Spec}(A)\setminus\{\mathfrak{m}\}$, which should look like a line without an origin.
I hope that I can prove that $\mathcal{O}_{\text{Spec}(A)}(\text{Spec}(A)\setminus\{\mathfrak{m}\})\not\simeq k[y]$, but I don't know how to do it.
 A: A correct argument is by exploiting the fact that the restriction morphism $r:\mathcal O(X)\to \mathcal O(X_1)$ is a ring isomorphism, in which $ \mathcal O(X)=A=k[x]$.
If $X$ were affine the dual inclusion map $j=r^*:X_1\to X$ would be an isomorphism of affine schemes,.
This is of course false since $j$ is not surjective. Hence $X$ is not affine.
A: I denote the line with double origin by $X$. It is obtained by gluing $Spec\, k[u]$ and $Spec\, k[t]$ along the isomorphism $D(u) = k[u,1/u]\to k[t,1/t] = D(t)$ which sends $u$ to $t$. The first step is to compute $\Gamma(X,\mathcal O_X)$, since if $X$ is isomorphic to the spectrum od some ring, then it is the ring $\Gamma(X,\mathcal O_X)$. By definition (this depends on how you do the gluing) $\Gamma(X,\mathcal O_X)$ is the limit of
\begin{align*}
k[u] \rightarrow k[u,1/u] \cong k[t,1/t] \leftarrow k[t]
\end{align*}
in the category of rings. Hence giving an element of $\Gamma(X,\mathcal O_X)$ is the same as giving two polynomials $\sum_{n}f_nu^n$ and $\sum_m g_mt^m$ such that $\sum_{n}f_nu^n = \sum_m g_mu^m$ in $k[u,1/u]$. Note that this just means that $f_n=g_n$ for all $n$. Hence $\Gamma(X,\mathcal O_X)$ is isomorphic to $k[u]$. If $X$ is affine, then we have isomorphisms
\begin{align*}
 (X,\mathcal O_X) \xrightarrow{(f,f^\#)} Spec \,\Gamma(X,\mathcal O_X) \xrightarrow{(g,g^\#)} Spec\, k[u]
\end{align*}
of locally ringed spaces. Now consider the vanishing set $V(u)$ of $X$. Here $u$ denotes the global section $u =v$ of $\Gamma(X,\mathcal O_X)$. $V(u)$ consists of all those points $p \in X$ such that $u_p = 0$ modulo $\mathfrak m_p$. Note that it contains at least two points, the two origins of $X$. Now any isomorphism of locally ringed spaces must send this vanishing set to a vanishing set of the same cardinality. But $V(u)$ in $Spec \, k[u]$ consists of only one point. (Note that $u$ in $k[u]$ corresponds to $u$ in $\Gamma(X,\mathcal O_X)$ after applying $f^\#$ and $g^\#$). This a contradiction.
Maybe it is helpful to abstract the main point of the argument. Given a locally ringed space $X$ define the vaishing set $V(f)$ of a global section in the usual way. $p\in V(f)$ if and only if $f=0$ in $\kappa(p) = \mathcal O_{X,p}/\mathfrak m_p$. If $\pi:X\to Y$ is an isomorphism of locally ringed spaces, then the following statement holds for every global section $f$ of $Y$:  $\pi (x)\in V(f)$ if and only if $x\in V(\pi^\#f)$. In other words $\pi^{-1}V(f) = V(\pi^\#f). $
