# What does the integral of a function times a function of a random variable represent, conceptually?

I am trying to understand conceptually what does the following give me or tell me:

$$\int f(x) \cdot g(x) \, dx$$

where $$f(x)$$ is any continuous function of $$x$$ and $$g(x)$$ is the probability density function for a random variable, for example a normal distribution's PDF is:

$$g(x) = \frac1 {2 \pi \sigma^2} \exp\left(\frac{- (x - \mu)^2 }{ 2 \sigma ^2}\right)$$

I understand the integral of a PDF gives me the CDF. So:

$$\int_{-\infty}^0 g(x) \, dx$$

Gives me the probability of $$x$$ being less than $$0$$. However, what happens when you multiply $$g(x)$$ by another function $$f(x)$$ and take the integral? I heard it gives you the expected payoff assuming $$f(x)$$ is a function of payoffs and you take an integral from -infinity to +infinity. This, if true, I conceptually understand. sum of payoffs times the probabilities is the expected value of whatever game you are playing.

I start getting confused when the boundaries of the integral are not $$\pm \ infty$$. I'm not sure in that case what integral conceptually means. For example:

$$\int_{-\infty}^0 f(x) g(x) \, dx$$

What does that tell me?

Suppose $$g$$ is the pdf of random variable $$X$$, then

$$E[f(X)|X \in A]= \frac{\int_A f(x)g(x) \, dx}{\int_A g(t) \, dt}$$

Hence $$\int_A f(x) g(x) \, dt = Pr(X \in A) E[f(X)|X \in A],$$

it gives you the product of the conditional expectation of $$f(X)$$ given that $$X \in A$$ and the probability that $$X$$ is in $$A$$.

I think $$E[f(X)|X \in A]$$ is a more interesting quantity, and I would divide your integral with $$Pr(X \in A)$$ to recover it.

The expected value of $$X$$ following distribution $$g$$ is

$$E[X] = \int x \,g(x) \,dx$$

By the law of the unconscious statistician we know that the expected value of a function $$f$$ of random variable $$X$$ is

$$E[f(X)] = \int f(x) \,g(x) \,dx$$

What does it tell you? It tells you what would be the expected value of your random variable if you transformed it somehow. For example, say that you know what is the distribution of height for humans in centimetres, but are interested in expected value in meters, i.e. where $$f(x) = x/100$$.

Another way to look at this integral is through the random variable transformation point of view. You can think of $$Y=f(x)$$ as a new random variable, and your integral is the expectation (mean) $$E[Y]$$ of the new variable $$Y$$.

Let's build the probability density function of the new variable $$Y$$. Unfortunately, we can't derive an analytical expression. We'll have to use a more complex, integral form of it.

What is the probability that $$Y$$ will have values between $$y$$ and $$y+dy$$? We look at all $$x$$ where $$y and add up their probabilities: $$g_y(y)dy=\int_x \mathbb1_{y

Next, we simply integrate over all values of $$Y$$: $$E[y]=\int_yyg_y(y)dy$$ Since $$\int_y$$ runs through all possible $$y$$, it's the same as running the integral through all possible $$x$$. Just pause for a moment and agree with me...

Now that you agreed with me you'll see that: $$E[Y]=\int_xf(x)g(x)dx$$

• This could use some elaboration. Perhaps an example would help. If you would also bring into consideration the idea of truncation or conditioning (which seems to be the main stumbling block), I think your point would be an excellent answer. – whuber Apr 26 '19 at 15:17
• @whuber, i did impossible: explained Lebesque integral without measure theory! – Aksakal Apr 26 '19 at 15:21