I have a question from Hatcher's Algebraic Topology Chapter 0 at Page 3: http://www.math.cornell.edu/~hatcher/AT/ATch0.pdf
One could equally well regard a retraction as a map $X\to A$ restricting to the identity on the subspace $A \subset X$ . From a more formal viewpoint a retraction is a map $r : X \to X$ with $r^2 = r$ , since this equation says exactly that $r$ is the identity on its image.
So I am confused: why we can see retraction map as restriction? Should I see the restriction here as restriction on a local chart? Assuming so, where the explicit function $r^2 = r$ origin from?