## calculating expectation using conditional probability

Hello,

I am trying to calculate a simple expectation of the form E[h(X)], where X is the random variable, h is a function of X. Clearly it is equal to

E[h(X)] = Integral[h(x)*f(x)*dx]

(where f(x) is the PDF of X and integral is over x).

Now if we have a conditional PDF of X on Y of the form f_cond(x | Y = y), then we should have

f(x) = Integral[f_cond(x | Y = y)*g(y)*dy]

(where g(y) is PDF of Y and integral is over y)

Hence we will have the following expression for E[h(X)]:

E[h(X)] = Integral[h(x)*Integral[f_cond(x | Y = y)*g(y)*dy]*dx]

Is this correct? I think this is correct, but the reason I'm asking is that from a paper I've seen, there is no outer "dx" and no outer integral in the above expression.

Thanks.
p.s. I'm new to this forum, can someone please tell me how to type mathematical symbols, such as integration?