density in $L^p$

If $f(x_1,x_2)$ is in $L^p(\mathbb{R}^2)$, $p>1$, then can we find two $C_0^{\infty}$ functions $g(x_1)$ and $h(x_2)$ which defined in the real line that approximate $f$? If it is true, can we change the $L^p$ to the Sobolev space $W^{m,p}$ and still have this approximation?

-
I guess you already know the result of density for $\Bbb R$. In this case, for $p<\infty$, we can assume $f\geq 0$ and simple. Then $f=\sum_{j=1}^Na_j\chi_{B_j}$. Approximate each $B_j$ by a finite sum of product of Borel sets, then the characteristic function of each member of the product, to get that $f$ can be approached by a finite sum of functions of the form $F(x,y)=f(x)g(y)$ with $f,g\in C_0^{\infty}$. –  Davide Giraudo Oct 1 '12 at 19:55
I don't understand the question. Surely, you cannot expect to approximate a function of two variables by a function of one variable? And what is the meaning of “definited”? –  Harald Hanche-Olsen Oct 1 '12 at 20:11
sorry, it should be "defined" –  Alron Oct 3 '12 at 15:01
Could you explicitely write down the functions you want they approximate $f$? –  Davide Giraudo Oct 3 '12 at 15:11
I do not know what explicitly $f$, $g$ and $h$ are. But I get your idea. I think it works, and the answer is positive. Thank you. –  Alron Oct 4 '12 at 18:58
show 1 more comment

We consider $1\leq p<\infty$. We can assume that $f\geq 0$ and $f$ is simple. We approximate the indicator function of a Borel subset $B$ of $\Bbb R^2$ by a finite union of product $\prod_{j=1}^NA_j\times B_j$ to get that $f$ and we approached in $L^p$ by functions of the form $\sum_{j=1}^Na_j\chi_{A_j\times B_j}$, where $a_j$ are real numbers and $A_j,B_j$, Borel sets of finite measure. The indicator of $A_j$ can be approched in $L^p$ by a test function $\phi_j(x)$, and the same for $B_j$.
So the set of functions of the form $\sum_{j=1}^Nf_j(x)g_j(y)$, where $f_j,g_j\in C_0^{\infty}(\Bbb R)$, $N\in\Bbb N$, is dense in $L^p(\Bbb R^2)$, with $1\leq p<\infty$.