I have a domain $[0,1]\times [0,1]$.
I want an explicit expression for a smooth function $\varphi$ on this domain that is zero on the boundary and $1$ in most of the interior, like a mollifier or bump function (see https://en.wikipedia.org/wiki/Mollifier) .
I thought about something like $\varphi(x,y) = \exp(-1/(1-x^2-y^2))$ but it doesn't work... any help is appreciated
The idea is to first look at the 1-dimensional case, indeed if we have $f(x)=1$ on "most of" $[0,1]$ and vanishing at $0$ and $1$, then we can take $g(x,y)=f(x)f(y)$, which will be $1$ in "most of" $[0,1]$. Consider now the following function $$f:[0,1]\to \mathbb{R}, x\mapsto e^{\frac{-1}{1-x^2}+1}. $$ This function is 1 at 0 and it is 0 at 1, moreover, if extended to be 0 outside its domain, it turns out to be $C^\infty$. We want to take the image of $[0,1]$ and shrink it to fit into the small box $[1-\delta,1]$. Therefore we look a diffeomorphism between these two sets. Any would do the job, but we choose linear for simplicity: $$ R:[1-\delta,1]\to [0,1], x\mapsto \frac{x}{\delta}+\frac{\delta-1}{\delta}. $$ The composition will take care of the right behavior of the sought function $$ f\circ R = e^{\frac{-1}{1-\left( \frac{x}{\delta}+\frac{\delta-1}{\delta} \right)^2}+1} = e^{\frac{-\delta^2}{\delta^2-\left( x+\delta-1 \right)^2}+1}. $$ In a similar way, for the left side we want to map $[0,\delta]$ into $[1,0]$, where from $[1,0]$ I mean that the diffeomorphism must change the orientation. Again, we look for a linear form $$ L:[0,\delta]\to [0,1],x\mapsto 1-\frac{x}{\delta}. $$ The left component for $f$ will be $$ f\circ L = e^{\frac{-1}{1-\left( 1-\frac{x}{\delta} \right)^2}+1} = e^{\frac{-\delta^2}{\delta^2-\left( \delta-x \right)^2}+1}. $$ We can finally write $$ f_\delta(x) = \begin{cases} 0 & x\leq 0 \\ e^{\frac{-\delta^2}{\delta^2-\left( \delta-x \right)^2}+1} & x\in (0,\delta) \\ 1 & x\in [\delta,1-\delta] \\ e^{\frac{-\delta^2}{\delta^2-\left( x+\delta-1 \right)^2}+1} & x\in (1-\delta,1) \\ 0 & x\geq 1 \end{cases} $$ I created the following script using Geogebra, check it out.