I have seen that due to Hilbert's Nullstellensatz that every maximal ideal of $k[x_1, \dots, x_n]$ is of the form $(x_1-a_1, \dots, x_n - a_n)$ and hence we obtain a bijection between the maximal ideals of $k[x_1, \dots, x_n]$ and $\mathbb{A}^n_k$.
Specifically the map $\operatorname{MaxSpec} k[x_1, \dots, x_n] \to \mathbb{A}^n_k$ given by $(x_1-a_1, \dots, x_n-a_n) \mapsto (a_1, \dots, a_n)$ is a bijection.
Now, I have seen in this question: What *is* affine space?, that apparently $\operatorname{Spec}k [x_1, \dots, x_n]$ is bijective to $\mathbb{A}^n_k$. But then doesn't this imply (taking the above into account) that $\operatorname{MaxSpec} k[x_1, \dots, x_n] = \operatorname{Spec} k[x_1, \dots, x_n]$? Then this would then imply that all prime ideals in $k[x_1, \dots, x_n]$ are maximal which is not the case, so this must be a contradiction, which leads me to believe that there is no bijection between $\operatorname{Spec}k [x_1, \dots, x_n]$ and $\mathbb{A}^n_k$ in general.
But I have seen, stated in examples in some Algebraic Geometry books, that for a field $k$, we have that $$\operatorname{Spec} k[x_1, x_2] = \mathbb{A}^2_k.$$
However, there is a question about this here: What do prime ideals in $k[x,y]$ look like? which seems to indicate otherwise (and which also makes the case that we don't have a bijection between $\operatorname{Spec} k[x_1, \dots, x_n]$ and $\mathbb{A}^n_k$ in general).
So my two questions are
- What is the precise relationship between $\operatorname{Spec} k[x_1, \dots, x_n]$ and $\mathbb{A}^n_k$ for general $n$?
- In the case $n=2$, do we know that $\operatorname{Spec} k[x_1, x_2] = \mathbb{A}^2_k$?
I think for question one, at the moment, all I can say is that there is an injection $\mathbb{A}^n_k \hookrightarrow \operatorname{Spec} k[x_1, \dots, x_n]$ since we have the bijection between $\operatorname{MaxSpec} k[x_1, \dots, x_n]$ and $\mathbb{A}^n_k$.