Consider two smooth functions $f,g\in C^\infty(\Omega)$ with $\partial \Omega$ smooth and $\Omega\subset \mathbb{R}^3$. Assume that $f=g$ on $\partial \Omega$. 
For any given $\varepsilon>0$, how to perturb $f$ to another smooth function $\tilde{f}$ such that $\|f-\tilde{f}\|\_{L^2}<\varepsilon$ and, if $g(x)\neq g(y)$, then $\tilde{f}(x) \neq \tilde{f}(y)$ for any $x,y\in(\Omega)$? Or a counter example?



How to perturb a function to separate points
Okay, here's a counterexample. Let $\Omega \subset {\bf R}^3$ be the ball of radius 2 about the origin and observe that $\Omega$ contains the unit cube $[0,1]^3$. Define $f(x,y,z) = x$ and $g(x,y,z) = y$ on the unit cube and extend them to smooth functions on $\Omega$ which agree on $\partial \Omega$.


Now let $\tilde{f}$ be any smooth function on $\Omega$ which satisfies $g(x,y,z) \neq g(x',y',z') \Rightarrow \tilde{f}(x,y,z) \neq \tilde{f}(x',y',z')$. Then on the unit cube we have $y \neq y' \Rightarrow \tilde{f}(x,y,z) \neq \tilde{f}(x',y',z')$. This implies that $\tilde{f}$ must be constant, within the unit cube, on every plane of the form $y = c$. If $\tilde{f}$ were not constant on any such plane then for every $c'$ sufficiently close to $c$ there would be points on the $y = c$ and $y = c'$ planes at which $\tilde{f}$ took the same value, contradicting the condition given above.


We can put a lower bound on $\|f - \tilde{f}\|\_2$ by integrating over the unit cube and recalling that on each constant $y$ plane we have $\tilde{f}(x,c,z)$ constant and $f(x,c,z) = x$. An easy calculation shows that the smallest possible value of $\int\_{[0,1]^3} |\tilde{f}(x,y,z) - f(x,y,z)|^2$ is $\frac{1}{12}$. So $\|\tilde{f} - f\|\_2 \geq \frac{1}{2\sqrt{3}}$.


