In what function space, does the calculus of variations hold? I only know that the calculus of variations holds for continuous function spaces. But does it work for non-smooth functions, like the functions with jumps or with some points having the property similar to the Dirac-delta function? Thanks a lot!
 A: Something works everywhere. Not everything works everywhere. 
The basic idea of comparing the functional values $F(u)$ and $F(u+\varphi)$, where $\varphi $ is a smooth compactly supported functions, makes sense whenever $u+\varphi$ makes sense. That is, in any linear space of functions that contains $C_c^\infty$. Those can be spaces of rough functions, like $L^p$, or even spaces of distributions. 
However, the larger the space becomes, the smaller is the supply of functionals $F$ that can be defined on that space. Usually one has a particular functional $F$ in mind, and looks for a reasonably nice space on which $F$ can be naturally defined. Having the largest possible set of functions is not the goal here. 
Interesting functionals tend to involve derivatives of $u$, so the convenient function spaces to use are those where we have a notion of derivative that can be integrated, Sobolev spaces. 
If we don't have derivatives, a larger space such as a Lebesgue spaces can work. A random example: maximize 
$$
F(u)=\int_{-1}^1 \operatorname{sign}(x) u(x) - \int _{-1}^1 u(x)^2\,dx
$$
where $u\in L^2([-1,1])$.  Assuming $u$ is extremal, consider 
$$
F(u+t\varphi) - F(u) = t\int_{-1}^1 (\operatorname{sign}(x) -2u(x))\varphi(x)  - t^2\int_{-1}^1 \varphi(x)^2\,dx
$$
(Here any $\varphi\in L^2([-1,1])$ will do.) Since this quadratic polynomial is maximized at $t=0$, the coefficient of $t$ must be zero. And since 
$$\int_0^1 (\operatorname{sign}(x) -2u(x))\varphi(x)=0$$
for every $\varphi\in L^2$, it follows that $u(x) = \frac12 \operatorname{sign}(x)$ almost everywhere.  
In the above example, variation is used in a space with a lot of discontinuous functions, and even the extremal function itself is discontinuous.
