$\newcommand{\SO}[1]{\text{SO}(#1)}$
$\newcommand{\dist}{\operatorname{dist}}$

>Let $\mathbb{D}^n$ be the closed $n$-dimensional unit ball, and let $f:\mathbb{D}^n \to \mathbb{R}^n$ be smooth, with $\text{rank}(df) \ge n-1$ everywhere.

Set $X=\text{GL}^+_n \cup \{ A \in M_n \, | \,\,\sigma_1(A) < \sigma_2(A)\},$ where $M_n$ is the space of real $n \times n$ matrices, and $\sigma_1(A) \le \sigma_2(A) \le \dots \sigma_n(A)$ are the singular values of $A$.

Note that $X \subseteq \{ A \in M_n \, | \, \text{rank}(A) \ge n-1 \}$, since if $\sigma_1=0$ we must have $\sigma_2>0$. Writing $X$ as a disjoint union, $$X=\text{GL}^+_n \cup (\text{rank}=n-1)  \cup (\text{GL}^-_n \cap \{\sigma_1 < \sigma_2\}).$$

>**Question:** Do there there exist $f_n \in C^{\infty}(\mathbb{D}^n, \mathbb{R}^n)$ such that $f_n \to f$ in $W^{1,2}(\mathbb{D}^n, \mathbb{R}^n)$ and $df_n \in X$ **everywhere** on $ \text{int}(\mathbb{D}^n) $? 

_____

*A few words on my motivation:*

I am studying the functional $E:C^{\infty}(\mathbb{D}^n,\mathbb{R}^n) \to \mathbb{R}$, given by
$$ E(f)= \int_{\mathbb{D}^n} \dist^2 (df,\SO{n})=\int_{\mathbb{D}^n} |df-Q(df)|^2, $$ 
where $Q(df)$ is a closest matrix to $df$ in $\SO{n}$.

>It turns out that for a matrix $A \in M_n$, there exist a *unique* matrix $Q(A) \in \text{SO}_n$ which is closest to $A$ (w.r.t the Frobenius norm) **if and only if $A \in X$**. Furthermore, the map $A \to Q(A)$ is smooth as a map $X \to \SO{n}$.

Thus, if $df \in X$ everywhere, than $Q(df)$ is smooth. This makes differential analysis of $Q(df)$ possible, which is useful in the context of the variational problem I am facing.