## Strange integral

For the discussion of math. Duh.

Moderators: gmalivuk, Moderators General, Prelates

pizzazz
Posts: 487
Joined: Fri Mar 12, 2010 4:44 pm UTC

### Strange integral

Last night I was pondering a strange function, which I saw a long time ago, and its integral. The function is
$f(x)= \begin {cases} 1, & \text{if }x \text{ is rational} \\ 0, & \text{if }x \text{ is irrational} \end {cases}$.

So we have a function consisting of a countably infinite number of vertical lines, one unit high. Let's flip the function, so we have

$g(x)= \begin {cases} 0, & \text{if }x \text{ is rational} \\ 1, & \text{if }x \text{ is irrational} \end {cases}$.

This function has an uncountably infinite number of vertical lines, one unit high. I'm not going to torture calculus trying to work with derivatives here, but it does seem we have the ingredients for a definite integral. (I'm assuming these functions actually have well defined integrals, as proving whether they do or do not is beyond my ability. This is basically for my curiosity anyway). The value of each of these functions is always at most 1, so for any interval the definite integral of each function will be less than the definite integral of [imath]h(x)=1[/imath]. In fact,
$\int_{0}^{1}\ g(x), dx + \int_{0}^{1}\ f(x), dx = \int_{0}^{1}\ f(x)+g(x), dx = \int_{0}^{1}\ 1, dx = 1$

But I can't figure anything else out at the moment. Is there anything else we can show? Has someone else done work with this already?

ImTestingSleeping
Posts: 88
Joined: Mon Dec 06, 2010 3:46 am UTC

### Re: Strange integral

f(x) and g(x) are known as Dirichlet functions and they are not integrable individually. In order to be integrable, the upper and lower sums must converge to each other. However, due to the density of rationals and irrationals, no matter what partition we choose, the upper sum will always be 1 and the lower sum will always be 0.

However, f(x) + g(x) is basically the function h(x)=1 which would be integrable.

 Disregard this post, please. It is only true for Riemann integration, as explained by ++$_ below. Last edited by ImTestingSleeping on Fri Dec 17, 2010 6:14 am UTC, edited 1 time in total. ++$_
Mo' Money
Posts: 2370
Joined: Thu Nov 01, 2007 4:06 am UTC

### Re: Strange integral

These are pretty typical examples in analysis. They illustrate, among other things, the difference between the Riemann integral and the Lebesgue integral.

If you don't know what a Lebesgue integral is, then chances are that the integral you have seen is the Riemann integral. To calculate the Riemann integral [imath]\int_0^1f(x)\,dx[/imath], you partition the region of integration into intervals [imath]\{I_k\}_{k=1}^n[/imath]. In each interval [imath]I_k[/imath] you pick a point [imath]c_k[/imath]. Then you calculate the limit of [imath]\sum_{k=1}^n \left|I_k\right|f(c_k)[/imath]as the mesh of the partition goes to 0. If the limit exists, the Riemann integral exists. Now, in the case of the functions you have, this limit does not exist. The reason is that no matter how fine the partition is, it is possible to select a rational point in each interval, making the sum 1. On the other hand, it is also possible to select an irrational point in each interval, making the sum 0. So the limit does not exist; i.e., the Riemann integral doesn't exist.

The Lebesgue integral is more complicated to explain. It is a "better" integral in that any function that is Riemann-integrable is also Lebesgue-integrable, but there are some functions that are Lebesgue-integrable that are not Riemann-integrable. Your functions fall into the latter category. In fact, the Lebesgue integral of f over [0,1] is 0, and the Lebesgue integral of g over [0,1] is 1.

ImTestingSleeping
Posts: 88
Joined: Mon Dec 06, 2010 3:46 am UTC

