Q:

Idempotent in a ring of continuous functions?

Let $S$ be a set of continuous functions defined on an interval $[0,1]$. The addition and multiplication between two elements is defined as $(f+g)(x)=f(x)+g(x)$ and $(f\cdot g)(x)=f(x)g(x)$. So $S$ is a commutative ring with unity. Show only idempotents are $0,1$; which are constant functions.

Okay I looked up an solution.
Let $f$ be an idempotent and define $$A=\{x | f(x)=1\},$$ $$B=\{x | f(x)=0\},$$ $f*f=f$ for any idempotent element, so $f=0$ or $f=1$ for any $x$ in $[0,1]$. So, $A \cup B= [0,1]$ and $A\cap B=\phi$. $A$ and $B$ are inverse image of a closed set by a continuous function so they are closed and bounded.
Let $c=\sup A$. It says we can assume $c \neq1$(wonder why...) then it is obvious that $f$ is not continuous at $c$(I wonder why). Any help please? I see $c$ must belong to $A$, since $A$ is closed...cannot proceed from there.

A:

I'm not sure why they are proceeding in that fashion. A better way to go is this: since $A,B$ are disjoint and closed in $[0,1],$ and since $A\cup B=[0,1],$ then $A=[0,1]\setminus B$ is also open in $[0,1],$ and so is $B.$
Since $[0,1]$ is connected, then the only subsets of $[0,1]$ that are both closed and open are...what?
(Additionally, while you can conclude that $A,B$ are bounded by virtue of being subsets of $[0,1],$ this has nothing particular to do with being inverse images of closed sets.)
As for why we can assume that $c\ne 1$ in their approach, it's because if $\sup A=1,$ then $1\in A,$ so $1\notin B,$ and so instead we let $c=\sup B,$ whence $c\ne 1$ and we proceed as before. In particular, we should note that $(c,1]$ is a subset of (whichever set $c$ isn't the supremum of), but $c$ is not an element of that set, which contradicts the fact that both sets are closed. Alternately, we can consider $g=1-f,$ instead, which we can prove to be an idempotent whenever $f$ is, then let $A'=\{x:g(x)=1\},$ $B'=\{x:g(x)=0\}$ and note that $B=A',$ $A=B',$ so if $\sup A=1,$ then $c=\sup A'=\sup B<1,$ and so....
Regardless, it would have been better for the solution to have phrased it this way:

Note that $\sup A$ and $\sup B$ cannot both be equal to $1,$ for then $1$ would belong to both $A$ and $B$ by virtue of their being closed sets. On the other hand, one of $\sup A,\sup B$ must be equal to $1.$ Without loss of generality, then, we may assume that $\sup A<1.$ Letting $c=\sup A,$ we have....

