# Free homotopies versus based homotopies.

Let $[X,Y]$ the set of homotopy classes of continuous maps between the topological spaces $X,Y$. Let us assume that both $X,Y$ are path connected. There is a canonical forgetful morphism, $$[(X,x_0);(Y,y_0)] \to [X,Y]$$ mapping homotopy classes of based maps (with homotopies respecting base points) to $[X,Y]$.

I am trying to show that this map is surjective. One idea that I had is to replace $X$ by the homotopy fiber (or fibrant replacement) $X_f$ which is equivalent to $X$ in order to have more flexibility. Then since $Y$ is path connected I have a path $\gamma$ joining $f(x_0)$ with $y_0$. Then if we look at the canonical map, $$ev_1:X_f \to Y,$$$$(x,\gamma') \mapsto \gamma'(1)$$ one has that $ev_1(x_0,\gamma)=y_0$ which looks good. So maybe one could try to exhibit an homotopy equivalence between $(X,x_0) \sim (X_f;(x_0,\gamma))$ however I am not sure if this makes any sense or if I am just missing some obvious construction.

What you want here is a cofibrant replacement, not a fibrant replacement. That is, replace $X$ by the mapping cylinder of the inclusion of the basepoint. Explicitly this has the effect of attaching to $x_0$ an interval $[0, 1]$ and declaring the end of the interval to be the "new" $x_0$, which we'll call $x_1$ to avoid confusion. Call this space $M_X$. Our goal is now to show that any map $M_X \to Y$ is homotopic to a map sending $x_1$ to $y_0$.
Now the argument is easy. Given a map $f : M_X \to Y$ and a path $p$ from $f(x_1)$ to $y_0$, we modify $f$ by a homotopy only on the dangling interval part, which gradually retracts the existing path from $f(x_0)$ to $f(x_1)$ given by the interval, then gradually extends along the path $p$ until $f(x_1)$ reaches $y_0$ as desired.
More abstractly, the point is that by construction a map $f : M_X \to Y$ is a pair consisting of a map $X \to Y$ and a path from $f(x_0)$ to some other point $f(x_1)$, and this extra path gives us the freedom we need.