Are locally homotopic functions homotopic?

Suppose we have two (smooth) functions $f,g:X\to Y$, where $X,Y$ are smooth (second-countable, Hausdorff) manifolds which are locally homotopic (that is, any point in $X$ has a neighbourhood $U$ such that for any $V$ contained in $U$ with its closure, there is a homotopy which turns $f$ into $g$ in $V$, but keeps them fixed outside $U$).

Are $f,g$ necessarily homotopic? If the answer is yes, how much can we weaken the assumptions?

This seems rather obvious if $X$ is compact, for example, but I can't think of an easy way to show it in general, although it seems to be intuitively true.

• Am I missing something or do any two $f$ and $g$ satisfy this? Every point in $X$ has a Euclidean (contractible) neighborhood $U$, and so any two functions with domain $U$ are thus homotopic. Do you mean homotopic relative to the boundary of$U$? – Jason DeVito Dec 24 '12 at 23:51
• @JasonDeVito: yes, good point, that was my intention. Thanks for pointing it out. :) – tomasz Dec 25 '12 at 0:05
• Take spheres for example. Doesn't the identity and constant map from $S^n$ to itself satisfy your condition? – lee May 25 '13 at 5:11
• @lee: No, they are not homotopic if you restrict them to an open set not containing the value of the constant map. Notice that I want the map to stay fixed outside $U$: the homotopy is of the entire function, only the change is made locally. – tomasz May 25 '13 at 12:22
• But you said I only have to keep it fixed outside U and homotopy f to make it the same with g inside V? When make V small enough, I think my example does work. – lee May 25 '13 at 12:35

Take spheres for example. The identity and constant map from $S^n$ to itself satisfy the condition. Because one can always choose $V$ relatively small compared to $U$, so that we can use geodesics to construct the local homotopy.