TITLE: Meaning of G(k) being dense in G for an algebraic group G/k
QUESTION [5 upvotes]: Let $G$ be an algebraic group over a field $k$ of characteristic 0. I have read that: if $G$ is connected, then $G(k)$ is dense in $G$ for the Zariski topology. I do not understand what kind of density this might be since $G(k)$ is abstractly defined as the set of morphisms $\text{Spec}(k) \to G$. If $G$ is an affine variety in $\mathbb{A}_k^n$ for instance, one might think of $G(k)$ as a subset of $k^n$. But how does this connect to the abstract definition of $G$ as a scheme or as a functor from $k$-algebras to groups? I do not see a direct relation or any mean to relate the group $G(k)$ (a set of points) to the abstract scheme (or functor) $G$, let alone saying that $G(k)$ is dense in $G$ for the Zariski topology. How is this topology even defined on $G(k)$ and how is $G(k)$ even a subset of $G$? Could someone please resolve this issue for me? Thank you in advance.

REPLY [5 votes]: $\newcommand{\Spec}{\mathrm{Spec}}$$\newcommand{\h}{\mathcal{O}}$$\newcommand{\mf}[1]{\mathfrak{#1}}$While hunter's answer is perfectly fine, I do think it's worth phrasing it in a way that is independent of embedding.
The point is the following:

Fact: Let $X$ be a scheme, $A$ ring, and $L$ a field. Suppose that $X$ and $L$ have the structure of a $\Spec(A)$-scheme. Then, there is
a natural equality (really bijection)
$$\mathrm{Hom}_{\Spec(A)}(\Spec(L),X)=\left\{(x,\varphi):\begin{aligned}(1)&\quad
 x\in X\\ (2)&\quad \varphi:k(x)\to L\text{ is an }\\ &\quad A\text{-algebra
 homomorphism}\end{aligned}\right\}$$

Here $k(x)$ is the residue field of $x$.
Proof: Let us use $p$ to denote the single point of $\Spec(L)$ (as a topological space it's one point). Suppose first that $f:\Spec(L)\to X$ is a morphism of schemes over $\Spec(A)$. Then, $x:=f(p)$ is a point of $X$. By the definition of a morphism of schemes one has a local ring map $f^\sharp_x:\h_{X,x}\to \h_{\Spec(L),p}=L$. But, since this map is local and $(0)$ is the maximal ideal of $L$ we see that $\ker(f_x^\sharp)=(f^\sharp_x)^{-1}((0))=\mf{m}_x$ (this last ideal being hte maximal ideal of $\h_{X,x}$). In particular, $f_x^\sharp$ factorizes uniquely through $\h_{X,x}/\mf{m}_x=k(x)$. Thus, from $f$ we get the pair $(x,f_x^\sharp)$. Conversely, if we have a pair $(x,\varphi)$ we get a morphism $\Spec(\varphi):\Spec(L)\to \Spec(k(x))$. But, note that we have obvious morphisms of $\Spec(A)$-schemes
$$\Spec(k(x))\to \Spec(\h_{X,x})\to X$$
where the first is the one coming from the quotient map $\h_{X,x}\to k(x)$ and the second is the tautological one (i.e. for any affine open $\Spec(B)$ of $X$ containing $x$ there is the natural map $\Spec(\h_{X,x})=\Spec(B_\mf{q})\to \Spec(B)\to X$ where $\mf{q}$ is the prime ideal of $B$ corresponding to $x$--this composition can be checked to be indpendent of the choice of $B$). We then get a morphism $\Spec(L)\to X$ as the composition
$$\Spec(L)\xrightarrow{\Spec(\varphi)}\Spec(k(x))\to\Spec(\h_{X,x})\to X$$
It's easy to check that these two associations are inverse to one another. $\blacksquare$
What's the upshot of this?

Corollary: Let $X$ be a scheme over $\Spec(k)$. Then, there is a natural equality (bijection)
$$X(k):=\mathrm{Hom}_{\Spec(k)}(\Spec(k),X)=\{x\in X:k(x)=k\}$$

Proof: Applying the last fact we see that $X(k)$ is in bijection with points $(x,\varphi)$ where $x$ is in $X$ and $\varphi:k(x)\to k$ is a $k$-morphism. But, note that there is a $k$-morphism $k(x)\to k$ if and only if $k(x)=k$ (more precisely the natural morphism $k\to k(x)$ is an isomorphism) in which case it's unique. Thus, we get our result! $\blacksquare$
In particular, for any scheme $X$ over $\Spec(k)$ we see that we can naturally view $X(k)$ as a subset of $X$. In particular, to say that $X(k)$ is dense in $X$ means that the subset $X(k)$ is dense in the topological space $X$ (the scheme $X$ considered with the Zariski topology).
The following is a good exercise:

Exercise: Let $X$ be an affine scheme which is of finite type over $\Spec(k)$. Choose a closed embedding $X\hookrightarrow \mathbb{A}^n_k=:\Spec(k[T_1,\ldots,T_n])$
over $\Spec(k)$. Then, $X(k)$ (as described above) agrees with $X\cap
 k^n$ where $k^n\subseteq \mathbb{A}^n_k$ is the usual embedding of sets
(i.e. $(x_1,\ldots,x_n)\in k^n$ corresponds to the maximal ideal
$(T_1-x_1,\ldots,T_n-x_n)$).

This shows the connection to hunter's answer.
Then, your result more accurately/generally is the following:

Theorem ([1, Theorem 17.93]): Let $k$ be an infinite perfect field. Let $G$ be a connected, affine, geometrically reduced, group
scheme of finite type over $\Spec(k)$. Then, $G(k)$ is dense in $G$.

In particular, given Cartier's theorem (i.e. [1, Theorem 3.23]) and the fact that a field of characteristic $0$ is automatically perfect and infinite, one deduces the following:

Corollary: Let $k$ be a field of characteristic $0$ and let $G$ be an affine group scheme of finite type over $\Spec(k)$. Then, $G(k)$
is dense in $G$.

References:
[1] Milne, J.S., 2017. Algebraic groups: the theory of group schemes of finite type over a field (Vol. 170). Cambridge University Press.