If $X = [0,1] \times [0,1]$ and $Y = [0,1] \cup [2,3]$. I have to give an example of two continuous functions $f$ and $g$ that are not homotopic. I was thinking of $f(x,y) = x$ and $g(x,y) = y +2$ because they are clearly continuous but they are homotopic if there is a continuous mapping $F: X \times I \rightarrow Y$ such that
$$ F((x,y),0) = f(x,y) \quad and \quad F((x,y),1) = g(x,y) $$
But since $X$ is connected and $F$ is continuous $Y$ has to be connected as well, but the image of $f$ and $g$ are not connected. Is this correct?
Next question: How many homotopy classes are there? I was thinking of 2 but I don't know how to actually prove this.
observe this $Y$ has two connected component which are contractible...and $X$ is connected so image$f$ always stays in one component...now if $f,g: X \to Y$ and if $img f$ and $img g$ lies in same component then it can be easily proved that they are homotopic to constant map (simce $X, imgf, img g$ are contractible)...so they are homotopic to each other..so it only possible that they are not homotopic if the image of these two maps lie in distict component...but there are only two component...so there are two homotopy classes.