# Constructing a function!

1. Mar 13, 2006

### Hurkyl

Staff Emeritus
Today, I had the desire to construct a $C^{\infty}$ approximation to a tent function. Specifically, for any positive real number e I want a $C^{\infty}$ function f such that:

f(x) = 0 if |x| > 1 + e
|f(x) - g(x)| < e for all x

where g(x) is the tent function given by:

$$g(x) = \begin{cases} 0 & |x| \geq 1 \\ 1 - |x| & |x| \leq 1 \end{cases}$$

I'm willing to accept on faith that such things exist, but it struck me today that I don't know how to go about constructing such a thing, or at least proving its existence.

Given time I could probably figure it out, but I'm interested in a different problem (for which I want to use this), and I imagine this is a well-known thing.

So I guess what I'm looking for is at least a "yes" or "no" answer to the existence of such a function, but a hint as to the proof would be nice too.

2. Mar 13, 2006

### AKG

I have a theorem which states:

Let $g\,:\,\mathbb{R}^m\to\mathbb{R}$ be a bounded, uniformly continuous function. Then

$$(\forall\epsilon > 0)(\exists f\in C^{\infty}(\mathbb{R}^m,\,\mathbb{R}))(\forall x \in \mathbb{R}^m)(|g(x) - f(x)| < \epsilon)$$

Define a function $\sigma _0\,:\,x\mapsto\exp\left(\frac{-1}{x+1}\right)$ for x > -1 and $x\mapsto 0$ otherwise. Define a function $\sigma\,:\,x\mapsto\sigma_0(x)\sigma_0(-x)$. Finally, define $\beta\,:\,\mathbb{R}^m\to\mathbb{R}$ by:

$$\beta (x) = \frac{\sigma (|x|)}{\int _{|y|<1}\sigma (|y|)dy}$$

By uniform continuity of g, given $\epsilon > 0$, you can pick $\delta > 0$ such that:

$$(\forall x,z \in \mathbb{R}^m)(|x-z|<\delta \Rightarrow |g(x)-g(z)|<\epsilon)$$

The function f that you want is:

$$f(x) = \int _{\mathbb{R}^m}g(x+\delta y)\beta (y)dy$$

Last edited: Mar 13, 2006
3. Mar 13, 2006

### Hurkyl

Staff Emeritus
I'm not sure if that's good enough for the problem of interest. And there has to be a typo in that, because g is essentially never used! (was it supposed to be in the final integral?)

The problem I want to solve (which I'm also sure is well-known by those who know it well -- but I actually want to enjoy this one!) is the following:

Suppose I have a "nice" space of functions R²->R, with some topology. I want to prove that the subspace spanned by the functions of the form f(x)g(y) for "nice" f and g is dense in the original space.

So, I take a "nice" function on two variables, and I want to find a sequence of functions in that subspace that converge to it.

My plan of attack was to form a polyhedral approximation to the function, where each polyhedron is the product of two line segments. I can then decompose the polyhedra into (a product of) tent functions.

Or, equivalently, I pick a (sufficiently fine) lattice of points in R², and use (sums of) (products of) tent functions to interpolate between points.

I then want to smooth my tent functions into "nice" functions, so that I get actual elements of the subspace of interest, and then try to produce a sequence that converges to the target function in the "nice" way specified by the topology.

One example of the class of "nice" functions of interest are C-infinity functions with compact support. Another would be the "rapidly decreasing" functions: if you take any derivative of your function, and multiply by any polynomial, the result is bounded.

4. Mar 13, 2006

### AKG

Yes, there was a typo; I've fixed it. The reason was that my theorem had f given, and g was the desired function, so in rewriting it to match your notation I missed a g.

Anyways, would using a Taylor approximation help with your problem?

5. Mar 13, 2006

### Hurkyl

Staff Emeritus
I had thought about it, but had initially dismissed it because C-infinity functions are generally not equal to their Taylor series. The partial series are polynomials, which are distinctly not nice, due to their behavior "at infinity". I think, maybe, they'd be useful if I was only working over a subset of R².

Hrm, that does give me an idea. (Yes, the chain of reasoning did start with Taylor series. :tongue:)

Maybe I can construct a sequence of "nice" functions that approximate a delta function. I could make a slight variation to everyone's favorite non-analytic smooth function, to produce:

$$f(x) := \begin{cases} 0 & x \leq 0 \\ e^{-1/x^2} e^{-1 / (x - 1)^2} & 0 \leq x \leq 1 \\ 0 & 1 \leq x \end{cases}$$

this would give me a C-infinity function that is zero outside of (0, 1). By playing with constants, I ought to be able to produce a sequence that would approximate a delta function, and if I convolve one with a tent function, maybe I'll get what I seek?

6. Mar 13, 2006

### Hurkyl

Staff Emeritus
Never start an analysis problem after bedtime.

Yes, this idea works. If I define:

$$h_d(x) := \begin{cases} K_d e^{-1/(x-d)^2} e^{-1/(x+d)^2} & |x| < d \\ 0 & |x| \geq d \end{cases}$$

then I have a C-infinity function that is nonzero outside the compact interval [-d, d]. Furthermore, it is strictly positive in (-d, d), and the constant $K_d$ is chosen so that the integral over [-d, d] is equal to 1.

So as d goes to zero, this approaches a delta function, so I think it can be used for smoothing. (And yes, I think this is a similar idea to what you posted)

If I want to smooth the uniformly continuous function f(x), I can define:

$$g_d(x) := \int_{-d}^{d} f(x - y) h_d(y) \, dy$$

Then, if I pick $\delta$ such that $|x - y| < \delta \Rightarrow |f(x) - f(y)| < \epsilon$, we can upper and lower bound f(x - y), giving:

$$f(x) - \epsilon < g_{\delta}(x) < f(x) + \epsilon$$

So is this C-infinity? Well, we can apply a change of variable:

$$g_d(x) = \int_{x-d}^{x+d} f(z) h_d(x - z) \, dz$$

Bleh, it's been a while... oh bleh, I had the derivative slightly wrong. (But I was just missing multipliers of "1") Found it at Wikipedia

$$g_d'(x) = f(x+d) h_d(-d) - f(x-d) h_d(d) + \int_{x-d}^{x+d} f(z) \frac{\partial}{\partial x}h_d(x - z) \, dz = \int_{x-d}^{x+d} f(z) \frac{\partial}{\partial x}h_d(x - z) \, dz$$

and repeating,

$$\left( \frac{d}{dx} \right)^n g_d(x) = \int_{x-d}^{x+d} f(z) \left( \frac{\partial}{\partial x} \right)^n h_d(x - z) \, dz$$

and therefore, I can produce a smooth approximation of a tent function!

That was actually more fun than I thought it would be!