Let $X\subset \mathbb A^n$ be an algebraic set, and let $A$ and $B$ be its two connected components. There is a theorem stating that $$\Gamma (X)\cong\Gamma(A)\times \Gamma(B).$$
I will indicate the coordinate ring of an algebraic set $X$ with $\Gamma(X)$, and the sheaf of regular functions with $O_X$. So, I made this proof:
- we can associate a function $f$ in $\Gamma(X)$ to a couple of functions $(g,h)$, where $g\in \Gamma (A)$ and $h\in \Gamma(B)$, simply by restricting $f$ to $A$ and $B$;
- we can also associate any couple of functions $(g,h)\in \Gamma(A)\times \Gamma(B)$ to a function in $\Gamma(X)$. In fact we have that $g\in O_X(A)$, since $g$ can be expressed as a polynomial in the coordinates of $\mathbb A^n$, and for the same reason $h\in O_X(B)$. So the axioms of a sheaf allow us to glue $g$ and $h$ (they are locally compatible, trivially, since $A\cap B=\emptyset$) and obtain an element of $O_X(A\cup B)=O_X(X)=\Gamma(X)$.
It's easy to show that these two "associations" are homomorphisms and they are one the inverse of the other, so the theorem should be proved. Is it right? It seems to me that it makes sense, since we can use the sheaf axioms because the connected components are open (and closed) subsets of $X$. Actually I didn't use this, but one can also notice that $O_X(A)=O_A(A)=\Gamma(A)$, since $A$ it's closed in $X$ (and the same for $B$).