I'm making my comments into an answer:
Recall that a retraction $r: X \to A$ is a map such that $ri = \operatorname{id}_{A}$, where $i: A \to X$ is the inclusion.
There are two definitions of a deformation retract:
The map $r: X \to A$ is called a deformation retraction if $r$ is a retraction and $ir \simeq \operatorname{id}_{X}$.
The subspace $A$ of $X$ is called a deformation retract if there is a function $F: X \times [0,1] \to X$ such that $F(x,0) = x$ and $F(x,1) \in A$ for all $x \in X$ and $F(a,1) = a$ for all $a \in A$. More accurately, we should say that $F(x,1)$ factors as $ir$ for $r: X \to A$ (necessarily unique since $i$ is injective) and write the last condition as $F(i(a),1) = i(a)$ since we're viewing $A$ as a space in its own right.
The two definitions are equivalent.
If $F$ is as in $2$ then we can write $ir = F(\cdot,1)$ and $r$ is a retraction by the properties of $F$. Clearly $F$ is a homotopy between $\operatorname{id}_X$ and $ir$.
Conversely, the hypothesis $\operatorname{id} \simeq ir$ gives a map $F: X \times [0,1] \to X$ such that $F(x,0) = x$ and $F(x,1) = ir(x)$. Since $r$ is a retraction we have $F(i(a),1) = ir(i(a)) = i(a)$.