Let $A$ be an integral, finitely-generated algebra over some field $k$, of dimension $\text{dim}(A)\geq2$ such that $A = \cap_Q A_Q$ where $Q$ runs over elements of $\text{Spec}A$ of height $1$. Let $X = \text{Spec}A$ and $p \in X$ be a closed point, i.e. a maximal ideal of $A$.
Show that the open set $X-p$ can't be an affine scheme.
I know of a solution which I don't quite understand. It goes like this:
Let $U = X-p$. If $U$ were affine, then the open immersion $U \rightarrow X$, which isn't an isomorphism, wouldn't induce an isomorphism $\varphi:O_X(X) \rightarrow O_X(U)...$
Here I assume the antiequivalence of categories $\text{(opposite category of rings)}A^{opp} \rightarrow \text{Spec}A \text{ (category of affine schemes)}$ was used to go from $U \rightarrow X$ to $O_X(X)\rightarrow O_U(U) = O_X(U)$ between the associated rings, since we know that $O_{\text{Spec R}}(\text{Spec}R)=O(D(1))=R_1=R$ for any affine scheme over a ring $R$.
Since $U \rightarrow X$ does not have a reciprocal, neither does $\varphi$ which therefore isn't an isomorphism.
... But $\varphi$ is injective because $X$ is integral, and surjective because an element of $O_X(U)$ belongs to every $A_Q$ with $Q$ prime of height $1$ since $p$ is maximal of height $\geq 2$
Here I guess that $\varphi$ is just the restriction because inferring from inclusion properties one can conclude $\varphi$ follows the restriction axioms
If it really is the restriction, then it is common knowledge that since $X$ is integral, $\varphi$ is injective, as is the case of restrictions on an integral scheme.
Due to the dimension formula for finitely-generated $k$-algebras, I understand that $p$ has height $\geq2$. In particular, this means that $U$ contains all of the $Q$ prime ideals of height $1$. But I don't get how elements of $O_X(U)$ belong to $A_Q$. I can send them to $A_Q$ by considering the stalk at $Q$ but I don't see how it implies surjectivity. If the restriction is a set restriction from $A$ to some subring of $A$ then it is indeed surjective but I don't know what $\varphi$ does
Can somebody please explain about the surjectivity part? Why is $\varphi:\cap A_Q \rightarrow O_X(U)$ surjective?
To clear this from the unanswered queue, $\varphi$ is indeed the restriction. As you say, $\varphi$ is injective since $X$ is integral. The idea behind talking about elements of $\mathcal{O}_X(U)$ belonging to $A_Q$ is that one may embed both rings in $K(X)$, their common field of fractions, and compare there. As $\varphi$ is injective, you get that inside $K(X)$, we have $\mathcal{O}_X(X)\subset \mathcal{O}_X(U)$. Next, $\mathcal{O}_X(U)\subset A_Q$ for every prime $Q$ of height one, as $U$ contains all such $Q$. But this means that $\mathcal{O}_X(U) \subset \bigcap A_Q$, and $\bigcap A_Q=\mathcal{O}_X(X)$ by assumption. So $\mathcal{O}_X(X)\subset \mathcal{O}_X(U)\subset\mathcal{O}_X(X)$, and thus both inclusions must be equalities.