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

What is

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

-
Please read this: math.stackexchange.com/tags/homework/info –  Fly by Night Apr 19 '13 at 16:06
Really?! Who changed the integrand? Keep reading those suggested edits, people! –  Lord_Farin Apr 19 '13 at 16:07
@Lord_Farin I did. It's known as a typographical error. –  Fly by Night Apr 19 '13 at 16:09
@Lord_Farin >.< Thanks. –  Pedro Tamaroff Apr 19 '13 at 16:10
I'll note: I already submitted my HW so the tag is unnecessary, I did something which is not very formal (starting with x^2=t) so I'm looking for a totally formal solution. –  ORBOT Inc. Apr 19 '13 at 16:10

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).

-

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}}$$

-
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.

-

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?

-

Convergent.

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})}$$

-
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