TITLE: $B$ is a Borel set, implies $f(B)$ is a Borel set.
QUESTION [5 upvotes]: I have this exercise: 

Suppose $f$ is a real valued continuous function on $[a,b]$. Show that
  $f(B)$ is a Borel set for every Borel subset $B$ of $[a,b]$.
Hint: Consider the collection $M$ of all subsets $A$ of $[a,b]$ for which
  $f(A)$ is a Borel set. Show that $M$ is a sigma-algebra.

I am struggling a little. The hint tells me to look at: 
$M=\{A\mid f(A) \text{ is Borel}\}$, and show that this is a sigma algebra. I do get that $\emptyset \in M$, and that M is closed under countable unions. But how do I get closed under complements?, I mean $A \in M \rightarrow A^c \in M$?, the problem is that we only have $f(A)^c=f(A^c)$
 if f is bijective. 
And to finish the proof I also need that $f(O)$ is borel for every open set, but how do I get this?

REPLY [7 votes]: The statement you want to prove is wrong: There is a Borel set $B \subseteq [0,1]^2$ such that its projection $\pi_1[B]$ onto the first coordinate is not Borel (see for example here). Now let $\gamma \colon [0,1] \to [0,1]^2$ a continuous onto map, and $f := \pi_1 \circ \gamma \colon [0,1]\to [0,1]$. Then, $f$ is continuous, $A := \gamma^{-1}[B]$ is Borel, but 
$$ f[A] = \pi_1[\gamma\gamma^{-1}[B]] = \pi_1[B] $$
is not.