# Latest content was relocated to https://bintanvictor.wordpress.com. This old blog will be shutdown soon.

## Thursday, November 6, 2014

### conditional expectation within a range

There are many conditional expectation questions asked in interviews and quizzes. Here's the simplest and arguably most important variation -- E[X | a< X < b] (let's  denote it as y)  where a and b are constant bounds.

The formula must have a probability denominator. Without it, the integral

"integrate from a to b ( x f(x) dx)" i.e. could be a very low number much smaller than the lower bound "a". If this were y, then the conditional expectation of X would be lower than the lower bound!
This integral is also written as E[X a<X<b]. Notice the ";" replacing "|" the pipe.

Let's be concrete. Suppose X ~ N(0,1), 22<X<22.01. The conditional expectation must lie between the two bounds, something like 22.xxx. But we can make the integral value as small as we want (like 0.000123), by shrinking the region [a,b]. Clearly the integral value cannot equal the conditional expectation.

What's the meaning of the integral value 0.000123? It's  the regional contribution to the unconditional expectation.

Analogy -- Pepsi knows the profit earned on every liter sold. X is the profit margin for each sale. The g(X=x) is the quantity sold at that profit margin x. Integrating g(x) alone from 0 to infinity would give the total quantity sold. The integral value 0.000123 is the profit contributed by those sales with profit margin around 22.

This "regional contribution" profit divided by the "regional" volume sold would be the average profit per liter in this "region". In our case since we shrink the region [22, 22.01] so narrow, average is nearly 22. For another region [22, 44], average could be anywhere between the two bounds.