Show that $f^{-1}(B)=A$ I started yesterday my study of functions. I’m following the book “Proofs and Fundamentals”, by Ethan D. Bloch, and I’m having some trouble in starting myself in formal proofs that involve functions. This is one of my problems.
Problem:

Let $A$ and $B$ be sets and $f \colon A \to B$ be a function. Show that $f^{-1}(B) = A$.

So far, I understand that I will have to show that $f^{-1}(B) \subseteq A$ and $A \subseteq f^{-1}(B)$. The only definition that I have used is that of a function given by Bloch as a subset of $A \times B$.
So, my proof was something like this.

By definition, $f^{-1}(B) = \{a \in A \mid \exists b \in B: f(a) = b\}$. Let $x \in f^{-1}(B)$. Then $x \in A$ and it exists some $b \in B$ such that $f(x) = b$. In particular, $x \in A$. Hence, $f^{-1}(B) \subseteq A$.
Now, let $a \in A$. Since $f$ is a function from $A$ to $B$, there exists a unique ordered pair of the form $(x,y)$ for all $x \in A$ and some $y \in B$ with $y = f(x)$. So, there must be a unique ordered pair $(a,b)$ with $b \in B$ and $b = f(a)$. For that, $f(a) \in B$; and by definition, $a \in f^{-1}(B)$. Hence, $A \subseteq f^{-1}(B)$.
Therefore, we have that $f^{-1}(B)=A$. $\square$

Please give all the feedback to turn this proof as formal as possible.
Thank you for your time.
 A: I don't think the statement of the problem is correct, unless you tacitly assume that $A$ is the domain of $f$ and $B$ is the range of $f$. Here's an easy counterexample:
Let $f(x) = x^2$. Then $f([0,\infty)) = [0,\infty)$, but $f^{-1}([0,\infty)) = (-\infty,\infty)$.
Here are some modifications of the problem that would make it correct:
(1) Let $A$ and $B$ be sets and let $f:A\to B$ be a bijective function. Show that $f^{-1}(B) = A$.
(2) Let $A$ and $B$ be sets and let $f:A\to B$ so that $f$ is only defined on $A$. Show that $f^{-1}(B) = A$.
(3) Let $A$ and $B$ be sets and let $f:A\to B$ be a function. Show that $A\subset f^{-1}(B)$.
This is how I would write this proof:

Let $a\in A$. Then $f(a) = b\in B$ from the given, hence, $a\in f^{-1}(b)$. This shows that $A\subset f^{-1}(B)$. (This would finish
the proof for (3)).
Let $b\in B$ and assume $f^{-1}(b)$ is defined and $f^{-1}(b) = x\notin A$.
(2) But then $f(x) = b$, which contradicts the assumption that $f$ is only defined on $A$, hence, $A\supset f^{-1}(B)$ and we're done.
(1) Since $f$ is surjective,
there must be some $a\in A$ such that $f(a) = b$. But that means that
$f(a) = f(x)$ with $a\neq x$, which contradicts injectivity of $f$.
Hence, $A\supset f^{-1}(B)$ and we're done.

