Deriving Conditional Expectations I am really stuck on deriving the basic conditional expectations equations.
First how does one prove this equation below?
$$
E[X\mid A] = \frac{E[X\mathbf{1}_A]}{P(A)}.
$$ 
Second, using the equation above how does one derive the the conditional expectations formula:
$$E(x|y)= \int_a^bx\frac{f(x,y)}{f(y)}dx$$
I can't seem to figure how to go from this step
$$
E(x|y)=E[X\mid A] = \frac{E[X\mathbf{1}_A]}{P(A)}=\frac{\int_{supp(z)}x\ \mathbf{1(y=y)}dx}{f(y)}.
$$ 
How does the indicator function dissapear and appear in the bounds of the intergration and then create the joint pdf $f(x,y)$ as in equation 1. Thank you.
 A: Most non-measure theory textbooks define conditional expectation in terms of a sum over a conditional mass function (for discrete cases) or an integral of a conditional density (for continuous cases).  
1)  Assuming $P[A]>0$, you can prove $E[X|A] = \frac{E[X 1_A]}{P[A]}$ according to the law of total expectation, from my above comment. 
2) If you assume $X$ takes values in the interval $[a,b]$, then we define: 
$$ E[X|Y=y] = \int_a^b x f_{X|Y=y}(x)dx = \int_a^b x \frac{f_{XY}(x,y)}{f_Y(y)}dy$$ 
where you can motivate the definition for the conditional 
PDF $f_{X|Y=y}(x) = \frac{f_{XY}(x,y)}{f_Y(y)}$ through various demonstrations, likely found in your textbook.  The difficulty, of course, is that the event $\{Y=y\}$ typically has probability 0, and so conditioning on such things is not obvious and needs to be defined separately.  
You can also motivate the above definition of $E[X|Y=y]$ according to a  demonstration similar to that given in your question (I will fix some of the issues with that demonstration below): Fix $y \in \mathbb{R}$ and $\delta>0$ and assume $P[Y \in [y, y+\delta]]>0$.  So for small $\delta>0$ we can imagine: 
\begin{align}
E[X|Y=y] &\approx E[X|Y \in [y, y+\delta]] \\
&= \frac{E[X 1_{Y \in [y, y+\delta]}]}{P[Y \in [y, y+\delta]]} \\
&= \frac{\int_{x=a}^b\int_{v=y}^{y+\delta} xf_{XY}(x,v)dxdv}{P[Y \in [y, y+\delta]]}  \\
&= \frac{\int_{x=a}^bx \left[\int_{v=y}^{y+\delta} f_{XY}(x,v)dv\right]dx}{P[Y \in [y, y+\delta]]}  \\
&\approx \frac{\int_{x=a}^b x[f_{XY}(x,y)\delta] dx}{f_Y(y)\delta}\\
&=\frac{\int_a^b xf_{XY}(x,y)dx}{f_Y(y)}
\end{align} 
A: I think you are missing a point in your question: Conditional expectation is not a formula; it is a random variable charing the same probability space. This mean that your conditional expectations formula is wrong. I don't want to bore you, so, you can find correct formulas (deppending on what kind of variable you have) at Computation section in Conditional expectation - Wikipedia. In more general cases you should use measure theory, David Williams, Probability with Martingales is a nice start in that case.
A: This isn't a proof (see the comments to your question, and Michael's answer for details on that), but let me give a heuristic argument for why you should expect that
$$ \operatorname{E} [X \vert A] = \frac{\operatorname{E} [X \mathbf{1}_A]}{\operatorname{P}(A)} $$
I know this isn't exactly what you're asking for, but what I give below might hopefully still be at least somewhat enlightening.
Recall from Bayes' rule that, when $A$ and $B$ are events,
$$ \operatorname{P} (B \vert A) = \frac{\operatorname{P}(B \cap A)}{\operatorname{P} (A)} $$
Notice also that when $X = \mathbf 1_B$, 
$$\operatorname{E}[X] = \operatorname{E}[\mathbf 1_B] = \operatorname{P}(B)$$
Given that $\mathbf 1_{B \cap A} = \mathbf 1_B \mathbf 1_A $, we can write the conditional probability above as
$$ \operatorname{P} (B \vert A) = \frac{\operatorname{E}[\mathbf 1_B \mathbf 1_A]}{\operatorname{P} (A)} $$
If we again let $X=\mathbf 1_B$, and by analogy with the fact that probabilities of events are expectations of indicator functions for those events, we can define the conditional expectation of indicator functions:
$$ \operatorname{E}[X \vert A] =\frac{\operatorname{E}[X \mathbf 1_A]}{\operatorname{P}(A)} = \operatorname{P} (B \vert A)$$
Using the linearity of expectation, we can extend the above definition to the so-called simple functions which are constant on finitely many events:
$$ X = \sum_{i=1}^n a_i \mathbf 1_{B_i} $$
Hence,
$$ \operatorname{E}[X \vert A] = \frac{\operatorname{E}[X \mathbf 1_A]}{\operatorname{P}(A)} = \sum_{i=1}^n a_i \operatorname{P} (B_i \vert A) $$
What about more general random variables? 
It turns out that almost all random variables of interest can be approximated by simple functions. Hence, to take the conditional expectation of those, we can first find a sequence of increasingly accurate approximations via simple functions. We know how to find the conditional expectation of each of those approximations. The limit of these approximations is then the conditional expectation of the random variable.
(I know I've glossed over a lot of detail in the previous paragraph. However, if you know a little measure theory, the previous construction along with the details should be familiar. If you don't, I don't think the details are going to be particularly helpful.)
