My question is regarding a specific exercise that I'm not really sure how to approach. Suppose I have a smooth manifold $M$ and let $A$ be a closed subset. Now suppose that there exists a smooth function $f:M \to A$ such that $f|_A = id$ (smooth retract).
I want to show that $A$ is a submanifold, i.e, it is Hausdorff, second countable and locally euclidean. Hausdorff and second countable are both hereditary properties, so only the latter is left.
My attempt was to prove that if $(U, \varphi)$ is a chart around $x \in A \subset M$ for $M$, then $\left(f(U), \varphi|_{f(U)}\right)$ is the desired chart. However, I'm not sure if $f(U)$ is open. I probably should use that $A$ is closed and $f$ is a retract, but I couldn't connect both facts.
There is no need for a solution, just a hint is enough.
PS: John Lee suggested that I should ask a question instead of leaving the exercise for the community, so here it is. I rewrote my previous post here. :)