# Improper Integrals of Odd functions

1. Jul 17, 2014

### Mogarrr

I think I may have found an error in the text I'm reading. Here's a quote:

$... + \int_0^{\infty}x^rf_1(x)sin(2\pi logx)dx$.

However, the transformation $y=-logx-r$ shows that this last integral is that of an odd function over (-∞,∞) and hence equal to 0 for $r=0,1,...$

By the way, the author means the natural log. I find this annoying.

Now assuming that the integrand is an odd function, I'm not so sure that this last statement is true. Is it the case that the integral of an odd function over (-∞,∞) equals 0.

Unless I've made a mistake (which happens often), I have a counterexample. The function, sin(x) is an odd function. Then

$\int_{-\infty}^{\infty}sin(x)dx = \int_{-\infty}^0sin(x)dx + \int_0^{\infty}sin(x)dx$.

Then looking at the second integral of the right-hand-side, we have

$lim_{t \to \infty}\int_0^{t}sin(x)dx = lim_{t \to \infty} -cos(x) |_0^{t}$,

but $lim_{t \to \infty}-cos(x)$ does not exist.

So even though sin(x) is an odd function, the integral of sin(x) over (-∞,∞) diverges, so it does not equal 0.

Am I right here?

2. Jul 17, 2014

If
* the function is odd and
* its integral from $(-\infty, \infty)$ exists

then the integral is zero. Since $\sin x$ is not integrable along the entire number line the discussion is moot.

So, there could be several things:

a) The text's author(s) may have already shown the integral in question already exists, and since you now know the integrand is odd, the conclusion follows

b) Depending on the age of the book the author(s) may be following the pattern of only talking of integrals when it is assumed the integral exists - in that case, once the integrand is known to be odd, the conclusion follows

Or, it could be that the reader is expected to fill in the details. (There are likely other possibilities I haven't thought of: I'm sure others will chime in on those or to clarify my rather short summary.)

3. Jul 17, 2014

### Mogarrr

The statement was meant to be a shortcut.

Are there any good methods to tell if an integral exists (besides integrating)?

The integral in question is

(*)$E X_2^{r} = \int_0^{\infty}x^rf_1(x)(1+sin(2\pi logx))dx$, where

$f_1(x) = \frac 1{\sqrt {2\pi} x} \exp{\frac {-(logx)^2}2}$, $0\leq x < \infty$,

and it was previously shown that $E X_1^r = \exp {\frac {r^2}2}$, for r=0,1,2,...

Since the expected value for $f_1(x)$ is known, (*) becomes

$E X_1^r + \int_0^{\infty} x^rf_1(x)sin(2\pi logx)dx$

which is where my first post started. I have no clue how I'd evaluate the integral. I may be able to do some linear algebra and approximate, but I don't wanna go there. Please help.

While I'm at it, I'm also trying to evaluate $E X_1^r$.

Last edited: Jul 18, 2014
4. Jul 18, 2014

### Erland

I think that there is a typo here: that the substitution should be y = - log x + r. (It is possible to use y = - log x - r also, but rather pointless, since it leads to a square completion which is otherwise unnecessary.)

If you make this substitution, plug in the known function f1 which you gave in a later post, simplify, recall that sin has period 2π and that r is an integer, you will see that the integrand is indeed an odd function and that the integral converges.

5. Jul 18, 2014

### Erland

Even simpler is to put y = log x - r. This is perhaps what was intented.

6. Jul 18, 2014

### Saitama

Mogar, can you please write down the exact integrals you are trying to solve without the $f_1(x)$ and $EX$ notation? Its a bit difficult for me to follow.

7. Jul 18, 2014

### verty

I question this because one can do this instead: $\lim_{t \to \infty} \int_{-t}^t sin(x) \; dx$. It's clear that this limit exists and is 0. And this works for any odd function, which is in line with what the author said.

-edit-
$$\lim_{t \to \infty} \int_{{π \over 2}-t}^{{π \over 2}+t} cos(x) \; dx$$.

Possibly this defines the integral of cos(x) to be 0 as well. I'm not at all sure that this is rigorous.

Last edited: Jul 18, 2014
8. Jul 18, 2014

### pasmith

Formally, one defines an integral over the whole real line by taking the limit of the upper and lower bounds independently:
$$\int_{-\infty}^\infty f(x)\,dx = \lim_{R \to \infty} \int_{-R}^c f(x)\,dx + \lim_{S \to \infty}\int_c^S f(x)\,dx$$ where $c$ is finite. The result, if it exists, is clearly independent of the choice of $c$ so nothing is lost by taking $c = 0$.

Thus formally the integral over the whole line of $\sin x$ doesn't exist, because the integral over the half line $[0,\infty)$ doesn't exist. However if, in the context, you're only ever going to be considering a symmetric interval about the origin then you can take the symmetric limit, which will be zero for any odd function and twice the integral over the half line for any even function.

9. Jul 18, 2014

### jbunniii

