# Integral involving the floor function

## Homework Statement

##\displaystyle \int_0^1 \frac{1}{\lfloor 1- \log_2 (1-x)\rfloor}##

## The Attempt at a Solution

How in general do I approach integrals with floor functions? I'm thinking maybe I can figure out what the function in the integrand looks like on paper and calculate the area manually, but that seems very tedious...

Mark44
Mentor

## Homework Statement

##\displaystyle \int_0^1 \frac{1}{\lfloor 1- \log_2 (1-x)\rfloor}##

## The Attempt at a Solution

How in general do I approach integrals with floor functions? I'm thinking maybe I can figure out what the function in the integrand looks like on paper and calculate the area manually, but that seems very tedious...
What I would do is to look at the values of x = 1/2, 1/4, 1/8, and so on, to get values for you integrand function. Maybe that will give you some ideas. Also note that you have a problem when x = 1, since ##\log_2(0)## is ##-\infty##.

Ray Vickson
Homework Helper
Dearly Missed

## Homework Statement

##\displaystyle \int_0^1 \frac{1}{\lfloor 1- \log_2 (1-x)\rfloor}##

## The Attempt at a Solution

How in general do I approach integrals with floor functions? I'm thinking maybe I can figure out what the function in the integrand looks like on paper and calculate the area manually, but that seems very tedious...

Some problems just have tedious solutions.

Start off by doing it the hard way, and maybe while writing down the solution you will arrive at some insights that will help you to shorten the solution.

So what it seems is that the integrand forms a staircase starting at x=1, and goes down to x=0, where, in the very least, there is a new stair at each ##x=1/2^n## in between. So that's something, but I'm wondering now, how can I prove whether or not there are additional drops in between each ##(1/2^{n+1}, 1/2^n)##...

Mark44
Mentor
So what it seems is that the integrand forms a staircase starting at x=1, and goes down to x=0, where, in the very least, there is a new stair at each ##x=1/2^n## in between. So that's something, but I'm wondering now, how can I prove whether or not there are additional drops in between each ##(1/2^{n+1}, 1/2^n)##...
Instead of powers of 1/2, as I first suggested, look at values of x of 1/2, 3/4, 7/8, 15/16, ... ##\frac{2^n - 1}{2^n}##. These will produce numbers whose base-2 logs are integers.

##\log_2(1 - 1/2) = \log_2(1/2) = -1##
##\log_2(1 - 3/4) = \log_2(1/4) = -2##
and so on...

epenguin
Homework Helper
Gold Member
I don't know why are you call it a floor function.It looks to me a function which is continuous and smooth between the integration limits.

Maybe you just need to put the integrand in a more evident form, remembering elementary definitions? Start by thinking what is 1 log2 of?

Instead of powers of 1/2, as I first suggested, look at values of x of 1/2, 3/4, 7/8, 15/16, ... ##\frac{2^n - 1}{2^n}##. These will produce numbers whose base-2 logs are integers.

##\log_2(1 - 1/2) = \log_2(1/2) = -1##
##\log_2(1 - 3/4) = \log_2(1/4) = -2##
and so on...
So if I let ##\displaystyle f(x) = \frac{1}{\lfloor 1- \log_2 (1-x) \rfloor}##, then ##\displaystyle f \left(\frac{2^n-1}{2^n} \right) = \frac{1}{n+1}##. So ##f(0) = 1,~ f(1/2) = 1/2, ~ f(3/4)=1/3 ##, and so on. So I have infinite steps down to 0 as ##n## approaches infinity. This makes me think that I will end up with an infinite sum, summing up a bunch of areas that are getting smaller and smaller. However, I guess the last thing I need to check is whether is is true or not that if ##x^* \in \left[\frac{2^n-1}{2^n},\frac{2^{n+1}-1}{2^{n+1}} \right)## then ##f(x^*) = \frac{1}{n+1}##... I don't really see how. Should I just assume it's true?

Mark44
Mentor
So if I let ##\displaystyle f(x) = \frac{1}{\lfloor 1- \log_2 (1-x) \rfloor}##, then ##\displaystyle f \left(\frac{2^n-1}{2^n} \right) = \frac{1}{n+1}##. So ##f(0) = 1,~ f(1/2) = 1/2, ~ f(3/4)=1/3 ##, and so on. So I have infinite steps down to 0 as ##n## approaches infinity. This makes me think that I will end up with an infinite sum, summing up a bunch of areas that are getting smaller and smaller. However, I guess the last thing I need to check is whether is is true or not that if ##x^* \in \left[\frac{2^n-1}{2^n},\frac{2^{n+1}-1}{2^{n+1}} \right)## then ##f(x^*) = \frac{1}{n+1}##... I don't really see how. Should I just assume it's true?
Set up a Riemann sum to approximate your integral. In the integral you're not just adding 1 + 1/2 + 1/3 + ... -- you're adding the areas of the rectangles, all of which are decreasing in width.

andrewkirk
Homework Helper
Gold Member
I guess the last thing I need to check is whether is is true or not that if ##x^* \in \left[\frac{2^n-1}{2^n},\frac{2^{n+1}-1}{2^{n+1}} \right)## then ##f(x^*) = \frac{1}{n+1}##... I don't really see how. Should I just assume it's true?
It is true, and I think you would be expected to prove it.

The proof is not difficult. Just use the fact that log base 2 is a monotonic function to conclude that the inside of the floor function is monotonic, and then show that it is an integer whenever ##x=\frac{2^k-1}{2^k}## for some non-negative integer ##k##.

I don't expect there will be a closed expression for the infinite sum, but it will converge rapidly so can be calculated to good accuracy with only a few terms.

Ray Vickson
Homework Helper
Dearly Missed
It is true, and I think you would be expected to prove it.

The proof is not difficult. Just use the fact that log base 2 is a monotonic function to conclude that the inside of the floor function is monotonic, and then show that it is an integer whenever ##x=\frac{2^k-1}{2^k}## for some non-negative integer ##k##.

I don't expect there will be a closed expression for the infinite sum, but it will converge rapidly so can be calculated to good accuracy with only a few terms.

Actually, it has a quite familiar closed-form.

epenguin
Homework Helper
Gold Member
Again I say there is nothing in problem statement 1 to tell me this is a floor function. The integrand plots as a fairly ordinary function with a finite integral between the given limits, see below.

However the integrals of reciprocal logs require a special function, Li, (I am not telling you one) not simply related as far as I know to any of the widely known functions, just defined by an integral

$$Li\left( x\right) =\int ^{x}_{0}\dfrac {dx}{\ln x}$$

Once one knows that, one can work out as already indicated the answer to the present problem in terms of this function, I think it is
$$2\ln 2Li\left( \dfrac {1}{2}\right)$$ The

#### Attachments

andrewkirk
Homework Helper
Gold Member
there is nothing in problem statement 1 to tell me this is a floor function.
The integrand is not a floor function, but there is a floor function applied in the denominator of the integrand, denoted by the infix operator ##\lfloor ... \rfloor##. That function returns the greatest integer that is less than or equal to the argument. The latex codes for the delimiters are \lfloor and \rfloor. The difficulty it raises is that it turns the integrand into a function that is discontinuous but piecewise constant. It is also càdlàg.

• Orodruin
Ray Vickson