Let $X \subset \mathbb R^n$ be starlike. Thus we got a $x_0 \in X$ s.t. for every $x \in X$ there is a line connecting $x$ and $x_0$. Denote that line as $\gamma_x:I \to X : t \mapsto (1-t)x + tx_0$. I want to show that $X$ is contractible. This is true, if $1_X$ (identity on $X$) is homotopic to a constant function $f$ which we choose as $f:X \to X : x \mapsto x_0$. Letting $h:X \times I \to X : (x,t) \mapsto \gamma_x(t)$, we see that $h$ is a homotpoy between $1_X$ and $f$, IF $h$ is continuous.
My question: Why is $h$ continuous ? I don't think that this trivially follows from the fact that all $\gamma_x$ are continuous.
That's right, it doesn't follow from that (one needs to use the shape of the $\gamma_x$ to deduce continuity).
But, we have a continuous
$$H \colon \mathbb{R}^n\times I \to \mathbb{R}^n;\quad H(x,t) = (1-t) x + t x_0.$$
Hence the restriction of $H$ to $X\times I$ is continuous. And since $X$ is star-shaped, the image of that restriction is contained in $X$, and thus the continuity of $h$ follows.
$$ \begin{matrix} X\times I & \overset{\iota\times \operatorname{id}}{\hookrightarrow} & \mathbb{R}^n\times I\\ \downarrow h & & \downarrow H\\ X & \overset{\iota}{\hookrightarrow} & \mathbb{R}^n \end{matrix} $$
By definition of the subspace topology, $h$ is continuous if and only if $\iota\circ h$ is continuous. But $\iota\circ h = H\circ (\iota \times \operatorname{id})$, and the latter is continuous.