Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is

$$\int_0^{\infty} (-1)^{\lfloor x^2 \rfloor} \, \operatorname{d}\!x \ ?$$

share|cite|improve this question
up vote 1 down vote accepted

Let $f(x) = (-1)^{\lfloor x^2 \rfloor}$. Then you can show that $$s_n=\int_0^{\sqrt{n}} f(t) \, dt = \sum_{k=0}^n \frac{(-1)^k}{\sqrt{k}+\sqrt{k+1}} \, .$$ Note that $s_n$ is a convergent sequence.

Now, for any fixed $x>0$, we can find some $n$ with $\sqrt{n}<x<\sqrt{n+1}$. Since the sign of $f$ is constant on $[\sqrt{n},\sqrt{n+1}]$, $\int_0^x f(t) \, dt$ lies between $s_n$ and $s_{n+1}$. The sequences $\{s_n\}$ and $\{s_{n+1}\}$ converge to the same value, and $n$ increases without bound as $x$ does; thus $\int_0^x f(t) \, dt$ converges by the squeeze theorem.

What lesson should you take from this in general? The only thing that can go wrong when you try to turn an improper integral into a sum is that you might be concealing some cancellation. In this case, we're breaking up the integral everywhere the sign of the integrand changes, so there's no way that could happen.

You are right to be somewhat worried, though. Notice that while $\sum_{k=0}^\infty \frac{(-1)^k}{\sqrt{k}+\sqrt{k+1}}$ converges, it doesn't converge absolutely. So there are certain things you can't do to this integral that you might want to (e.g., any substitution that amounts to a rearrangement of the sum).

share|cite|improve this answer

The integral is just a sum of the integrand value over an interval of a constant integer value times the length of that interval. Note that $\lfloor x^2\rfloor$ is equal to the integer $k$ when $x \in [\sqrt{k},\sqrt{k+1}]$. Therefore,

$$\int_0^{\infty} dx \: (-1)^{\lfloor x^2\rfloor} = \sum_{k=0}^{\infty} (-1)^k (\sqrt{k+1}-\sqrt{k}) = \sum_{k=0}^{\infty} \frac{(-1)^k}{\sqrt{k+1}+\sqrt{k}}$$

The sum converges by comparison with

$$\sum_{k=1}^{\infty} \frac{(-1)^{k+1}}{\sqrt{k}}$$

share|cite|improve this answer
It is not quite right to break the integral to a sum of integrals (here constants) because of the explicit choosing of M's (at the M->infinity definition) For ex, I may say the integral of sin for 0 to infinity is the sum of the integrals of sin from [2pi*k,2pi*(k+1)] and I'll get zero. – ORBOT Inc. Apr 19 '13 at 16:18
@ORBOTInc.: what you say only applies when the sums are not convergent or defined (i.e., infinity zeroes are zero). The sums here are indeed convergent and well-defined, and what I have done is valid. – Ron Gordon Apr 19 '13 at 16:20
Yes, only if you'll prove it does converge, how can you do so? – ORBOT Inc. Apr 19 '13 at 16:22
Infinite sum of zeroes is zero, but the turning to sum isn't right because of the fact the definition is lim[M->infinity](Int[0,M]f) so if the limit exists you may look at a certain series Mn->infinity but it exists for a certain series (sqrt(n) for that matter) it doesn't mean it exists. What I may do in yours or my solution is to bound the integral between any M to the nearest Mn (or sqrt(n)) .. – ORBOT Inc. Apr 19 '13 at 16:39
@RonGordon you got no point... At this case (Int[0,2pi](sin(x)dx)) I'm not talking about a limit reaching zero, I'm talking about the constant zero. – ORBOT Inc. Apr 19 '13 at 16:42

Hint: Draw a picture of the graph of the integrand and shade the relevant regions.

share|cite|improve this answer

My own answer was to substitute t=x^2 and to get Int( (-1)^floor(x) * 1/2sqrt(x) ) then trying to use the fact Int( (-1)^floor(x) ) for x=0 to 2 is 0 and it's repeating, also 1/2sqrt(x) is monotonic to zero... Is it a right way of solving this question? How may I complete it on a formal way?

share|cite|improve this answer


And its value can be expressed as $$ \sum_{n\geqslant0}\left(2\sqrt{2n+1}-\sqrt{2n}-\sqrt{2n+2}\right) $$ or as $$ \sum_{n\geqslant0}\frac2{(\sqrt{2n+1}+\sqrt{2n})(\sqrt{2n+2}+\sqrt{2n+1})(\sqrt{2n+2}+\sqrt{2n})} $$

share|cite|improve this answer
Is this effectively an Euler transformation on the alternating sum in my result? Or did I screw up the name for it? – Ron Gordon Apr 19 '13 at 16:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.