I have been having issues getting the variational form of the following differential equation.

$$ \frac{d^2u}{dx^2} - u = -1 $$

I looked to multiply by $u$ and integrate over the length for the variational form (as for weak form, except where the variation $w$ isn't arbitrary). However, the correct solution is:

$$\int \frac{1}{2} \left( \frac{d^2u}{dx^2}+u^2 \right) -u dx $$

I can't seem to find how to get to this solution. Any advice would be appreciated.

  • 1
    $\begingroup$ Multiply bei $u'$ and integrate. $\endgroup$
    – user99432
    Commented Apr 7, 2022 at 13:43

1 Answer 1


Let $\varphi \in C_c^{\infty}(\Omega)$. Multiplying the equation by $\varphi\frac{d}{dx}u$ and integrating over space gives $$\int\frac{d^2}{dx^2}u \frac{d}{dx}u\varphi-u\frac{d}{dx}u\varphi = - \frac{d}{dx}u\varphi.$$ Note that $\frac{d^2}{dx^2}u\frac{d}{dx}u=\frac{1}{2}\frac{d}{dx}\left(\frac{d}{dx}u\right)^2$ and $u\frac{d}{dx}u=\frac{1}{2}\frac{d}{dx}u^2$. By integrating by parts it follows $$\int-\frac{1}{2}\frac{d}{dx}u \frac{d}{dx}\varphi-\frac{1}{2}u^2\frac{d}{dx}\varphi dx=\int u \frac{d}{dx} \varphi dx.$$ Hence $$\int\frac{d}{dx}\varphi\left(\frac{1}{2}\frac{d}{dx}u+\frac{1}{2}u^2+u\right)dx=0$$ for any $\varphi \in C_c^{\infty}(\Omega)$ and hence this is the variational form. Note that I just did formal computations, but everything can be rigorous by using the fundamental lemma of calculus of variations.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .