I'm proving the following lemma (this is part of a proof of Hurewicz's theorem)

Lemma. Let $$n\geq1$$. For $$n> 1$$ assume known that $$\pi_{n−1}(S^{ n−1}, z)$$ is free abelian of rank $$1$$. Let $$f$$ be a continuous self map of $$(D^n,\partial D^n)$$ of degree $$\pm1$$. Then $$f$$ is pair-homotopic to the identity if $$\deg(f) = 1$$

At one point of the proof, we proved the existence of an homotopy $$H:S^{n-1}\times I\rightarrow S^{n-1}$$ between $$f|_{S^{n-1}}$$ and the identity $$\text{id}$$ of $$S^{n-1}$$. Then, the professor says that

[The homotopy $$H$$] induces a map $$D^n\times\{0\}\cup S^{n-1}\times I\cup D^n\times\{1\}\xrightarrow{f|_{S^{n-1}}\cup H\cup\text{id}}D^n$$. Since $$D^n\times I$$ can be obtained from $$D^n\times\{0\}\cup S^{n-1}\times I\cup D^n\times\{1\}$$ by attaching an $$(n + 1)$$-cell and $$D^n$$ is contractible, there is a continuous extension $$\bar H: D^n \times I\rightarrow D^n$$

I don't understand why we need $$D^n$$ to be contractable. Moreover, I would say that the homotopy $$\bar H$$ can be described explicitly: First, $$D^n\times\{0\}\cup S^{n-1}\times I$$ is a retraction of $$D^n\times I$$, so take $$p:D^n\times I\rightarrow D^n\times\{0\}\cup S^{n-1}\times I$$ identity on the subspace, then $$\tilde H:D^n\times I\xrightarrow{p}D^n\times\{0\}\cup S^{n-1}\times I\xrightarrow{f|_{S^{n-1}}\cup H}S^n\hookrightarrow D^n$$is an homotopy between $$f$$ and a map $$g:D^n\rightarrow D^n$$ which is the identity on $$S^{n-1}$$. Then consider the map $$\hat H:D^n\times I\rightarrow D^n,\qquad\hat H(v,t)=g(v)(1-t)+vt$$Then $$\hat H$$ is a pair-homotopy between $$g$$ and the identity of $$D^n$$, hence we can juxtapose $$\tilde H,\hat H$$ to get a pair-homotopy between $$f$$ and the identity.

Is there something wrong with my argument? Any feedback is appreciated.

Your argument is correct. But let me first note that you need $$f\cup H\cup\text{id}$$ instead of $$f|_{S^{n-1}}\cup H\cup\text{id}$$.
The space $$B = D^n\times\{0\}\cup S^{n-1}\times I\cup D^n\times\{1\}$$ is the boundary of the $$(n+1)$$-cell $$D^n \times I \approx D^{n+1}$$ and you have a map $$\phi : B \to X$$ with $$X = D^n$$. It is well-known that $$\phi$$ has a continuous extension $$\bar H : D^n \times I \to X$$ if and only if $$\phi$$ is null-homotopic. If $$X$$ is contractible, this is automatically true. Hence for $$X = D^n$$ we are finished. Only if you do not know that $$X$$ is contractible, you must in fact explicitly construct $$\bar H$$. But you can do it also in the present case, and your approach works.
• @Alessandro By the way, your proof uses the convexity of $D^n$ which is much stronger than contractibility. Jan 13, 2022 at 10:01