++$_ wrote:The Lebesgue integral is more complicated to explain. It is a "better" integral in that any function that is Riemann-integrable is also Lebesgue-integrable, but there are some functions that are Lebesgue-integrable that are not Riemann-integrable. Your functions fall into the latter category. In fact, the Lebesgue integral of f over [0,1] is 0, and the Lebesgue integral of g over [0,1] is 1. I'm taking an introductory real analysis course right now and you, my friend, just blew my mind. You know that feeling you got in middle school the day they told you that you CAN take the square root of a negative number? A horrible feeling, but I thank you for it. mark999 Posts: 75 Joined: Fri Jul 11, 2008 1:00 am UTC ### Re: Strange integral A more important reason that the Lebesgue integral is better is that it has better convergence properties, in particular the monotone convergence theorem and the dominated convergence theorem. Marbas Posts: 1169 Joined: Mon Jun 04, 2007 4:01 am UTC Location: Down down down at the bottom of the sea Contact: ### Re: Strange integral mark999 wrote:A more important reason that the Lebesgue integral is better is that it has better convergence properties, in particular the monotone convergence theorem and the dominated convergence theorem. What's even better is when you get Fourier Theory. Jahoclave wrote:Do you have any idea how much more fun the holocaust is with "Git er Done" as the catch phrase? GyRo567 Posts: 107 Joined: Sun Jun 01, 2008 4:59 am UTC Location: Austin, TX Contact: ### Re: Strange integral What's even stranger, is that a similar function, called Thomae's function, is Riemann integrable! $f(x)= \begin {cases} \frac{1}{q} & \text{if } x=\frac{p}{q} \text{ is rational} \\ 0 & \text{if } x \text{ is irrational} \end{cases}$ This function is discontinuous only at rational points. I came here to read a cool post, a witty dialogue, a fresh joke, but stumbled upon a "bump"... Way to go, jerk... ~CordlessPen imatrendytotebag Posts: 152 Joined: Thu Nov 29, 2007 1:16 am UTC ### Re: Strange integral ++$_ wrote:The Lebesgue integral is more complicated to explain. It is a "better" integral in that any function that is Riemann-integrable is also Lebesgue-integrable, but there are some functions that are Lebesgue-integrable that are not Riemann-integrable. Your functions fall into the latter category. In fact, the Lebesgue integral of f over [0,1] is 0, and the Lebesgue integral of g over [0,1] is 1.

Almost... every function defined on a bounded interval that is Riemann-integrable is also Lebesgue-integrable. But there are functions defined on, say, the positive reals which are Riemann-integrable but not Lebesgue integrable, if you consider "Riemann-Integrable" to mean that the limit of the integral as the upper limit tends to infinity is defined. For instance, the function sin(x)/x is Riemann-integrable but not Lebesgue-integrable, I'm fairly sure.
Hey baby, I'm proving love at nth sight by induction and you're my base case.

Yakk
Poster with most posts but no title.
Posts: 11129
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

### Re: Strange integral

ImTestingSleeping wrote:
++$_ wrote:The Lebesgue integral is more complicated to explain. It is a "better" integral in that any function that is Riemann-integrable is also Lebesgue-integrable, but there are some functions that are Lebesgue-integrable that are not Riemann-integrable. Your functions fall into the latter category. In fact, the Lebesgue integral of f over [0,1] is 0, and the Lebesgue integral of g over [0,1] is 1. I'm taking an introductory real analysis course right now and you, my friend, just blew my mind. You know that feeling you got in middle school the day they told you that you CAN take the square root of a negative number? A horrible feeling, but I thank you for it. The Lebesgue intergral isn't all that complicated to explain, if you skip the hard part. The Riemann interval subdivides the domain of the function into equal-ish contiguous chunks, then multiplies the height of an arbitrary point in the image of the subdivision by the "length" or "volume" of the subdivision of the domain. The Lebesgue integral subdivides the range of the function into equal-ish contiguous chunks, then multiplies the height of that range chunk by the "length" or "volume" of the inverse image of that range subdivision. The hard part is measuring the "length" or "volume" of the inverse image -- you need to be able to say "if turned into an interval, how long would all the rational numbers be" in effect. You do this with a bunch of work and tricks and checks to make sure your definition is optimal and consistent, and even then you end up failing on some subsets. This is the subject called "measure theory". imatrendytotebag wrote:Almost... every function defined on a bounded interval that is Riemann-integrable is also Lebesgue-integrable. But there are functions defined on, say, the positive reals which are Riemann-integrable but not Lebesgue integrable, if you consider "Riemann-Integrable" to mean that the limit of the integral as the upper limit tends to infinity is defined. For instance, the function sin(x)/x is Riemann-integrable but not Lebesgue-integrable, I'm fairly sure. If you define the Riemann-integral in the same sense as the Lebesgue integral (as the limit of finite integrals originating from 0), they both work on that function. If you define the infinite Riemann integral to pick up sections by a different order ... Define I_k = [k pi/2, (k+1) pi/2) Then D_k = I_k U I_(-k+1) Then we Lebesgue integrate the function in question in the order D_0, D_4, D_8, D_1, D_12, D_16, D_2, D_20, D_24, D_3, D_28, D_32, D_5, ... we will eventually cover the entire real line in our domain, yet our integral will not converge to the same value (and possibly not at all) as doing it uniformly from 0. (Basically, the Riemann integral you describe does not "converge absolutely", so the order in which you choose to integrate regions lets you change the result to -infinity, +infinity, or anything in between...) The Lebesgue integral doesn't require you to make choices for the order you integrate, so it says "infinity minus infinity is .. well, that makes no sense". If you make the same choices for the order of integration that you made for the Riemann integral, you get the same result: the difference is, of course, that the Riemann integral requires you to make that choice, and you don't notice that what you thought was the integral of the function was actually just a function of what you chose it to be by your order of integration! One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total. ImTestingSleeping Posts: 88 Joined: Mon Dec 06, 2010 3:46 am UTC ### Re: Strange integral Yakk wrote:The Riemann interval subdivides the domain of the function into equal-ish contiguous chunks, then multiplies the height of an arbitrary point in the image of the subdivision by the "length" or "volume" of the subdivision of the domain. The Lebesgue integral subdivides the range of the function into equal-ish contiguous chunks, then multiplies the height of that range chunk by the "length" or "volume" of the inverse image of that range subdivision. The hard part is measuring the "length" or "volume" of the inverse image -- you need to be able to say "if turned into an interval, how long would all the rational numbers be" in effect. You do this with a bunch of work and tricks and checks to make sure your definition is optimal and consistent, and even then you end up failing on some subsets. This is the subject called "measure theory". That's very interesting. It sounds a bit like dy Riemann integration, except we wouldn't have to break up into more than one integral if the function isn't 1-1? Is that a good way to think about it to start? Having said that, wouldn't there be situations (in the Lebesgue integration) on functions which are not 1-1 where we'd have more than one interval of "length" or "volume" for a particular inverse image? ++$_
Mo' Money
Posts: 2370
Joined: Thu Nov 01, 2007 4:06 am UTC

