Extending nullhomotopic function to boundary of sphere question Suppose $f:\mathbb{S}^n\rightarrow Y$ is a continuous map null homotopic to a constant map $c$. In other words: $F: f\simeq c$ , where $c(x)=y$
Now, we may extend $f$ to a continuous map $g: D^{n+1}\rightarrow Y$ by defining
$g(x)= y$ if $0\leq ||x||\leq \frac{1}{2}$ and $F(\frac{x}{||x||},2-2||x||)$ if $\frac{1}{2}\leq ||x||\leq  \frac{1}{2}$
Now, on $||x||=\frac{1}{2}$, $F(\frac{x}{||x||},2-2||x||)=F(\frac{x}{||x||},1)=c=y$.
Hence $F$ is continuous by the gluing lemma.
I was wondering as to what the intuition is for constructing such a function, what geometrical clues allow one to define such a function $F$
 A: Here is the general case:
Let $f\colon (X,x_0) \to (Y,y_0)$ and $g\colon (S^n,s) \to (X,x_0)$ be basepoint preserving maps. Let $(Z,x_0)$ be the space that arises from $X$ by attaching a $D^{n+1}$ disk via $g$. Then the following are equivalent:

*

*$f_*[g] = 0$ in $\pi_n(Y,y_0)$

*$f$ extends to a map $Z\to Y$.

Since $f_*[g] = [f\circ g]$ is nullhomotopic in $\pi_n(Y,y_0)$, there is a homotopy $$H\colon S^n\times[0,1]\to Y$$ between $f\circ g$ and $\operatorname{const} = \{*\}$, i.e. $$H(\cdot, 0) = f\circ g,\ H(\cdot,1) = \{*\}$$
As Tyrone mentioned, since $H$ is constant on $S^n\times\{1\}$, we factor through a map $\widetilde{H}\colon S^n/S^n\times\{1\} \to Y$ via
$$S^n\times[0,1] \xrightarrow{q} S^n/S^n\times\{1\} \xrightarrow{\widetilde{H}} Y$$
Observe that $ S^n/S^n\times\{1\} \simeq D^{n+1}$, therefore you have
$$\widetilde{H}\colon D^{n+1} \to Y$$
since $$\widetilde{H}\vert_{S^n} \equiv f$$ the map $\widetilde{H}$ extends $f$ to a map $Z\to Y$.
A: Your definition of $g$ is unnecessarily complicated, and this this gives rise to asking "what the intuition is for constructing such a function".
It is much easier to proceed as follows.
You have a homotopy $F : f \simeq c$. Let $G : c \simeq f$ be the "inverse" homotopy $G(x,t) = F(x,1-t)$. Define
$$g : D^{n+1} \to Y, g(x) = \begin{cases} G(\frac{x}{\lVert x \rVert}, \lVert x \rVert) & x \ne 0 \\ y  & x = 0 \end{cases}$$
This is an extension of $f$ since for $x \in S^n$ we have $\lVert x \rVert = 1$ and therefore $g(x) = G(x,1) = f(x)$.
The "problem" here is to show that $g$ is continuous in $0$. I shall not give a proof, it is an easy exercise. It also follows from the "formal part" below. The benefit of your (seemingly strange) definition is that we do not need a special argument to prove continuity.
Anyway, now you see what Tyrone's and Tom Ariel's comments want to say you. The intuition for constructing $g$ is that $D^{n+1}$ is the disjoint union of the spheres $S^n_t = \{ x \mid \lVert x \rVert = t \}$ with $t \in (0,1]$ and the one-point space $S^n_0 = \{0\}$. On $S^n_t$ with $t \in (0,1]$ we take the map $G_t : S^n \to Y$, on $S^n_0$ we take the (constant) map $0 \mapsto y$.
To be formal, the map $G : S^n \times [0,1] \to Y$ has the property $G(S^n \times \{0\}) = \{y\}$, thus induces $\tilde G : (S^n \times [0,1])/(S^n \times \{0\}) \to Y$. But $Q  = (S^n \times [0,1])/(S^n \times \{0\})$ can be naturally identified with $D^{n+1}$. In fact, the map $p : S^n \times [0,1] \to D^{n+1}, p(x,t) = t\frac{x}{\lVert x \rVert}$, is continuous and collapses $S^n \times \{0\}$ to $0$. Since $S^n \times [0,1]$ is compact and $D^{n+1}$ is Hausdorff, $p$ is a closed map, thus a quotient map. This gives us the identification of $Q$ with $D^{n+1}$.
