Let $\mathbb{D}^n$ be the closed $n$-dimensional unit ball, and let $f:\mathbb{D}^n \to \mathbb{R}^n$ be smooth.
Suppose that $df$ is invertible outside a set of Hausdorff dimension $\le n-1$, and that $\text{rank}(df) \ge n-1 $ on $\partial \mathbb{D}^n$. 



> 
> **Question:** Do 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 $\text{rank}(df\_n) \ge n-1 $ **everywhere** on the interior $ \text{Int}(\mathbb{D}^n) $? 
> 
> 
> 


**Easier question:**


My intuition is that the set of points where the rank is less than $n-1$ should be very small (generically). Indeed, it is the set where all the $n-1$-minors of $df$ vanish; these are $n^2$ (independent?) equations. Thus, I expect that typically, the Hausdorff dimension of this set would be zero. Can we prove that?


That is, can we find $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 $\dim\_{\mathcal H}(\{ p \, | \, \text{rank}(df\_n)\_p < n-1 \})=0$? 


**Edit 2:**


As commented by Dap, the algebraic set of matrices of rank $\le n-2$ has codimension 4. So, for $n \ge 5$ we shouldn't expect to get dimension $0$ just by generic modifications and dimension arguments. However, we may get dimension $0$ for dimension $n=4$. (Can this be formalized?)



Can we perturb a map $\mathbb{R}^n \to \mathbb{R}^n$ to have high rank?
I believe the answer is positive.


First step: reduce to the case that $\mathrm{rank}(df\_x)\geq n-1$ except on a finite union of submanifolds of dimension at most $n-4.$


*Proof:* For $r=0,\dots,n-2,$ let $M\_r\subset \mathbb R^{n\times n}$ be the set of matrices of rank exactly $r.$ Each of these is a smooth manifold of dimension at most $n^2-4.$ For each such $r,$ consider the map $\phi\_r:\mathrm{int}(\mathbb D^n)\times M\_r\to\mathbb R^{n\times n}$ defined by $\phi\_r(x,M)=M-df\_x.$ A preimage $\phi\_r^{-1}(\{N\})$ consists of pairs $(x,df\_x+N)$ where $x$ is such that $df\_x+N$ has rank $r$ i.e. such that $x\mapsto f(x)+Nx$ has a derivative of rank $r.$
By the preimage theorem, if $N$ is regular for $\phi\_r$ then this preimage is a manifold of codimension at least $4.$ Since this preimage is actually a graph of the smooth function $x\mapsto df\_x+N,$ projecting away the second component doesn't affect the codimension. A similar argument can be applied to the boundary of $\mathbb D^n.$ By Sard's theorem, almost all $N$ are regular values for all these maps. Take a small such $N$ so that $x\mapsto f(x)+Nx$ is approximately $f.$ $\square$


Actually it will be useful to also require $\mathrm{rank}(df\_0)\geq n-1,$ which is easy enough because it holds for almost all $N$ - just pick $N$ outside $(\bigcup\_r M\_r)-df\_0.$


Second step: given $\epsilon>0,$ we can construct a diffeo $\phi$ from $\mathrm{int}(\mathbb D^n)$ to a subset of the points $x$ with $\mathrm{rank}(df\_x)\geq n-1,$ such that $\max\_x|d\phi\_x|= O(1/\epsilon),$ and the set where $\phi(x)\neq x$ has measure $O(\epsilon^3).$ The implicit constants here are allowed to depend on $f.$


*Proof*: Let $E$ denote the exceptional set $\{x\in\mathrm{int}(\mathbb D^n)\mid \mathrm{rank}(df\_x)<n-1\}.$ The idea is to push $E$ away from the origin in a radial direction, out of the disc.


Let $\epsilon>0.$ Define $$R\_0=\min\_{x\in E}|x|.$$ Define $E'$ to be the set of points $v\in S^{n-1}$ such that $\lambda v\in E$ for some $0\leq \lambda < 1$ - the radial projection of $E$ to the boundary of the disc.
I will argue that the $\epsilon$-neighborhood of $E'$ in $S^{n-1}$ (the set of points at distance at most $\epsilon$ from $E'$) has $(n-1)$-dimensional volume at most $O(\epsilon^3).$
 The homeomorphism $\phi:(v,r)\mapsto rv$ from $S^{n-1}\times (R\_0/2,1)$ to $\{x\in D^n\mid |x|\in(R\_0/2,1)\}$ is a diffeo. So the preimage of the the at-most-$(n-4)$-dimensional manifold $E$ still has *Minkowski* dimension $n-4.$
