Functor of points of the affine line with double origin If $X$ is a scheme then the functor of points is the map $\hom(-, X)$ from the category of schemes to the category of sets.  If we restrict this to affine schemes and apply Yoneda then the functor of points becomes a functor from commutative rings into sets.
In this context the functor of points of the affine line is very simple, it's just the forgetful functor which sends a ring $R$ to $R$ considered as a set with no structure.
Is there a similarly nice description of the functor of points of the affine line with a double point at the origin? (Example 2.6.3 in Hartshorn)
 A: Let $X$ denote the affine line with doubled origin, which is covered by two affine lines $A$ and $B$ which are identified everywhere except the origin.  Then the functor of points of $X$ can be described as followed: given a ring $R$, the functor sends $R$ to the set of pairs $(r,e)$ where $r\in R$ and $e$ is an idempotent element of the quotient $R/(r)$.
Let me first describe the geometric intution behind this.  If $Y$ is a scheme, a morphism $Y\to X$ is just a function on $Y$ (a morphism to $\mathbb{A}^1$), except that whenever that function is $0$, we have to decide whether to map to the $0$ in $A$ or the $0$ in $B$.  This extra data is equivalent to a decomposition of the zero set of our function into two clopen sets.  If $Y=\operatorname{Spec} R$ and our function is given by $r\in R$, then such a decomposition is equivalent to an idempotent element $e\in R/(r)$.
OK, now for the rigorous construction.  Given such a pair $(r,e)$, we construct a morphism $f:\operatorname{Spec} R\to X$ as follows.  Let $I\subseteq R$ be the ideal generated by $r$ and any lift of $e$ to $R$, and let $J\subseteq R$ be the ideal generated by $r$ and any lift of $1-e$.  For each $s\in I$, let $g_s:D(s)\to X$ be the morphism to $A$ determined by the image of $r$ in the localization $R_s$, and for each $t\in J$, let $h_t:D(t)\to X$ be the morphism to $B$ determined by the image of $r$ in the localization $R_t$.  I claim that all of these morphisms glue together to give a morphism $f:\operatorname{Spec} R\to X$.
To prove this, first note that all of these distinguished open sets $D(s)$ and $D(t)$ do cover $\operatorname{Spec} R$, since $I+J=R$ (if $\bar{e}$ is a lift of $e$ then $\bar{e}\in I$ and $1-\bar{e}\in J$ so $1\in I+J$).  So it suffices to show that any two of these $g_s$ and $h_t$ agree on the intersections of their domains.  Given $s,s'\in I$, it is obvious that $g_s$ and $g_{s'}$ agree on $D(s)\cap D(s')=D(ss')$, since they are both just the morphism $D(ss')\to A$ given by $r$.  Similarly, for $t,t'\in J$, $h_t$ and $h_{t'}$ agree.  Finally, given $s\in I$ and $t\in J$, notice that $g_s$ and $h_t$ both map to the complement of the origin when restricted to $D(st)$, since $I\cap J=(r)$ (since $(e)\cap (1-e)=0$ in $R/(r)$) and these morphisms are given by $r$.  Since $A$ and $B$ are identified in $X$ on the complement of the origin, this means that the restrictions of $g_s$ and $h_t$ to $D(st)$ are equal as morphisms $D(st)\to X$.
Thus, given a pair $(r,e)$, we obtain a morphism $f:\operatorname{Spec} R\to X$.  Conversely, given $f:\operatorname{Spec} R\to X$, we can recover $(r,e)$ as follows.  There is a morphism $p:X\to \mathbb{A}^1$ which is given by the canonical isomorphism on both $A$ and $B$, and the composition $pf:\operatorname{Spec} R\to \mathbb{A}^1$ corresponds to some element $r\in R$.  The fiber of $pf$ over the origin is exactly $\operatorname{Spec} R/(r)$.  Since the fiber of $p$ over the origin is a disjoint union of two copies of $\operatorname{Spec}\mathbb{Z}$ (one in $A$ and one in $B$), the restriction of $f$ to the fiber of $p$ over the origin is just determined by a partition of that fiber into two clopen sets, one which will map to $A$ and one which will map to $B$.  Such a partition is determined by an idempotent $e\in R/(r)$.
It is easy to verify that these two constructions are inverse to each other, and thus give a bijection between morphisms $f:\operatorname{Spec} R\to X$ and pairs $(r,e)$.  (To see that the composition $f\mapsto (r,e)\mapsto f$ is the identity, the key observation is that $f^{-1}(X\setminus A)$ is the closed set determined by the ideal $I$ and $f^{-1}(X\setminus B)$ is the closed set determined by the ideal $J$.  It follows that $f$ must be the morphism constructed from the pair $(r,e)$: for any $s\in I$, the restriction of $f$ to $D(s)$ must map to $A$ and be given by $r$, and for any $t\in J$, the restriction of $f$ to $D(t)$ must map to $B$ and be given by $r$.)
