I have the following exercise and I don't completely understand some things in the answer given by the textbook:
Exercise: Show that $f:(X,\mathcal{T}_X)\to (Y,\mathcal{T}_Y)$ is continuous if and only if $f(\overline{A})\subset \overline{f(A)}$ for every $A\subset X$. (Hint: for 'if', show that whenever $F$ closed in $Y$ and $A:=f^{-1}(F)$, then $\overline{A}\subset A$. Justify why this is sufficient.).
The answer is the following:
If f is continuous then $f^{-1}\overline{(f(A))}$ is a closed set in $X$ that contains $A$, so contains $A$:
$\overline{A}\subset f^{-1}\overline{(f(A))}.$
Applying $f$ to both sides shows that $f(\overline{A})\subset \overline{f(A)}$.
For the "if" proof i'm struggling to understand why taking a closed $F\in Y$ and then proving that $A=f^{-1}(F)$ is closed is sufficient to show that for every $A$ the function is continuous. What if $A$ is neither closed or open i.e it is just a set $A\subset X$? How do we prove it for that case?
The "if" proof:
Now suppose that $f(\overline{A})\subset \overline{f(A)}$. Take $F$ closed in $Y$ and set $A=f^{-1}(F)$; we need to show that $A$ is closed.
To do this we show that any $x\in\overline{A}$ is in $A$: this is sufficient, since we always have $A\subset \overline{A}$, so showing that $\overline{A}\subset A$ implies equality, and $A$ is closed if and only if $A=\overline{A}$.
Noting that $f(A)=f(f^{-1}(F))\subset F$ and using our assumption we have $$f(x)\in f(\overline{A})\in\overline{f(A)}\subset \overline{F}=F,$$
and so $x\in f^{-1}(F)=A$, i.e. $\overline{A}\subset A$.
I'm not quite sure why $x\in f^{-1}(F)=A$ implies $\overline{A}\subset A$. Is it because $f(x)\in f(\overline{A})$ and hence $x\in \overline{A}$. And since $f(\overline{A})\subset F$ then this means that $f(x)$ belonging to $f(\overline{A})$ means it belongs to $F$ and hence every $x\in \overline{A}$ also belongs to $A$?