I am just starting to read about algebraic topology, and I wonder whether homotopy depends on function or the image. According to Munkres' definition, two continuous function $f,g:[0,1]\to Y$ are said to be homotopic if there exists a continuous map $F:[0,1]\times[0,1]\to Y$ such that
$$F(0,x)=x_0$$ $$F(1,x)=x_1$$ $$F(x,0)=f(x)$$ $$F(x,1)=g(x)$$
Now if $f:[0,1]\to Y$ is a given continuous function, and $g:[0,1]\to f(X)$ is a surjective continuous function with the same end points as $f$. Is it necessary for $f$ and $g$ homotopic?