Push-Forward Algebra of $\mathcal{B}(\mathbb{R})$ by $f(x) = \tan(x)$ Specifically $f(x)$ is defined to be $\tan(x)$ when $\cos(x) \neq 0$, and $0$ elsewhere. 
I am required to determine the $\sigma$-algebra $\mathcal{F} := \{A \subset \mathbb{R}: f^{-1}(A) \in \mathcal{B}(\mathbb{R}) \}$
My intuition suggests that this push-forward algebra is $\mathcal{B}$, as the preimage of any Borel subset of $\mathbb{R}$ is countably many copies of what is essentially a "continuously deformed" version of that Borel subset. 
It is easy to show that $\mathcal{B}(\mathbb{R})$ is a subset of the push-forward algebra, as the preimage of an open interval is a countable union of open intervals (with countably many isolated points $(..., -\frac{\pi}{2}, \frac{\pi}{2}, ...)$ thrown in if the open interval contains zero). Thus, as the Borel algebra on the reals is the smallest $\sigma$-algebra containing the open intervals, and the push-forward algebra contains the open intervals, clearly $\mathcal{B}(\mathbb{R})$ is contained in the push-forward algebra.
For the reverse inclusion, however, I have no idea, and any help would be much appreciated! 
 A: To show that $\mathcal{F} \subset \mathcal{B}$, we must show that if $f^{-1}(A)$ is Borel measurable, then $A$ is Borel measurable. 
For this, suppose that $A \subset \mathbb{R}$ with $f^{-1}(A) \in \mathcal{B}(\mathbb{R})$.  We take two cases according to whether $A$ contains $0$.  In either case, the key insight is that the continuous image of a Borel set under an injective function $g: \mathbb{R} \to \mathbb{R}$ is again a Borel set. (For a proof, see Image of Borel set under continuous and injective map.)  I guess it should be noted that the same still holds if the domain of $g$ is instead an interval.
Since $f$ is surjective, we have
$$
A = f(f^{-1}(A)), \tag{1}.
$$
That is, $A$ is the image of $f^{-1}(A)$ under $f$.  Of course, $f$ is not injective, but we will decompose the domain of $f$ into intervals so that the restriction of $f$ to each interval is injective.
Specifically, for each $j \in \mathbb{Z}$, let $f_j$ be the restriction of $f$ to the interval $(-\frac{\pi}{2}, \frac{\pi}{2}) + 2 \pi j$. Each function $f_j$ is a continuous bijection of its domain onto $\mathbb{R}$, and each of the sets $f_j^{-1}(A)$ is in $\mathcal{B}(\mathbb{R})$, because we can write each as the intersection of Borel sets; specifically, we have
$
f_j^{-1}(A) = f^{-1}(A) \cap \left(\left(-\frac{\pi}{2}, \frac{\pi}{2} \right) + 2 \pi j \right).
$
If $A$ does not contain $0$, then we can write
$
f^{-1}(A) = \bigcup_{j \in \mathbb{Z}} f_j^{-1}(A),
$
in which case equation (1) becomes
$$
A = f \left( \bigcup_{j \in \mathbb{Z}} f_j^{-1}(A) \right) 
 = \bigcup_{j \in \mathbb{Z}} f \left( f_j^{-1}(A) \right) 
 = \bigcup_{j \in \mathbb{Z}}f_j \left( f_j^{-1}(A) \right).
$$
Since each set $f_j^{-1}(A)$ is in $\mathcal{B}(\mathbb{R})$ and each function $f_j$ is injective on its domain, $f_j \left( f_j^{-1}(A) \right)$ is in $\mathcal{B}(\mathbb{R})$ for each $j$, which means that $A \in \mathcal{B}(\mathbb{R})$.
In the case that $A$ does contain $0$, the proof works almost the same way.  We let 
$
S = \left \{\dots, -\frac{5 \pi}{2}, -\frac{3 \pi}{2}, -\frac{\pi}{2}, -\frac{\pi}{2}, \frac{3 \pi}{2}, \frac{5 \pi}{2}, \dots \right \}.
$
Then we have that
$
f^{-1}(A) = S \cup \bigcup_{j \in \mathbb{Z}} f_j^{-1}(A),
$
and, consequently,
$$
A = f(S) \cup f \left(  \bigcup_{j \in \mathbb{Z}} f_j^{-1}(A) \right) = \{ 0 \} \cup \bigcup_{j \in \mathbb{Z}}f_j \left( f_j^{-1}(A) \right).
$$
Thus, $A$ is a countable union of Borel measurable sets, which means that $A$ is Borel measurable.
