# Can we approximate elements in $L^2$ via smooth maps while preserving a pointwise constraint on the derivatives?

Let $$\mathbb{D}^n \subseteq \mathbb{R}^n$$ be the closed $$n$$-dimensional unit ball. Suppose we are given an open connected* subset $$U \subseteq \mathbb{D}^n$$ of full measure in $$\mathbb{D}^n$$, and a smooth bounded map $$f:U \to \mathbb{R}^{k}$$, where $$k>1$$. Note that $$f \in L^2(\mathbb{D}^n, \mathbb{R}^{k})$$.

Now, let $$h:\mathbb{D}^n \to \mathbb{R}^{k}$$ be a smooth map satisfying $$h(x) \neq 0$$ for every $$x \in U$$ (in particular $$h(x) \neq 0$$ a.e.).

Assume that $$(df_x)^T\big(h(x)\big)=0$$ for every $$x \in U$$.

Do there exist smooth maps $$f_k:\mathbb{D}^n \to \mathbb{R}^{k}$$ which converge to $$f$$ in $$L^2$$ and satisfy $$((df_k)_x)^T\big(h(x)\big)=0$$?

Note that the derivatives of the original $$f$$ may explode when we approach $$\partial U=\mathbb{D}^n \setminus U$$. I also don't assume that $$f$$ can be continuously extended to all of $$\mathbb{D}^n$$ or that it is a Sobolev map.

Edit: Why $$U$$ must be connected in general:

Take $$h(x)=(1,0,...,0)$$ to be constant. The condition $$(df_x)^T\big(h(x)\big)=0$$ is equivalent to $$\langle\partial_j f(x),h(x)\rangle=\partial_jf^1(x)=0 \,\,\quad \forall j=1,...,n\quad\forall x \in U,$$

i.e. $$\nabla f^1=0$$ on $$U$$. If $$U$$ is not connected, we can make $$f^1$$ to obtain two different constant values on different connected components of $$U$$. Now, any smooth map $$g:\mathbb{D}^n \to \mathbb{R}^{k}$$ that satisfies $$(dg_x)^T\big(h(x)\big)=0$$ on $$\mathbb{D}^n$$ must have constant first component, hence cannot approximate well our map $$f$$.

I guess a reasonable start would be to start with $$h$$ being constant:

Suppose that $$h(x)=(h^1,h^2,...,h^k)$$. Then our condition becomes $$\langle\partial_j f(x),h(x)\rangle=\partial_j(\sum_{i=1}^k h^if^i)=0 \,\,\quad \forall j=1,...,n\quad\forall x \in U,$$

i.e. $$\nabla (\sum_{i=1}^k h^if^i)=0$$ on $$U$$. Since $$U$$ is connected, this implies that $$\sum_{i=1}^k h^if^i$$ is constant.

Now, the question is whether or not $$f$$ can be approximated by smooth maps $$f_k$$ with constant $$\sum_{i=1}^k h^if_k^i$$.

Not in general. As shown in the answer to this question, for specific $$h$$ it is possible that there are no non-constant smooth maps $$f \colon \mathbb{D}^n \rightarrow \mathbb{R}^k$$ which satisfy $$(df|_{x})^T h(x) = 0$$ for all $$x \in \mathbb{D}^n$$. This is the case for example if $$n = 2$$ and $$h(x,y) = (x,y)^T$$. The set $$U = \mathbb{D}^2 \setminus \{ (0,0) \}$$ is open, connected subset of full measure and $$h(p) \neq 0$$ for all $$p \in U$$. If we take
$$f(x,y) = \left( \frac{x}{\sqrt{x^2+y^2}}, \frac{y}{\sqrt{x^2+y^2}} \right)^T$$
then $$f$$ is defined on $$U$$, smooth and bounded (of norm one) and satisfies $$(df|_{x})^T h(x) = 0$$ for all $$x \in U$$. However, the only smooth maps which satisfy the equality on the whole of $$\mathbb{D}^2$$ are the constant maps and they definitely can't be used to approximate $$f$$ in $$L^2$$.