I recently solved an interesting problem on an midterm. Here is one piece of it:
Let $K =\prod_{i=1}^\infty \{0,1\}$ in the product topology, and let $s_1,s_2,\ldots$ be a sequence of positive real numbers such that $\sum_{i=1}^\infty s_i = 1$. Define a function $f\colon K \to [0,1]$ by $(k_1,k_2,\ldots) \mapsto \sum_{i=1}^\infty k_is_i$.
Show that $f$ is continuous. (This part I had no trouble with.)
Show that if $s_k \leq \sum_{i=k+1}^\infty s_i$ for all $k$, then $f$ is surjective.
I was able to prove this, but I'm not satisfied with my proof of the second part, because it seems like there should be a much easier way to show this. Does anyone see a simple/simpler approach to this problem than mine?
Here's a very rough outline of my proof. I've left out a lot of details, so let me know if something really doesn't make sense.
Suppose there is some $x \in [0,1] \setminus f(K)$. Then there is a neighborhood $(x-\epsilon,x+\epsilon)$ which isn't hit by $f$. Since $K$ is compact, $f(K) \cap [0,x]$ is compact, hence closed, and so it contains its supremum. This supremum is the image of an element of the form $(k_1,\ldots,k_n,0,1,1,\ldots)$. By our hypotheses we get $f((k_1,\ldots,k_n,0,0,\ldots)) < x-\epsilon$ and $f((k_1,\ldots,k_n,0,1,1,\ldots)) > x+\epsilon$, so we take the supremum of the images of all elements that start with $(k_1,\ldots,k_n,0)$ and map into $[0,x]$. This element is again the image of an element whose entries are eventually equal to 1. Repeating this gives a sequence of pairs of elements of $K$ with longer and longer initial parts. These must converge in $K$, but their images have to be at least $2\epsilon$ apart, so we reach a contradiction.