I have some confusion about some very basic notions in algebraic geometry. I am using Shafarevich but I find the book to be pretty unclear at times.
First, given a quasi projective variety $X$ over an algebraically closed field $\mathbb{k}$ (meaning $X$ is an open subset of a closed subset of projective space) when defining what it means for a function $f:X\to \mathbb{k}$ to be regular on $X$ is it the same thing to say "there are homogeneous polynomials $p$ and $q$ in $n+1$ variables of the same degree such that at every $x\in X$ we have $f(x) = p(x)/(q(x)$" and "about each point $x\in X$ there is an open neighborhood of $x$ in $X$ such that $f$ is the quotient of two homogenous polynomials in $n+1$ variables of the same degree"? In other words I am asking if, in the Zariski topology, a function locally looks like a quotient of two rational functions must it globally look like a quotient of two rational functions? This is obviously not true in the usual topology on $\mathbb{C}$ for example but I am confused about the case of the Zariski topology.
Something else I am confused about is the following. If we have a regular function $f$ on a quasiprojective variety $X$ then the set $X - Z(f)$ is an affine variety. This I understand. But it is stated in Shafarevich that that the ring of regular functions on $X-Z(F)$ is the ring of regular functions of $X$ adjoin $\frac{1}{f}$. It is clear that this is contained in the ring of regular functions, but I don't understand how we know that this is the entire ring.