Zulip Chat Archive

Stream: Is there code for X?

Topic: Integration on ℝ by parts


Aaron Bies (May 31 2023 at 18:33):

I have a problem of the form ∫ (x : ℝ), x * f x and would like to solve it using integration by parts.

The relevant theorem seems to be interval_integral.integral_mul_deriv_eq_deriv_mul, but I need some way to turn my integral into one with interval bounds, so something like:

 (x : ), f x = lim N  ,  x in -N .. N, f x

Does this lemma exist somewhere or is there a variation of integration by parts I can use here?

Sebastien Gouezel (May 31 2023 at 18:40):

See docs#measure_theory.interval_integral_tendsto_integral

Sebastien Gouezel (May 31 2023 at 18:41):

In this file, we also have versions of integration by parts on semiinfinite intervals, but not on the whole line as far as I can tell. It's not that there is any difficulty here, only that no one has needed it yet.

Aaron Bies (Jun 08 2023 at 21:11):

Actually, what would be a good way to show that λ x, x * f x is integrable, if I already know f is?

It seems measure_theory.integrable.bdd_mul is almost what I want, but it requires me to prove that λ x, ‖x‖ either has an upper bound or a finite integral.

Jireh Loreaux (Jun 08 2023 at 21:40):

It's not true. Take f x := 1 / x ^ 2.

Kalle Kytölä (Jun 09 2023 at 05:53):

I think Jireh meant f(x)=1/(1+x^2) so f is integrable, but indeed the statement is just not true.

Aaron Bies (Jun 10 2023 at 13:36):

I will rephrase the question:

If you ever computed the expected value of a random variable using its pdf, you will be familiar with integrating functions of the form λ x, x * f x. I want to do just that, but it seems most theorems about integrals in mathlib also require a proof that the function is integrable in the first place. While trying to write that proof, I was only able to find a single theorem about multiplication in mathlib, that being measure_theory.integrable.bdd_mul, which isn't applicable because of the left-hand side. Is there something I can use in this situation?

Yaël Dillies (Jun 10 2023 at 13:38):

Are you following a paper proof that we can have a look at? What's the pdf in question?

Aaron Bies (Jun 10 2023 at 13:39):

The pdf in question is the normal distribution

Aaron Bies (Jun 10 2023 at 13:41):

It is (more or less) this proof

Yaël Dillies (Jun 10 2023 at 13:43):

@Jason KY., you will know the optimal way of proving this.

Jireh Loreaux (Jun 10 2023 at 17:50):

@Aaron Bies just so you're aware, some distributions have "heavy tails", which means they're expectation is infinite (i.e., the integrand in your question is not integrable). This doesn't apply to the normal distribution, but it does in general.

Kalle Kytölä (Jun 11 2023 at 09:05):

Aaron Bies said:

It is (more or less) this proof

Like many informal proofs, this proof doesn't bother the reader with the fully detailed justifications for the use of the fundamental theorem of calculus. It assumes that the reader is able to fill in some needed integrability assumptions. But in order to write a formal proof, you will need to provide also those omitted justifications.

As you said, the integration by parts theorem docs#interval_integral.integral_mul_deriv_eq_deriv_mul is a key result, and results of the flavor docs#measure_theory.interval_integral_tendsto_integral are needed then to get to the whole real line as Sébastien said. In that step, you probably need to prove something to the effect that xxex2/2x \mapsto x e^{-x^2/2} is integrable. This should not be difficult --- but to convince yourself that it is not automatic, recall Jireh's warning that it is wrong for general xxf(x)x \mapsto x f(x) even if ff itself is integrable.

Kalle Kytölä (Jun 11 2023 at 09:06):

The (modified) Jireh's warning can be modified to illustrate the the proof you linked to does some reasoning not made explicit in it. If we set f(x)=1π11+x2f(x) = \frac{1}{\pi} \frac{1}{1+x^2} (the density of the Cauchy distribution), then a primitive of xf(x)x f(x) is 12πlog(1+x2)\frac{1}{2\pi} \log(1+x^2). Do we have "by fundamental theorem of calculus" (as in the proof you quote):

Rxf(x)dx=?[12πlog(1+x2)]+  ?\int_\R x f(x) \, dx \overset{?}{=} \Big[ \frac{1}{2\pi} \log(1+x^2) \Big]_{-\infty}^{+\infty} \; ?

Jason KY. (Jun 11 2023 at 13:54):

We do have measure_theory.pdf.integral_mul_eq_integral which might be what you are looking for?


Last updated: Dec 20 2023 at 11:08 UTC