# How to compute the coordinate ring of the gluing affine scheme

Let $$\operatorname{Spec}(A_1), \operatorname{Spec}(A_2)$$ be two affine scheme, assume we glue then together along the distinguished open set $$D(f_1)\subset \operatorname{Spec}(A_1),D(f_2) \subset\operatorname{Spec}(A_2)$$. The isomorphism between $$D(f_1)\cong D(f_2)$$ is given as follows, we define an isomorphism $$\phi:({A_1})_{f_1}\to (A_2)_{f_2}$$ then it will induce isomorphism of $$D(f_1)$$ and $$D(f_2)$$ therefore we can glue them together.To form a scheme $$X$$. Assume it happens to be an affine scheme with $$X= \operatorname{Spec}(A)$$

The question is what's the relation between coordinate ring $$A$$ and $$A_1,A_2$$ ?

I see in this post that the coordinate ring $$A$$ is limit of $$A_1,A_2$$ under identification $$\phi$$ , I don't know how to see it

Answer: @yi li - If an affine scheme $$X:=Spec(A)$$ has an open cover $$D(f_1),D(f_2)$$ of two basic open sets you may write down the Cech-complex corresponding to this covering. Take a global section $$s\in A$$ and restrict it to $$U_i:=D(f_i)$$ to get $$s_i$$. Restricting further to $$V:=U_i \cap U_j$$ you get $$(s_i)_V=s_V=(s_j)_V$$. Given two sections $$s_i \in A_i:=A_{f_i}$$ agreeing on $$V$$ there is by the sheaf property an element $$s\in A$$ with $$s_{U_i}=s_i$$. Hence $$A$$ is isomorphic to the set of pairs $$(s_1,s_2) \in A_1\oplus A_2$$ with $$(s_1)_V=(s_2)_V$$.
• Thank you this idea looks very concrete for example the line with double origin (if it's affine scheme) then since it's cover by two pieces of $\Bbb{A}^1_k$, therefore the coordinate ring is of the form $(s_1,s_2)\in k[x]\oplus k[y]$ which agree on the intersection $V$ Jan 6 at 9:43
• @yi li - the line with "double origin" is non-separated hence cannot be affine (over the base field $k$). Any affine scheme over a field $k$ is separated (see Hartshorne, Prop.II.4.1) Jan 6 at 9:47