Proof: Suppose that \(r : X \rightarrow A\) is a retraction.
Let y be an element of A. We need to find a preimage of y, i.e. an element of X that maps onto y.
Since r is a retraction, there must exist another function \(s : A \rightarrow X\) such that \(r\circ s = id_A\).
Consider x=s(y), which is an element of A. Since \(r\circ s = id_A\), \((r\circ s)(y) = y\). That is \(r(s(y)) = y\). That is, \(r(x) = y\). So x is the required preimage.
Since we have found a preimage for an arbitrarily chosen element of the co-domain, r is onto.
The proof is short and simple, but not easy to come up with. This is because the problem is somewhat abstract.
This proof contains a lot of commentary about what we needed to do (at the start) and why we had found what we needed (at the end). That's helpful to the audience when they might have trouble understanding the outline of the proof.