Equivalence between two definitions of affine algebraic set. In my algebraic geometry course, we have seen two definitions of an affine algebraic set. The first says that $X$ is an affine algebraic set if
$$X = \{x \in \mathbb{A}^n(k)~|~f_i(x) = 0, \forall i \in I\}$$
where $f_i \in k[X_1, \ldots, X_n]$ for all $i \in I$. The second one defines $X$ as a representable functor from $\text{Alg}_k$ to $\text{Set}$, i.e. there exists $A \in \text{Alg}_k$ such that
$$X = \text{Hom}_{\text{Alg}_k}(A, -).$$
Now the two definitions should match for $k$ algebrically closed and $A \in \text{Alg}_k$ finitely generated and reduced (= nilpotent-free).
There is a step in this equivalence that I don't understand: We take $X$ as in the first
definition, we consider the associated coordinate algebra
$$\mathcal{O}(X) = k[X_1, \ldots, X_n]/I(X)$$
and then we should have
$$\text{Hom}_{\text{Alg}_k}(\mathcal{O}(X), k) \cong X.$$
I don't really get this isomophism, does anyone know how to prove this or just a way to understand it intuitively ?
 A: Let $k$ be any field and let $B:=k[x_1,..,x_n]$ be the polynomial ring in $n$ variables. Let $I \subseteq B$ be an ideal with $A:=B/I$ and let $X:=Spec(A)$ and let $S:=Spec(k)$.
