On structure sheaf of an affine scheme I am reading the algebraic geometry notes by Ravi Vakil. When he proves that the 
structure sheaf on affine scheme is indeed a sheaf (Thm 4.1.2. in his notes), he first 
proves that it gives a sheaf on the distinguished base by showing the base identity and base
gluability.
For base identity axiom, he only deals with the cases entire space, $Spec A$, and a distinguished open set, $D(f)$, and never an arbitrary union of distinguished open sets. I am guessing that
the base identity axiom on arbitrary union of distinguished open sets must follow if we know 
for each distinguished open sets. Could someone please explain me how this works?
Thank you! Also all the names/notations are from the notes. I hope this is ok.  
 A: I think the issue that is confusing you is the definition of "sheaf on a base." 
The point of defining a sheaf on a base is to allow you to avoid defining its values on arbitrary unions of open sets. It may be annoying to check the sheaf conditions on non-affine unions of distinguished open sets, but what sheafs on a base give you (or, more precisely what Theorem 2.7.1 in Vakil's notes gives you,) is that once you define the sheaf on a basis of open sets, you get it on the remaining open sets for free.
Recall a sheaf $F$ on a base $\{B_i\}_{i \in I}$ is the data of sets $F(B_i)$ for each $i \in I$ which is compatible with restriction and satisfies the base identity and base gluability axioms. This is defined more precisely in Vakil's textbook (in the April 29, 2015 version,) in the the first three paragraphs of page 93.
In particular, when $F$ is a sheaf on a base $\{B_i\}_{i \in I},$ the value $F(B)$ only makes sense when $B \in \{B_i\}_{i \in I}.$ Hence, when Vakil defines the base axiom and gluability axiom, he is implicitly assuming that $B \in \{B_i\}_{i \in I}.$
Now, in the problem at hand, we are taking $\{B_i\}_{i \in I} = \{D(f)\}_{f \in A}$. In particular, we only need check the sheaf on a base axioms for the case that $B = D(f)$ for some $f \in A.$ In particular, there is no need to check the sheaf on a base axioms for arbitrary unions of open sets. Once we know it holds for distinguished open sets, we can use Theorem 2.7.1 from Vakil's notes to obtain a unique extension of the given sheaf on a base to a bona fide sheaf, and this extension is the structure sheaf.
Note that the case Vakil explicitly checks is $Spec A,$ and $Spec A = D(1),$ so it is an element of the cover of distinguished opens. You still have to check this for $D(f)$, with $f \neq 1$, which is the content of Exercises 4.1.B and 4.1.C, but as Vakil mentions, for both these exercises, you can essentially replace $A$ by $D(f) = Spec A_f$ and repeat the argument Vakil gives for $D(1) = Spec A$.