It can therefore be covered by a set of $N(\epsilon)$ balls $B((v\_i,r\_i),\epsilon)$ such that $N(\epsilon) \epsilon^{n-4}=O(1).$ The projected balls $B(v\_i,\epsilon)\subset S^{n-1}$ cover $E'$ and still satisfy $N(\epsilon) \epsilon^{n-4}=O(1).$ This means the $(n-1)$-dimensional volume is at most $O(1)N(\epsilon) \epsilon^{n-1}=O(\epsilon^3).$
Doubling the radii gives a set $\bigcup\_i B(v\_i,2\epsilon)$ still of $(n-1)$-dimensional volume $O(\epsilon^3),$ and containing the $\epsilon$-neighborhood of $E'.$


We will need a function $h:S^{n-1}\to[R\_0/4,2]$ such that:


1. $h$ is smooth
2. $h\leq R\_0/2$ on $E'$
3. $h\geq 1$ except on the $\epsilon$-neighborhood of $E'$
4. $h$ has Lipschitz constant $O(1/\epsilon)$


To construct such a function, first define $g(v)=R\_0/4$ for $v\in E',$ and $g(v)=2$ for $v$ not in the $\epsilon$-neighborhood of $E'.$
Note that $g$ has Lipschitz constant at most $2/\epsilon.$
By the [Kirszbraun theorem](https://en.wikipedia.org/wiki/Kirszbraun_theorem), $g$ extends to a function $S^{n-1}\to [R\_0/4,2]$ with the same Lipschitz constant.


However $g$ may not be smooth. To deal with this, we can think of $S^{n-1}$ as the symmetric space $SO(n)/SO(n-1),$ so $g$ is a function on $SO(n)$ invariant under the right action of $SO(n-1)$ (specifically, $SO(n-1)$ is the stabilizer of $(1,0,0,\dots,0),$ and a rotation $\rho\in SO(n)$ corresponds to the point $\rho\cdot (1,0,0,\dots,0)\in S^{n-1}$). Convolve by left multiplication by a smooth mollifier $SO(n)\to\mathbb R$ supported on a small ball around the identity. The resulting function is still invariant under the right $SO(n-1)$ action, so corresponds to a function $h:S^{n-1}\to [R\_0/4,2].$ This function $h$ will be smooth (basically by the implicit function theorem). It is a convex combination of rotated versions of $g,$ where each rotation moves points by no more than $R\_0\epsilon/8$ say. This ensures conditions (2.) and (3.), and also (4.) because the set of functions with Lipschitz constant $\leq 2/\epsilon$ is convex.


Let $\psi:\mathbb R\to\mathbb R$ be a smooth function with $\psi(x)=x$ for $x\leq 0,$ and $\psi(x)<R\_0/2$ and $0<\psi'(x)\leq 1$ everywhere.
Define $\phi:\mathrm{int}(\mathbb D^n)\to \mathrm{int}(\mathbb D^n)$ by $\phi(0)=0$ and $$\phi(rv)=(\psi(r-h(v))+h(v))v$$ for unit vectors $v$ and real $0<r<1.$
Then $\phi(rv)=rv$ if $r\leq h(v),$ in particular for $r\leq R\_0/4$ or $h(v)\geq 1.$
So $\phi(x)=x$ in a neighborhood of zero, which ensures $\phi$ is smooth at zero. And $\phi(rv)=rv$ for all $0<r<1$ and $v\not\in E'$; since $E'$ has $(n-1)$-dimensional measure $O(\epsilon^3),$ the set of $x$ of the form $rv$ with $v\not\in E'$ has $n$-dimensional measure $O(\epsilon^3).$ (The probability that a uniformly chosen $x\in D^n$ satisfies $x/|x|\in E'$ is the same as the probability that a uniformly chosen $v\in S^{n-1}$ lies in $E'.$)


The Lipschitz constant of $\phi$ can be bounded by bounding the derivatives of $\phi$ along a path through $(r,v)$ with $r>R\_0/4$ and $|\dot r|,|\dot v|\leq 1.$
Writing $h=h(v)$ and $\psi=\psi(r-h),$ the chain rule gives $|\dot h|=O(1/\epsilon)$ and hence $|\dot\psi|=O(1/\epsilon).$
So $$\frac{d}{dt} \phi(rv) = (\dot\psi+\dot h)v + (\psi+h)\dot v = O(1/\epsilon)$$
which means $\max\_x|d\phi\_x|=O(1/\epsilon).$ $\square$


The integral of $|d(f\circ \phi)-df|^2$ is at most the maximum value of the integrand, $O(1/\epsilon^2),$ multiplied by the volume of the set where the integrand can be non-zero, $O(\epsilon^3),$ giving $O(\epsilon)$ overall. The integral of $|(f\circ \phi)-f|^2$ is even better: $O(\epsilon^3).$ So $\|f-f\circ \phi\|^2\_{W^{1,2}}=O(\epsilon).$ And the rank of $f\circ \phi$ will be $\geq n-1$ everywhere.


