Why does $D_U(f) = D_V(f_{|V} )$ for U, V be affine open subschemes of X? 
Lemma 3.3: Let $X$ be a scheme and let $U,V$ be affine open subschemes of $X$. There exists for all $x \in U \cap V$ an open subscheme $W \subseteq U \cap V$  with $x \in W$ such that it is principal open in $U$ as well as in $V$.


If $A$ is a ring, $f \in A$, the principal opens are subsets of $Spec(A)$, of the form $D(f):= Spec(A) \setminus V(f)$.


Proof: Replacing $V$ by a principal open subset of $V$ containing $x$, if necessary, we assume that $ V \subseteq U$.  Now choose $f \in \Gamma(U,O_X)$ such that $x \in D(f) \subseteq V$ and let $f|_V$ denote the image of $f$ under the restriction homomorphism $\Gamma(U,O_X) \rightarrow \Gamma(V,O_X)$.
Then $D_U(f) = D_V(f|_V)$

My question is about the last equality and sheaves in general?
I assume the last equality $D_U(f) = D_V(f_{|V} )$ is obtained because of our choice of $f \in \Gamma(U,O_X)$ such that $x \in D(f) \subseteq V$, is this correct?
Question: I am a little bit unclear about $D_U(f)$ which relates to prime ideals in $\Gamma(U,O_X)$ and $D_V(f_{|V} )$, which relates prime ideals in $\Gamma(V,O_X)$. In general, $\Gamma(U,O_X)$ and $\Gamma(V,O_X)$ are two different rings and $O_X$ from what I understand gives only restriction maps on open subsets, hence how to move a section f from U to $f_{|V}$ in V, but I do not understand what the whole ring is when $O_X$ acts on open sets $U \subset V$. For instance, are the points in U prime ideals of $Spec \Gamma(U,O_X)$? Hence, when we restrict to V, since $x \in D(f) \subseteq V$, then it means the points in D(f) are in V and hence represent prime ideals in $\Gamma(V,O_X)$, implying equal $D_V(f_{|V} )$ since the same 'points' D(f) are preserved in V as a topological space?

(The sheaf axioms then also imply that $\Gamma(U,O_X)_f \cong \Gamma(V,O_X)_{f_{|V}}$.)

How do you prove this part?
Lemma 3.3 of Algebraic Geometry I by Gortz, Wedhorn
 A: That kind of thing was (and sort of still is) quite a headache for me too. All my sympathy. 
But mostly, this fact is easier to understand when working with locally ringed spaces. Define, for a locally ringed space $(X,O_X)$, and $f \in O_X(X)$, the principal open subset $D_X(f)=\{x \in X,\, f_x \notin \mathfrak{m}_x\}$. 
This extends the definition for affine schemes. 
It is absolutely straightforward to see that if $V \subset X$ is open, $D_V(f_{|V}) = D_X(f) \cap V$. 
As a consequence, if in particular $D_X(f) \subset V$, then $D_V(f_{|V})=D_X(f)$, hence $D_X(f)$ is principal in $X$ and in $V$. (*)
Now, a scheme satisfies the following properties as a locally ringed space:
1) it has a topology basis made with affine open subsets (hypothesis)
2) principal open subsets are a topology basis of affine open subsets (algebra). 
3) if $W \subset V \subset U$ are open subsets with $U$ affine, $V$ principal in $U$ (hence affine) and $W$ principal in $V$, then $W$ principal in $U$ (algebra as well, just write carefully things down with the “old” definition of principality). 
So, let $U,V \subset X$ be affine open subsets, and $x \in W$. There is an open subset $x \in V’ \subset U \cap V$ such that $V’ \subset V$ is principal (by 2)). 
There is an open subset $x \in W \subset V’$ such that $W$ is principal in $U$ (by 2)) again. 
Now, by (*) above, $W$ is principal in $V’$, which is principal in $V$, so by 3) $W$ is principal in $V$, and by assumption $W$ principal in $U$. 
