**The restriction of $f$ to the boundary has degree zero.** It is true also in higher dimensions. The proof presented below is based on the proof of density of $C^\infty(M,N)$ in $W^{1,p}(M,N)$, $p\geq \operatorname{dim}M$, due to Schoen and Uhlenbeck [3] (see also Theorem 2.1 in [1]).

**Theorem.** If $f\in W^{1,n}(B^n,S^{n-1})$ and $f|_{\partial B^n}\in C^0$, then $f|_{\partial B^n}:S^{n-1}\to S^{n-1}$ has degree zero.

Here the restriction to the boundary $f|_{\partial B^n}$ is defined as a trace of a $W^{1,n}$ function.

**Proof.**
Let $B^n=B^n(0,1)$ and let $B^n_{1+\delta}=B^n(0,1+\delta)$ for some small $\delta>0$. First of all, we can extend the mapping $f$ to $\tilde{f}\in W^{1,n}(B^n_{1+\delta},S^{n-1})$ if $\delta>0$ is small enough. Indeed, the Sobolev extension operator $E$ is defined through averages, see [2], so extending $f$ to $B^n_{1+\delta}\setminus B^n$ gives a function $Ef\in W^{1,n}(B^n_{1+\delta},\mathbb{R}^n)$ that is continuous in the annulus $B^n_{1+\delta}\setminus B^n$. If $\delta>0$ is small enough,
$|Ef|>1/2$ on $B^n_{1+\delta}\setminus B^n$ (by continuity and the fact that $|f|=1$ on $\partial B^n$) and hence
$\tilde{f}=Ef/|Ef|$ in $B^n_{1+\delta}\setminus B^n$ and
$\tilde{f}=f$ in $B^n$ belongs to $\tilde{f}\in W^{1,n}(B^n_{1+\delta},S^{n-1})$. If we prove that the degree of $\tilde{f}$ on the boundary of $B^n_{1+\delta}$ is zero, then also degree of $f$ on the boundary of $B^n$ is zero (by homotopy invariace of degree and continuity of $\tilde{f}$ in
$B^n_{1+\delta}\setminus B^n$).

The above construction shows that we can assume that $f$ is continuous in a neighborhood of $\partial B^n$ (because $\tilde{f}$ is continuous near the boundary of the ball $B^n_{1+\delta}$ and the argument given below can be applied to $\tilde{f}$ showing that the degree of $\tilde{f}$ is zero on the boundary of the ball $B^n_{1+\delta}$).

The mapping $f$ takes values into $\mathbb{R}^{n}$ since $f:B^n\to S^{n-1}\subset\mathbb{R}^n$. Given $\epsilon>0$ define
$r_{\epsilon,x}=\epsilon(1-|x|)$ and
$$
f_\epsilon(x)=\frac{1}{|B(x,r_{\epsilon,x})|}\int_{B(x,r_{\epsilon,x})} f(y)\, dy.
$$
That is we average $f$ over a ball of radius $\epsilon$ times the distance of $x$ to the boundary of the unit ball $B^n$.
The function $f_\epsilon$ is continuous up to the boundary: as $x$ approaches $\partial B^n$, the radius of the ball over which we average tends to zero and hence $f$ is continuous up to the boundary, because $f$ is continuous in an annulus near the boundary,
$f_\epsilon|_{\partial B^n}=f|_{\partial B^n}$.

According to the Poincare inequality
$$
\left(\frac{1}{|B(x,r_{\epsilon,x})|}\int_{B(x,r_{\epsilon,x})}|f(y)-f_\epsilon(x)|^n\, dy\right)^{1/n}
\leq C\left(\int_{B(x,r_{\epsilon,x})}|\nabla f|^n\right)^{1/n}.
$$
Since
$$
\operatorname{dist}(f_\epsilon(x),S^{n-1})\leq |f(y)-f_\epsilon(x)|
\quad
\text{for all $y$}
$$
we have
$$
\operatorname{dist}(f_\epsilon(x),S^{n-1})\leq
C\left(\int_{B(x,r_{\epsilon,x})}|\nabla f|^n\right)^{1/n}.
$$
The right hand side converges uniformly to $0$ in $x$. That is if $\epsilon$ is small enough, $f_\epsilon(x)\neq 0$ and hence
$$
g(x)=\frac{f_\epsilon(x)}{|f_\epsilon(x)|}
$$
is a continuous map $g:B\to S^{n-1}$,
$g|_{\partial B^n}=f_\epsilon|_{\partial B^n}=f|_{\partial B^n}$. This shows that $\operatorname{deg}(f|_{\partial B^n})=0$.

[1] **P. Hajłasz,**
Sobolev mappings between manifolds and metric spaces. In: *Sobolev spaces in mathematics. I,* 185–222, Int. Math. Ser. (N. Y.), 8, Springer, New York, 2009.

[2] **G. Leoni**, *A first course in Sobolev spaces. Second edition*. Graduate Studies in Mathematics, 181. American Mathematical Society, Providence, RI, 2017.

[3] **R. Schoen, K. Uhlenbeck,**
Boundary regularity and the Dirichlet problem for harmonic maps.
*J. Differential Geom.* 18 (1983), 253–268.