# Assuming decay to zero in definite Integral

I'm trying to use Mathematica to evaluate Integrals like:

$$\int_{\mathbb{R}} 2u(x)u^\prime(x) \mathrm{d}x = \left.u(x)^2\right|_{-\infty}^\infty = 0$$

Now the last step ist justified because $u$ decays to zero when approaching infinity (even $u \in \mathcal{S}(\mathbb{R})$). Now I'd like to know how to tell Mathematica about this property of $u$. So far I've tried

Integrate[u[x]*D[u[x], x], {x, -Infinity, Infinity}, Assumptions -> u[Infinity] == 0 && u[-Infinity] == 0]


or also with some finite interval:

Integrate[u[x]*D[u[x],x], {x, -a, a}, Assumptions -> u[a] == 0 && u[-a] == 0]


But none of those two gave me zero as an answer...

• To my knowledge Integrate only gives integrals of specific functions. In your (general symbolic function) case i think it might work to write a replacement rule that performs symbolic integration by parts to solve your problem. – Thies Heidecke Nov 26 '17 at 13:29

## 2 Answers

So we start by writing the solution of the integral as an equation (we'll see why later)

eq = integral == Integrate[2*u[x]*D[u[x], x], {x, -a, a}]


Now we formulate integration by parts as a replacement rule

byparts = Integrate[u_[x_] v_'[x_], {x_, a_, b_}] :>
(u[b] v[b] - u[a] v[a]) - Integrate[u'[x] v[x], {x, a, b}]


For this to work we also define another rule to pull any numeric constants out of the integral (we could do all in one replacement rule, but in this way i think it's clearer what happens and it's more modular).

pulloutconstants = Integrate[c_?NumericQ rest_, {x_, a_, b_}] :>
c Integrate[rest, {x, a, b}]


Now if we pull out the constant out of the integral and apply our integration by parts rule we end up with

eq /. pulloutconstants /. byparts which is nice on one hand, because the rule worked, but still unsatisfying because we ended up with the same integral all over again. But since we know the two expressions for our integral should be the same we can combine the new equation from applying integration by parts with our original equation to get

{eq /. pulloutconstants, eq /. pulloutconstants /. byparts}
eq2 = Eliminate[%, integral]  Great! Now we can use our knowledge that u vanishes as a goes to infinity and we have shown our original hypothesis!

Simplify[
eq2 /. {a -> \[Infinity]},
Assumptions -> {u[-\[Infinity]] == 0, u[\[Infinity]] == 0}
] Mathematica will compute the indefinite integral:

Integrate[u[x]*D[u[x], x], x]
(*  u[x]^2/2  *)


You could apply the fundamental theorem of calculus, ignoring questions of convergence:

Simplify[
Dot[
{-1, 1},
Integrate[u[x]*D[u[x], x], x] /. {{x -> -Infinity}, {x -> Infinity}}],
u[Infinity] == 0 && u[-Infinity] == 0]

(*  0  *)


In the OP's definite integral, Integrate does not ignore questions of convergence, I believe, which means that the result depends on the function u. I don't know if there's a way to pass properties of u to Integrate as Assumptions. The problem with assumptions is that they tend to be specific to the expression. For instance the assumption Limit[u[x], x -> Infinity] == 0 cannot be used in computing the limit of the expression u[x]^2/2 as given. Also, for the integral, one would need to specify that u[x] has no singularities at finite values of x. I don't know if that can be done.