This is called the Cauchy principal value of the integral. It is useful in some contexts, e.g. Hilbert transforms. It can be used in some cases to assign a "reasonable" value even if the function is not integrable. However, one must be careful about this, because the value may be unstable if we shift the function. For example, if we shift $\sin$ by $\pi/2$ we get $\cos$, which doesn't have a Cauchy principal value (at least not with center point equal to 0) because the oscillations on each side of 0 don't cancel.

In this example, the integrand $\sin$ fails to be integrable because it doesn't converge to zero as $x \rightarrow \pm \infty$. Similarly, we may have a function which does converge to zero, but too slowly (so called "fat tails"), so the integral does not exist. But the Cauchy principal value may exist. Example: the expected value of a Cauchy random variable:
$$\frac{1}{\pi}\int_{-\infty}^{\infty} \frac{x}{(1+x^2)} dx$$
does not exist because the integrand is approximately $1/x$ as $x \rightarrow \pm \infty$. But since the integrand is an odd function which is integrable over any bounded interval, the Cauchy principal value does exist and equals zero.

Last edited: Jul 18, 2014
10. Jul 18, 2014

### verty

Thank you very much (and to JBunniii as well).

11. Jul 18, 2014

### Mogarrr

Thanks guys for interest in this thread

12. Jul 18, 2014

### Mogarrr

Yeah, I made a typo. Author said to to substitute the above

13. Jul 18, 2014

### Mogarrr

I don't think you'll find these details helpful in evaluating the integral, but here they are:

By definition, the expected value of random variable g(X), denoted $Eg(X)$ is

1) if X is continuous, $Eg(X) = \int_{-\infty}^{\infty}g(x)f_X(x)dx$

2) if X is discrete, $\sum_{x \in range of X} g(x)f_X(x)$

Also the function $f_X(x)$ is called the probability density function when the random variable X is continuous (probability mass function if X is discrete).

So one integral evaluation which was given in the text (I have yet to do on my own) is

$E X^r = \int_0^{\infty}x^r \cdot \frac 1{\sqrt {2\pi} x}\exp {\frac {-(logx)^2}2}dx= \exp {\frac {r^2}2}$, for $r=0,1,...$

So any hints for evaluating this integral would also be appreciated.

14. Jul 18, 2014

### Mogarrr

Ok, so I've made some progress, but I'm stuck now.

Making the substitution, $y = lnx -r$, I have

$x = \exp {y+r}$, $dy = \frac 1{x} dx$, and the bottom limit of integration switching from 0 → -∞, so

$\int_0^{\infty}x^r \frac 1{\sqrt {2\pi} x} sin(2\pi lnx) dx = \int_{-\infty}^{\infty}sin(2\pi (y+r)) \exp {(yr+r^2)}dy$.

Next, using integration by parts, I remind myself that $\int udv = uv - \int vdu$

I let $dv= \exp {(yr+r^2)}dy$ and $u=sin(2\pi (y+r))$, so $v= \frac 1{r} \exp {(yr+r^2)}$ and $du=2\pi cos(2\pi (y+r))dy$

Making the substitutions I have,

$sin(2\pi (y+r)) \frac 1{r} \exp {(yr+r^2)} |_{-\infty}^{\infty} - \int_{-\infty}^{\infty}2\pi cos(2\pi (y+r)) \frac 1{r} \exp {(yr+r^2)}dy$

Which means that its time for another round of integration by parts. This time I let $u=2\pi cos(2\pi (y+r))$ and $dv= \frac 1{r} \exp {(yr+r^2)}dy$, so $du=-(2\pi )^2sin(2\pi (y+r))dy$ and $v= \frac 1{r^2} \exp {(yr+r^2)}$.

Putting everything together, I have

$\int_{-\infty}^{\infty} sin(2\pi (y+r)) \exp {(yr+r^2)}dy = sin(2\pi (y+r)) \frac 1{r} \exp {(yr+r^2)} - 2\pi cos(2\pi (y+r)) \frac 1{r^2} \exp {(yr+r^2)} |_{-\infty}^{\infty} - (\frac {2\pi}{r})^2 \int_{\infty}^{\infty} sin(2\pi (y+r)) \exp {(yr+r^2)}dy$.

I see the pattern here: $x = a - (\frac {2\pi}{r})^2x$, so $x=a\frac 1{1+ (\frac {2\pi}{r})^2}$. So the integral I'm evaluating equals

