Lemma 10.21.4. Let $R$ be a nonzero ring. Then $\mathop{\mathrm{Spec}}(R)$ is connected if and only if $R$ has no nontrivial idempotents.

Proof. Obvious from Lemma 10.21.3 and the definition of a connected topological space. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).