# Questions relating the definition of conditional expectation $E[g(X)|M]$ where is $X$ is random variable and M is an event

I saw the following definition of conditional expectation from a book:

if M is event and X is continuous random variable then we define: $$E[X|M]=\int_{-\infty}^\infty xf(x|M)dx$$

Which is the regular definition where $$f(x)$$ is replaced by the conditional density $$f(x|M)$$.

Now I got also the theorem which says that:

Let $$X$$ be random variable and $$Y=g(X)$$ (for some function) so the Y is also random variable, then:

$$E[Y]=\int_{-\infty}^\infty yf_Y(y)dy=\int_{-\infty}^\infty g(x)f_X(x)dx$$

Which is well known theorem.

Now, my problem is when i tried to define: $$E[g(X)|M]$$ where $$X$$ is random variable and M is an event.

Can I say that: $$E[g(X)|M]=\int_{-\infty}^\infty g(x)f_{X|M}(x|M)dx$$ Or that I need to assume $$Y=g(X)$$ and then:

$$E[g(X)|M]=E[Y|M]=\int_{-\infty}^\infty yf_{Y|M}(y|M)dy=\int_{-\infty}^\infty g(x)f_{Y|M}(g(x)|M)d(g(x))$$

Or that is even something else? Can you please explain how $$f_{Y|M}$$ is defined

maybe I didn't understand the second "theorem" The source for the second "theorem" (from PROBABILITY, RANDOM VARIABLES, AND STOCHASTIC PROCESSES, Athanasios Papoulis):

• Your second "theorem" implies that $\int yf(y)dy=\int g(y)f(y)dy$ for any function $g$. Does this seem plausible to you? – Mike Hawk Dec 13 '18 at 16:02
• @MikeHawk I will tell you the truth, I think it does not, but when reading it in the book I didn't find any limitation on $g$. I added the source. – Mr.OY Dec 13 '18 at 16:51
• You cannot ignore the subscripts in "$f_x$" (equation 5-55) and "$f_y$" (equation 5-54). – whuber Dec 13 '18 at 17:13
• @whuber I thought it was understood, but I edited it. can you please answer I define E[g(X)|M]? – Mr.OY Dec 13 '18 at 17:21
• When "$f$" appears on both sides of an equation but is intended to mean two different things, you are asking for confusion. I suspect that's at the root of what you're trying to ask. – whuber Dec 13 '18 at 17:25