# Sequence of compactly supported functions approximating $x^2$

I encountered this question as part of a proof I am working on and was wondering whether anybody has an explicit way to construct these sequences:

1.) Is there a sequence of positive compactly supported functions $f_n \in C_c^2(\mathbb{R_{\ge 0}})$ with $||f_n''|| \le 2$ such that $f_n(x) \rightarrow x^2$ for every $x \in \mathbb{R}.$

2.) Is there a sequence of positive compactly supported functions $f_n \in C_c^2(\mathbb{R_{\ge 0}})$ with $|f_n''(x)| \le x^2$ and $f_n(x) \rightarrow \frac{x^4}{12}$?

I mean figuratively, you need to construct functions that approximate the respective function on some interval $[-n,n]$ quite well and decay to $0$ on $[-m-n,-n] \cup [n,n+m]$ in a way that is not too fast. But how one could do this explicitly is really the big issue here.

• Yes, there is. Approximate $x^2$ by defining a function which is equal to $x^2$ on $[-100, 100]$, then draw line segments connecting the endpoints of the above graph to $(\pm 10000000000, 0)$. Smooth out the corners in such a way that the second derivative doesn't ever exceed $2$. Now replace $100$ by $n$. – user296602 Jan 8 '16 at 23:10
• clearly the smoothing out part is the crucial thing here, could you explain how to do this? – user296837 Jan 8 '16 at 23:13
• On $-100\le x\le100$ you have $f''=2$. For $x>100$ have $f''$ decrease continuously to $-2$ and then stay there. Your function will eventually start decreasing towards $0$. At some larger $x$ you will have to switch gears again to make it meet the $x$-axis smoothly. – user856 Jan 9 '16 at 20:30
• @Rahul although I appreciate your answer. Figurative descriptions like "switch gears" do not really help me, sorry. – user296837 Jan 9 '16 at 20:34
• By switch gears I mean make $f''=2$ again so that when $f=0$ you also satisfy $f'=0$. – user856 Jan 9 '16 at 22:12

Consider $$f(x) = x^2 -3x^3+3x^4-x^5$$ for $0\le x<1$ and $0$ for $x\ge 1$. Note that $f$ is chosen such that (i) $f(x)=x^2 + O(x)^3$, (ii) $f(x) = O(x-1)^3$, and (iii) $|f''(x)|\le 2$. Set $f(-x)=f(x)$. Then $$f_n(x) = n^2 f(x/n)$$ is the function you are looking for.