### Re: Strange integral

Yes, often [imath]f^{-1}(c)[/imath] is not an interval, or a union of disjoint intervals, or indeed anything reasonable at all. This occurs, for example, with the functions from the OP, but the situation can easily get much worse than that.

This is why measuring the "volume" of [imath]f^{-1}(c)[/imath] is the tricky part, as Yakk said.

Yakk
Poster with most posts but no title.
Posts: 11129
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

### Re: Strange integral

That made me think of a different way to do integration.

Think if integrals as operating on the graph of a function -- the set of (x,y) points. For a strictly monotonic function, both x and y are unique. For non-monotonic functions, x is unique while y isn't. For yet other functions (like path functions), both x and y can be duplicated.

To do Riemann integration on such a graph, you cut the graph up into increasingly thinner lines parallel to the y axis. In each, you find where the graph is -- and you multiply the width of the section by how far away from the x axis (signed distance) it is.

To do Lebesgue integration, you first slice it thinly along lines parallel to the x axis. This generates a sequence of points. We then cut each of the thin slices up into even thinner 'boxes', to the point that the thin slice height is the long part of the boxes, and off to infinitesimal width boxes. As the boxes get smaller, we count how many contain anything from the function, and multiply that by how wide the boxes are. (note we can allow boxes to overlap -- we take the inf of all such box-coverings) (this is known as the outer measure). If the function is "measurable" then this outer measure "behaves well".

You'll note that description of Lebesgue integration lets you integrate things which are not 'functions' in a somewhat natural way, because we do double-boxing. In a sense, it doesn't matter if there is an "extra" line somewhere else, because the Lebesgue operations are local. A function or area that is "dense" vertically ends up looking like a solid line to Lebesgue integration, much as horizontal "dense" lines (like functions that are 1 on Q) end up looking solid.

I have this weird wish to somehow use 2-D Lebesgue integration on the graph, with a potential field that increases the weight of parts that are "more positive", but lines have a measure of 0. In effect, the weight of the line components needs to be infinite in a particular way. Is there a way to do this prettily, and have the "average height" of a weighed region of the plane generate the integral of a function (assuming the "signed distance to the x axis" weight), and also be able to deal with "solid" 2-D objects like squares with a given weight?

Edit: Technical error. You don't subdivide the rows in Lebesgue integration, instead you cover the points in it with rectangles, up to countably infinite many axis-aligned rectangles. Subdividing ends up not being as powerful (as it cannot 'tease out' dense sets like the rationals, for example).
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.