$\frac 1{1+ (\frac {2\pi}{r})^2} \cdot (sin(2\pi (y+r))\frac 1{r} \exp {(yr+r^2)} - 2\pi cos(2\pi (y+r)) \frac 1{r^2} \exp {(yr+r^2)} |_{-\infty}^{\infty}$

Much earlier, I should've split the integral into the sum of two integrals. I don't think I did any harm in avoiding it up until now. So now the last part I need to evaluate is

$lim_{t \to \infty} \frac 1{1+ (\frac {2\pi}{r})^2} \cdot (sin(2\pi (y+r))\frac 1{r} \exp {(yr+r^2)} - 2\pi cos(2\pi (y+r)) \frac 1{r^2} \exp {(yr+r^2)}|_0^{t}$,

which is equal to

$lim_{t \to \infty} \frac 1{1+ (\frac {2\pi}{r})^2} \frac 1{r} \exp {(tr+r^2)} \cdot (sin(2\pi (t+r)) - \frac {2\pi}{r} cos(2\pi (t+r))) -$ the stuff at $y=0$.

This is the end of my long-winded post, which is where I'm stuck at now. Any suggestions?

15. Jul 18, 2014

### Erland

Hey, you forgot to plug in f1! The left side should be

$\int_0^{\infty}x^r \frac 1{\sqrt {2\pi} x}{e^-\frac {\ln^2 x}2}\sin(2\pi \ln x) dx$.

Here, make the substitution $y = \ln x -r \leftrightarrow x=e^{y+r}$ and simplify. No need for splitting it up and integration by parts.

Last edited: Jul 18, 2014
16. Jul 18, 2014

### Saitama

\begin{aligned} \int_0^{\infty} x^r e^{-\frac{\ln^2x}{2}}\sin(2\pi \ln x)\,\frac{dx}{\sqrt{2\pi}x}& =\frac{1}{\sqrt{2\pi}}\int_0^{\infty} e^{r\ln x}e^{-\frac{\ln^2x}{2}}\sin(2\pi \ln x)\frac{dx}{x} \\ &=\frac{e^{r^2/2}}{\sqrt{2\pi}}\int_0^{\infty} e^{-\left(\frac{\ln x-r}{\sqrt{2}}\right)^2}\sin(2\pi \ln x)\frac{dx}{x} \\ &=\frac{e^{r^2/2}}{\sqrt{2\pi}}\int_{-\infty}^{\infty} e^{-t^2/2}\sin(2\pi(t+r))\,dt \,\,\,\,\,(\ln x-r=t)\\ &=\frac{e^{r^2/2}}{\sqrt{2\pi}}\left(\cos(2\pi r)\int_{-\infty}^{\infty} e^{-t^2/2}\sin(2\pi t)\,dt+\sin(2\pi r)\int_{-\infty}^{\infty} e^{-t^2/2}\cos(2\pi t)\,dt\right) \\ \end{aligned}

The first integral is zero because the integrand is odd. The second integral is non-zero but $\sin(2\pi r)$ is zero for the given values of $r$.

For the second integral, do a similar manipulation to get:
$$\int_0^{\infty} x^re^{-\ln^2x/2}\,\frac{dx}{\sqrt{2\pi}x}=\frac{e^{r^2/2}}{\sqrt{2\pi}}\int_{-\infty}^{\infty} e^{-t^2/2}\,dt=e^{r^2/2}$$

17. Jul 19, 2014

### Mogarrr

I'm gonna have to look at Pranav-Arora's post in detail, but what I have so far is

$\int_0^{\infty}x^r \frac 1{\sqrt {2\pi} x} \exp {\frac {-(lnx)^2}2} sin(2\pi lnx)dx$

And making a substitution for $y = lnx -r$, I have

$\int_{-\infty}^{\infty} (e^{y+r})^r e^{{\frac {-(lnx)^2}2}} sin(2\pi (y+r))dy$, (I got tired of typing e as exp).

Then making some simplifications I have

(*)$\int_{-\infty}^{\infty} e^{(y+r)(r-1)} sin(2\pi (y+r))dy$.

Then taking Erland's advice I look through some common integrals and I find this

$\int e^{bx}sin(ax)dx = \frac 1{a^2 + b^2}e^{bx} (bsin(ax)-acos(ax))$,

which is the same pattern as (*).

Now evaluating the improper integral, one of the limits I will need to evaluate is

$lim_{t \to \infty} \frac 1{(2\pi)^2 + (r-1)^2} e^{(r-1)(y+r)} \cdot ((r-1)sin(2\pi (y+r)) - (2\pi)cos(2\pi (y+r))) |_0^t$,

and this is where I'm currently stuck at. Any suggestions? (Help is always appreciated)

18. Jul 19, 2014

### Saitama

You didn't replace $\ln^2 x$ with $(y+r)^2$.

If you simplify this, you should get:
$$\exp\left(r(y+r)-\frac{(y+r)^2}{2}\right)=\exp\left((y+r)\frac{r-y}{2}\right)=\exp\left(\frac{r^2-y^2}{2}\right)$$
You can see that you cannot use the formula you posted.

19. Jul 19, 2014

### Mogarrr

I wanted to save some space, but I made the following observation

$e^{\frac {-(y+r)^2}2} = (e^{(y+r)^2})^{\frac {-1}2} = (e^{(y+r)})^{\frac {-1}2 \cdot 2} = e^{-y-r}$

and multiplying by $e^{r(y+r)}$, I then simplify the exponents

$r(r+y) -y -r = r^2 +ry -y -r = r^2 -r +ry -y = r(r-1) + y(r-1) = (r+y)(r-1)$

I think all of the manipulations I made were legal

20. Jul 19, 2014

### Saitama

This is not correct.