## sigma-algebra generated by a function

suppose we have a $$X = [0,1]$$ and a function $$f\colon X \to \Re$$ where
$$f(x) = 1 - |2x -1|$$.
i'm bit confused on finding the sigma-algebra generated by this function. This is what i did

$$f(x)= \begin{cases} 2 -2x & x \in [\frac{1}{2},1] , \\ 2x& x \in [0, \frac{1}{2}) \end{cases}$$

so then is the sigma-algebra $$\sigma(f(x)) = \mathcal{B}([\frac{1}{2},1] \bigcup \mathcal{B}([0, \frac{1}{2}) = \mathcal{B}([0,1])$$ ?

the i do it is find the pre-image of the function of any open set in $$\Re$$ it far to easy for me to make mistakes when doing it this way. are alternative methods ?
 i think i may have figured it out. i graphed the function $$f(x)$$ and realised it was symmetrical, $$f(x) = f(1-x) \, x \in [0,1]$$ i then realised to find to generated sigma-field $$\sigma(f(x)) = \{ f^{-1}(B) \colon B \in \mathcal{B} \}$$ the inverse image for any borel set is the union of two intervals in [0,1] since the function symetrical. $$\sigma(f(x) = \{[\frac{1}{2},1] \bigcap \{1-\frac{B}{2} \colon B \in \mathcal{B} \} \bigcup [0, \frac{1}{2}] \bigcap \{\frac{B}{2} \colon B \in \mathcal{B} \}$$ where $$1-\frac{B}{2} = \{ 1-\frac{x}{2} \colon x \in B\}$$ This seems right to me, since the sigma-algebra contains 'coarser' sets that those contained in $$\mathcal{B}([0,1])$$