Definition: An affine scheme X is connected if: $X\ne \emptyset$ If $X_1$, $X_2$ are open subschemes of $X$ such that $X_1 ∪X_2= X$ and $X_1\cap X_2=\emptyset$, then $X_1$ or $X_2$ is empty.
I aim to prove that An affine scheme is connected $\Leftrightarrow$ $\mathcal O(X)\ne \{0\}\land \mathcal O(X)$ only have trivial nilpotents, that is, no more nilpotent than $0,1$.
I have proved $X$ is connected $\Rightarrow \mathcal O(X)$ is nonzero and the only idempotent in it are $0$ and $1$. And stuck on the other direction.
Could someone please help? Thanks.