Q:

Cardinality of variety

I'm trying to show that the cardinality of any variety of positive dimension is $ |k |$ where $k $ is the field being considered. This is part of exercise I.4.8 in Hartshorne's Algebraic Geometry:

Show that any variety of positive dimension over $k $ has the same cardinality as $ k $. Hints: Do $\mathbb{A}^{n} $ and $\mathbb{P}^{n}$ first. Then for any $ X $, use induction on the dimension $ n $. Use (4.9) to make $ X $ birational to a hypersurface $ H \subset\mathbb{P}^{n+1 }$. Use (Ex. 3.7) to show that the projection of $  H$ to $\mathbb{P}^{n}$ from a point not on $ H$ is finite-to-one and surjective.

So far I successfully showed this result for $ \mathbb{A}^{ n} $ and $ \mathbb{P}^{ n} $. For the general case, since $ X$ sits in a projective space, we have $|X | \le | k| $. To show the opposite inquality, $ X $ has an affine open subset $ U $of positive dimension. Hence there is a nonconstant polynomial as a regular function on $ U $. If I show that this polynomial is surjective, I'm done. I'm unable to show this so far.
I'm interested in completing my approach. If it's hopeless or too difficult, I'm fine with a solution following the hint of the book.
Thank you

A:

Your approach runs into the difficulty of showing surjectivity of any nonconstant regular function. However, it can be made to work after some tweaks:
It suffices to show that an affine variety $U$, with $\dim U > 0$, has $|U| \ge |k|$. A morphism $U \to \mathbb{A}^1_k$ is the same as an element of the coordinate ring $A(U) = k[x_1, \ldots, x_n]/I(U)$. Since $k = \overline{k}$ and $\dim U = \dim A(U) > 0$, there exists $f \in A(U)$ transcendental over $k$, i.e. $\phi^* : k[x] \to A(U), x \mapsto f$, is an injection. Then $\phi : U \to \mathbb{A}^1_k$ is dominant (in fact, $\phi(U)$ contains a nonempty open set), so $|\mathbb{A}^1_k \setminus \phi(U)| < \infty \implies |U| \ge |\phi(U)| = |\mathbb{A}^1_k| = |k|$.

