TITLE: Structure of locally free $\mathcal{O}_{X}$-module on affine open set
QUESTION [5 upvotes]: Suppose $X$ is a scheme. I have been studying (finite rank) locally free $\mathcal{O}_{X}$-modules, and more generally, quasi-coherent sheaves on $X$ mainly from Ravi Vakil's excellent notes as well as Hartshorne. Let $\mathcal{F}$ be any quasi-coherent $\mathcal{O}_{X}$-module and let $\mathcal{G}$ be a locally free $\mathcal{O}_{X}$-module. I understand that for any affine $U = \text{spec}A \subset X$, we can fine an $A$-module $M$ such that $\mathcal{F} \vert_{U} \simeq \widetilde{M}.$ Hence this property also holds for locally free $\mathcal{O}_{X}$-modules. However, how do I know that for any such affine subset that there holds $\mathcal{G} \vert_{U} \simeq \mathcal{O}_{X}^{\oplus^{n}}$? I know that there exists a cover (not necessarily affine) $\left\lbrace U_{i} \right\rbrace_{i \in I}$ such that this holds locally at each $U_{i}$, but I am not sure how to show that the "freeness" property must then hold for any affine subset.
I strongly suspect an argument can be made from the transition functions, but I haven't been able to make any progress.
Any help is appreciated.
Thanks

REPLY [5 votes]: It is just not true that given a locally free sheaf $\mathcal G$ of rank $r$ and an arbitrary affine open subset $U\subset X$ the restriction $\mathcal G\vert U$ is isomorphic to the free $\mathcal O_U$-Module $\mathcal O_U^{\oplus r}$.
 Here is a counterexample: 
Consider a smooth projective curve $\overline X$ of positive genus (over $\mathbb C$, say) and a point $P\in \overline X$.
The curve $X=\overline X\setminus \{P\}$ is then affine.
Now let $Q\in X$ be an arbitrary point and consider the line bundle $\mathcal G=\mathcal O(Q)$, which is a locally free rank of rank one.
 Although $U=X$ is affine, that line bundle is not trivial, i.e . is not isomorphic to $\mathcal O_X$:
Indeed, if it were there would exist a rational function $f\in Rat(X)$ with divisor  $div f=1.Q$ and that rational function would extend to a rational function $\overline f\in Rat(\overline X)$ with divisor necessarily of the form $div (\overline f)=-1.P+1.Q$ (recall that the divisor of a rational function on $\overline X $ must have  degree zero).
But this is a contradiction: on a smooth projective curve of positive genus two distinct points cannot be linearly equivalent. 
Algebraic remark
In the dictionary  mentioned in the question translating quasi-coherent sheaves on $X$ into $A$-modules the result above says that there exist a finitely generated projective module $\Gamma(X,\mathcal O_X(Q))$ of rank $1$ over $A=\Gamma(X,\mathcal O_X)$ which isn't isomorphic to $A$ as an $A$-module.