Existence of minimal solution in $C^1((a,b))\cap C^2((a,b))$ Let $f:(0,\pi)\times \mathbb{R}\rightarrow \mathbb{R}$ be a function in $C^1$ such that
$$f(x,u(x))\geq h(x),\quad\text{for a certain}\quad h\in L^1((0,\pi)).\quad (1)$$
I want to show that
$$J(u):=\int_0^\pi \frac{u'^2(x)}{2}+c\frac{u^2(x)}{2}+f(x,u(x))\ dx$$
has a minimiser in $H=\{u\in C^1((a,b))\cap C^2((a,b)):\quad u(0)=u(\pi)=0\}$, for every $c>-1$.
What I've done so far: Let
$$F(x,u(x))=c\frac{u^2(x)}{2}+f(x,u(x)).$$
By $(1)$, we can say that $F$ is lower bounded and therefore $F(x,u(x))\geq m$, for some $m\in\mathbb{R}$. Let $(u_n)$ be a minimising sequence of $J$, then, for some $L\in\mathbb{R}$, $J(u_n)\leq L$. Hence
$$\frac{1}{2}\int_0^\pi u'^2_n(x)dx \leq L-\int_0^\pi F(x, u_n(x))\leq L-m|\pi-0|=L-m\pi.$$
We know that $\lVert u\rVert_{L^2}:=\int_Iu'^2(x)\ dx$ is a norm, therefore $(u_n)$ is bounded and, as we are working on a Hilbert space, it has a weakly convergent subsequence. Let that limit be $u_0$ (on the weak topology). By a Lemma, we have
$$J(u_0)\leq \lim\inf J(u_n).$$ Hence $u_0$ is a minimiser of $J$. For every $\phi\in C_c^\infty((0,\pi))$ we have, by an argument of classic methods on calculus of variations, that
$$\frac{d}{dt}(J(u_0+t\phi))_{t=0}=0.$$ I simplified this and got
$$\int_0^\pi u'_0\phi'\ dx=-\int_0^\pi (cu_0+f_{u_0}(x,u_0))\phi\ dx,$$
which means $u'_0$ has a weak derivative $u''_0=cu_0+f_{u_0}(x,u_0)$. By the Fundamental Theorem of Calculus for the weak derivative, we can write
$$u'_0(x)=u'_0(y)+\int_x^ycu_0+f_{u_0}(t,u_0)\ dt,$$
and this assures $u_0\in C^1((a,b))\cap C^2((a,b))$. My questions are: why does $c$ has to be greater than $-1$?; is this reasoning correct? There is a hint for this problem:
$$\int_0^\pi u'^2(x)\ dx \geq \int_0^\pi u^2(x)\ dx,$$ but I don't know where to use it. Any help on this? Thanks in advance.
 A: The general approach is mostly correct, but your proof of coercivity is not. In particular the following assertion is incorrect:

By $(1)$, we can say that $F$ is lower bounded and therefore $F(x,u(x))\geq m$, for some $m\in\mathbb{R}$.

This is only true if $c \geq 0,$ but the question specifies that $c$ may be negative. Instead if you use the given hint you can show that for $u \in H,$
$$ J(u) \geq \frac{(1+c)}2\int_0^{\pi} u(x)^2 \,\mathrm{d}x + \int_0^{\pi} h(x) \,\mathrm{d}x. $$
Now crucially if $c > -1,$ we have $1+c > 0.$ Therefore if $(u_n) \subset H$ is a minimising sequence for $J(\cdot),$ we have $J(u_n) \leq L$ for all $n$ and hence we can bound
$$ \int_0^{\pi} u_n(x)^2 \,\mathrm{d}x \leq \frac{2L}{1+c} J(u_n) + 2\int_0^{\pi} |h(x)| \,\mathrm{d}x := 2M < \infty. $$
Therefore $(u_n)$ is uniformly bounded in $L^2.$ Now you can argue similarly as you did to show that
$$ \frac12\int_0^{\pi} u'(x)^2 \,\mathrm{d}x \leq L + |c|M + \int_0^{\pi} |h(x)| \,\mathrm{d}x, $$
and proceed the same way.

To see why some condition on $c$ is necessary, consider the case then $c < -1$ and $f = 0.$ Then if we take $u_k(x) = k\sin(x)$ for $k$ an integer we have
$$ J(u_k) = \frac{k}2 \int_0^{\pi} \cos^2(x) + c\sin^2(x) \,\mathrm{d}x = k \pi (1+c) < 0. $$
Now as $k \to \infty$ we have $J(u_k) \to -\infty,$ so the functional is not bounded from below.
Added later: For the critical case $c=-1,$ existence can fail for certain $f.$ For instance consider
$$ f(x,z) = f(z) = \frac{1}{1+z^2}. $$
Then $f(z) >0$ everywhere, and $f(z) \to 0$ as $u \to \pm\infty.$ Hence using the given inequality and since $c=-1$ we have
$$ J(u) > 0 $$
for all $u \in H.$ To see this is strict, observe that the equality case of Wirtinger's inequality asserts that if $u \in H$ and
$$  \int_0^{\pi} u'(x)^2 \,\mathrm{d}x = \int_0^{\pi} u(x)^2 \,\mathrm{d}x,$$
then $u(x) = a \sin(x + b)$ for constants $a,b.$ However in this case we have
$$ J(u) = \int_0^{\pi} f\left( a \sin x \right) \,\mathrm{d}x = \int_0^{\pi} \frac1{1+a^2 \sin(x)^2} \,\mathrm{d}x > 0. $$
Now if we take $u_k(x) = k \sin(x),$ then $u_k \in H$ and we have $f(u_k) \to 0$ pointwise on $(0,\pi)$ and $|f(u_k)| \leq 1$ on $[0,\pi].$ Hence by the dominated convergence theorem we have
$$ J(u_k) = \int_0^{\pi} \frac1{1+k^2\sin(x)^2} \,\mathrm{d}x \to 0 $$
as $k \to \infty.$ Hence $J(\cdot)$ does not admit a minimum.
