Algebraic Varieties and Zariski Topology Given a set $S \subset F[x_1, \dotsc ,x_n]$ of polynomials, an affine variety is defined by $S$ is the set
$$V(S) := \{a \in A^n \mid f(a) = 0\ \ \ \forall f \in S\}$$
And the zariski topology defines closed sets to be exactly $V(S)$. But, the definition of closed sets in the Zariski topology that I have seen and worked with is $$V(I) = \{P: P \in \text{Spec}(R), I \subseteq P \},$$
where $R$ is a ring, $I$ is any ideal of $R$ and $P$ is a prime ideal.

Why are these two definitions equivalent? How do we get from sets of functions (presumably functions over $R$?) to prime ideals of $R$?

 A: The definitions aren't equivalent. They are related though.
If $F$ is algebraically closed, the maximal ideals of
$R=F[x_1,\ldots,x_n]$ are of the form
$\left<x_1-a_1,\ldots,x_n-a_n\right>$ where $(a_1,\ldots,a_n)$
runs through $F^n=\Bbb A^n(F)$. We can define $\text{mSpec}(R)$, the
maximal ideal spectrum of a commutative ring $R$ as the set of its prime
ideals. Then we can identify $\Bbb A^n(F)$ with $\text{mSpec}(F[x_1,\ldots,x_n])$.
Of course, $\text{mSpec}(R)$ is a subset of $\text{Spec}(R)$, the collection
of prime ideals of $R$. You have defined the Zariski topology on $\text{Spec}(R)$
and the subspace topology defines a Zariski topology on $\text{mSpec}(R)$.
In the case $R=F[x_1,\ldots,x_n]$ this is the same as the Zariski topology
you have defined on $\Bbb A^n(F)$. You defined $V(S)$ for a set of polynomials,
but $V(S)=V(\left<S\right>)$ where $\left<S\right>$ is the ideal generated by
$S$, so there's no loss in just considering $V(I)$ for ideals $I$. So
the $V(I)$ for $\Bbb A^n(F)$ is in effect $V(I)\cap\text{mSpec}(F[x_1,\ldots,x_n])$ where now the $V(I)$ is given by your formula for arbitrary rings.
