Let $f:X\rightarrow Y$. Let $A$, $A_1$ and $A_2$ be subsets of $X$ and $B$, $B_1$, and $B_2$ be subsets of $Y$. Then, I need to prove that $f^{-1}(B_1\cup B_2)=f^{-1}(B_1)\cup f^{-1}(B_2)$.
I know that by the definition of an inverse image, if we let $x\in f^{-1}(B_1\cup B_2)$, then we know that $f^{-1}(x)\in(B_1\cup B_2)$. From here, I'm not sure how to get to $f^{-1}(B_1)\cup f^{-1}(B_2)$.
From where you started, then $f(x) \in B_1\cup B_2 \Rightarrow x \in f^{-1}(B_1)\cup f^{-1}(B_2)$, conversely if $x \in f^{-1}(B_1) \cup f^{-1}(B_2) \Rightarrow f(x) \in B_1\cup B_2 \Rightarrow x \in f^{-1}(B_1\cup B_2)$, and the equality follows.