If $f\tau$ is continuous for every path $\tau$ in $X$, is $f:X\rightarrow Y$ continuous?

Solution 1:

No, it does not follow. Let

$$X = \{0\} \times [0,1] \cup [0,1]\times \{1\} \cup \bigcup_{n=1}^\infty L_n,$$

where $L_n = \left\{(x,nx) : \frac{1}{n^2} \leqslant x \leqslant \frac{1}{n}\right\}$, with the subspace topology induced by $\mathbb{R}^2$. Let $f \colon X \to \mathbb{R}$ be given by

$$\begin{align} f(0,y) &= y\\ f(x,1) &= 1+x\\ f(x,nx) &= 1 + \frac{1}{n} + (1-nx). \end{align}$$

Then $f$ is not continuous in $(0,0)$, since $f\left(\frac{1}{n^2},\frac{1}{n}\right) = 2$ for all $n \geqslant 1$, but $f$ is continuous in all other points. Since every path passing through $(0,0)$ in $Y$ must lie on the segment $\{0\}\times [0,1]$ in a neighbourhood of all $t$ with $\tau(t) = (0,0)$, $f\circ \tau$ is continuous for all paths.

However, as Ted Shifrin notes in a comment, if $X$ is locally path-connected and first countable, then the continuity of $f\circ\tau$ for all paths $\tau \colon \mathbb{I} \to X$ implies the continuity of $f$.