Let
R0. $X(k)$ be the set of $n$-tuples $(a_1,..,a_n)\in k^n$ with $f(a_1,..,a_n)=0$ for all polynomials $f \in I$.
R1. Let $Hom_{k-alg}(A,k)$  be the set of all maps of $k$-algebras $\phi: A \rightarrow k$.
Lemma. There is a one-to-one correspondence of sets $X(k) \cong Hom_{k-alg}(A,k)$.
If $a:=(a_1,..,a_n)\in X(k)$ we define a map $\phi_a: A\rightarrow k$ by letting $\phi_a(x_i):=a_i$. Conversely if $\phi: A\rightarrow k$ is a map of $k$-algebras it follows $\phi(x_i)=a_i \in k$ for all $i=1,..,n$. It follows $a:=(a_1,..,a_n)\in X(k)$. This is a one-to-one correspondence of sets.
People write $X(k)$ to denote the "set of $k$-rational points of $X$". A $k$-rational point is by definition a map of schemes
R2. $\phi^*: Spec(k) \rightarrow X$
which again corresponds 1-1 to a map of $k$-algebras $\phi:A \rightarrow k$. You do not need $k$ to be a field, you can let $k$ be any commutative unital ring. By the construction of the affine scheme $Spec(A)$ it follows
R3. $Hom_{Sch(S)}(S,X)\cong Hom_{k-alg}(A,k)$
Example 1. Let $I:=\{f_1,..,f_l\}$ be generated by a finite set of polynomials.
It follows a map of schemes $\phi^*: S\rightarrow X$ corresponds in a 1-1 way to a solution $(a_1,..,a_n)\in k^n$ of the system of polynomial equations
S1. $f_1(x_1,..,x_n)=0,..,f_l(x_1,..,x_n)=0$.
Hence the "functor of points" language converts the problem of studying sets of solutions to systems of polynomial equations into the problem of studying sets of maps $\phi^*: S \rightarrow X$.
Question: "Sorry I do not know this notation, what do you mean by Spec(A)?"
Answer: In chapter II in Hartshornes (or any book on algebraic geometry) book the ringed topological space $Spec(A)$ is introduced. Given any commutative unital ring $A$ you construct a topological space $X:=Spec(A)$ (it is the set of prime ideals in $A$ with the Zariski topology) and a structure sheaf $\mathcal{O}_X$. Given any map of unital commutative rings $\phi: A\rightarrow B$ (let $Y:=Spec(B)$) you get a map of locally ringed spaces
$(\phi^*, \phi^{\#}): (Y, \mathcal{O}_Y) \rightarrow (X, \mathcal{O}_X)$
with the property that the map of ringed topological spaces $(\phi^*, \phi^{\#})$ is uniquely determined by $\phi$. There is a 1-1 correspondence
R4. $Hom_{Sch}(Y,X) \cong Hom_{rings}(A,B)$.
This is Proposition II.2.3 in Hartshornes classical book "Algebraic geometry".
Hence you get a "geometric structure" $(X, \mathcal{O}_X)$ from any commutative unital ring $A$. And to study a map of schemes $\phi^*: S \rightarrow X$ is by the above argument equivalent to studying a solution to the system S1 from Example 1.
Why study solutions to systems of polynomial equations over rings that are not fields?
Example. In diophantine geometry one studies integral solutions to systems of polynomial equations. Given a set of polynomials $I:=\{f_1,..,f_l\}\in B:=\mathbb{Z}[x_1,..,x_n]$ we may construct the quotient ring $A:=B/I$. Let $S:=Spec(\mathbb{Z})$ and $X:=Spec(A)$. It follows there is a 1-1 correspondence of sets
R5 $Hom_{Sch}(S,X)\cong Hom_{rings}(A, \mathbb{Z})\cong X(\mathbb{Z})$.
For any scheme $X\in Sch(S)$ there is the "functor of points"
R6. $h_X: Sch(S) \rightarrow Sets$
where $Sch(S)$ is the category of schemes over $S$ and maps of schemes over $S$
and $Sets$ is the category of sets and maps of sets. The functor $h_X$ is defined by
R7. $h_X(T):=Hom_{Sch(S)}(T,X)$.
This gives an "embedding"
R8. $h: Sch(S) \rightarrow Funct(Sch(S), Sets)$.
Here $Funct(Sch(S), Sets)$ is the "category of functors" from $Sch(S)$ to $Sets$ with natural transformations as morphisms.
It is an "embedding" in the sense that any natural transformation $\eta:h_X \rightarrow h_Y$ of functors is induced by a unique morphism of schemes $f:X\rightarrow Y$, and two different morphisms $f,g:X\rightarrow Y$ give different natural transformations (this is the Yoneda lemma). With the functor $h$ we may view the category $Sch(S)$ as a "sub category" of $Funct(Sch(S), Sets)$. This viewpoint is what people use to define algebraic spaces, algebraic stacks and other "moduli spaces/parameter spaces" in algebraic geometry. As an example:
Let $E$ be a rank $d+1$ locally trivial $\mathcal{O}_S$-module and define the following functor:
R9. $F_{E}: Sch(S) \rightarrow Sets$
by $F_{E}(X,f):= \{\phi: f^*E^* \rightarrow L \rightarrow 0$ such that the sequence is exact $\}/\equiv$
where $L\in Pic(S)$ and two quotients $(L, \phi), (L', \phi')$ are equivalent iff there is an isomorphism $\psi: L \rightarrow L'$ such that the obvious diagram commutes. The functor $F_{E}$ is in the "category" $Funct(Sch(S), Sets)$, and it is in the "image" of the functor $h$: There is a scheme $\mathbb{P}(E^*)$ (the projective space bundle of $E$) and an isomorphism
of functors $h_{\mathbb{P}(E^*)}\cong F_{E}$. We say that the functor $F_E$ is "representable" and that "it is represented by $\mathbb{P}(E^*)"$. You may find this in Hartshorne, Chapter II.7, Proposition 7.12. Many functors
appearing in the study parameter spaces are not representable in this sense, and this leads to the theory of algebraic spaces and algebraic stacks.
"Many" "moduli problems" may be formulated as follows: Given a functor
$F: Sch(S) \rightarrow Sets.$
Question: Is there a scheme $f: X\rightarrow S$ with the property that $F(-) \cong h_X$ is an isomorphism of functors? Projective space bundles, grassmannian bundles, quot schemes etc are constructed using this language.
If $E$ is a locally trivial $\mathcal{O}_S$-module of rank $d+1$ you may construct the projective space bundle $\pi: \mathbb{P}(E^*)\rightarrow S$. There is the "tautological sequence"
T1. $\pi^*E^* \rightarrow \mathcal{O}(1) \rightarrow 0$.
If $S=k$ is a field it follows $E=V$ is a vector space of dimension $d+1$. If you dualize T1 you get an injection
T2. $\mathcal{O}(-1) \subseteq \pi^*E$
Given a $k$-rational point $x:Spec(k) \rightarrow \mathbb{P}(V^*)$
you get a line
T3. $\mathcal{O}(-1)(x) \subseteq V$ and this is a one to one correspondence.
This reflects that projective space is a parameter space: It parametrizes lines in $V$.
https://en.wikipedia.org/wiki/Moduli_space
There is the "Yoneda lemma":
https://en.wikipedia.org/wiki/Yoneda_lemma
A: The intuition of this so-called functor of points viewpoint is the following: An $K$-algebra homomorphism $\varphi: \mathcal{O}(X) \to k$ is determined by its action on $X_1, \dots, X_n$! More precisely, a homomorphism is fully determined by $\varphi(X_1), \dots, \varphi(X_n)$ since $\varphi$ is a $K$-algebra homomorphism and moreover, $X_1, \dots, X_n$ satisfy the relations given by $I(X)$, so hence $\varphi(X_1), \dots, \varphi(X_n)$ also satisfy those. In other words, we give coordinates $x_1, \dots, x_n$ of a point on $X$.
This also formalizes to a proof of your assertion.
Let‘s illustrate this with an example.
Example. Consider $\mathcal{O}(X) = k[X_1,X_2]/(X_1 - X_2)$. An element $\varphi \in \operatorname{Hom}(\mathcal{O}(X), k)$ is then fully determined by $\varphi(X_1), \varphi(X_2)$. Moreover, we have $$\varphi(X_1) - \varphi(X_2) = \varphi(X_1 - X_2) = \varphi(0) = 0.$$ So $(\varphi(X_1), \varphi(X_2)) \in V(X_1 - X_2) = X$.
Of course, the exact same thing can be done with any other affine variety. For me, understanding this viewpoint was what helped me better understand and further appreciate the Yoneda Lemma.
