If $X$ is compact, show that $X$ is totally disconnected if and only if $C(X)$ as a C*-algebra is generated by its projections.
My attempt: Suppose $X$ is totally disconnected, then $X=\{x_i\}_{i\in I}$. In this case clearly $C(X)$ is generated by the family of projections $\{\chi_{x_i} ; i\in I\}$.
Conversely, suppose $X$ is not totally disconnected, so there is a subset $Y$ of $X$ such that $Y$ is a connected component and it has at least two points.
If $X\not\subset \Bbb C$, then there is a compact subset $X'$ of $\Bbb C$ such that $C(X)$ is an $*-$ isomorphism onto $C(X')$. Thus we can suppose $X\subset \Bbb C$.
Clearly $id_Y$ is a generator for C(X) and is not a projection which is a contradiction.
Please check my attempt and allow me to know your opinion about that. Thanks.
Hint:
Projections are elements $f$ so that $f^2=f$. For $f\in C(X)$ this is equivalent to $f$ takes the values $0$ and $1$. A continuous functions $f \colon X\to \mathbb{R}$ with $f(X)\subset \{0,1\}$ gets us a partition of $X$ into two disjoint closed sets $f^{-1}(0)$ and $f^{-1}(1)$
What does it mean that a family of functions generates $C(X)$. It means that it contains the constants and separates the points ( http://en.wikipedia.org/wiki/Stone%E2%80%93Weierstrass_theorem)
Can you take it from here?