On this page
8.3 Expected Value
In an attempt to summarize the behavior of a random variable, we will study a measure that studies the central tendency of the random variable, called expectation or expected value of a random variable. To illustrate the various moments in which we deal with expected value, we will present some examples.
Example 3.1
In a restaurant, when we order our food and ask the waiter how long it will take to be ready, he will provide us with an expected value, that is, the average time the food should take to be ready.
Example 3.2
When we are at a bus stop and we ask the person next to us how long it will take until the next bus comes, she will promptly give us the expected value, which she was able to verify after some time of experience.
In the examples above, the waiter and the person waiting at the bus stop summarized all the information from a model into a single number, the expected value. In this section we will study how to obtain the hope or expected value of a random variable, we will study some of its properties, and also the moment generating function, responsible for generating all the central limits.
8.3.1 Expected value of discrete random variables and discrete vectors
Definition 3.1.1
Be $ X $ a discrete random variable that takes on the values $ (x_1,x_2,\ldots) $and be $ p(x) $ the probability function of $ X $, that is, $ p(x_i) = \mathbb{P}(X = x_i) $. So, the expected value of $ X $, also called hope of $ X $ and denoted by $ \mathbb{E}(X) $ or $ \mu_X $, is defined by
$$\mathbb{E}(X)= \mu_X=\sum_{i=1}^\infty x_i p(x_i) = \sum_{i=1}^\infty x_i\mathbb{P}(X = x_i).$$
This number is also called the average value or expectation of $ \mathbb{E}(X) $ is only defined if the series above is absolutely convergent, that is, if
$$\mathbb{E}(X)=\sum_{i=1}^{\infty} |x_i| \mathbb{P}(X=x_i) \ < \ \infty.$$
Note 3.1.1
Se $ X $ taking only a finite number of values, the above expression becomes $ \mathbb{E}(X)=\sum_{i=1}^n x_i\mathbb{P}(X=x_i) $. In this case, the expected value can be considered as a weighted average of the possible values $ x_1,x_2,\ldots,x_n $. If all these possible values are equiprobable, $ \mathbb{E}(X)=\frac{1}{n}\displaystyle\sum_{i=1}^n x_i $, which represents the simple arithmetic mean of the n possible values.
Example 3.1.1
Let’s consider the roll of a balanced dice. Let us consider the random variable $ X = \ \text{``número da face voltada para cima} $. Calculate the expected value of $ X $.
We know that the possible values of $ X $ are $ (1, 2, 3, 4, 5, 6) $ and that these values are equiprobable. Like this,
$$\mathbb{E}(X)=\frac{1}{6}(1+2+3+4+5+6)=\frac{7}{2}.$$
Note 3.1.2
This example clearly illustrates that $ \mathbb{E}(X) $ is not the result we can expect when $ X $ is observed only once. In fact, we have to $ \mathbb{E}(X) = 7/2 $ nor is it a possible value of $ X $. This value actually means that if we rolled the dice a large number of times and then calculated the arithmetic average of the various results, we would expect this average to be close to 7/2 and the greater the number of times the dice was rolled, the closer the arithmetic average would be to 7/2.
Given $ X $ a discrete random variable taking values in $ \mathcal{R}_X=(x_1, x_2, \cdots ) $ and with distribution function $ p_X $. Be $ g: \Bbb{R} \rightarrow \Bbb{R} $ a real function. The random variable $ Y=g(X) $ has a distribution function given by
$$ p_Y (y) = \mathbb{P} [ Y = y] = \sum_{(x \in \mathcal{R}_X:g(x) = y)}\mathbb{P}[X=x]. $$
Thus, we obtain the following result.
Theorem 3.1.1
Be $ X $ a discrete random variable that takes on values in $ \mathcal{R}_X $ with probability function $ p(x) $ and $ g: \mathbb{R} \rightarrow \mathbb{R} $ a function. We then have to
$$\mathbb{E}[g(X)]= \sum_{x_i\in\mathcal{R}_X}g(x_i)p(x_i) = \sum_{x_i\in\mathcal{R}_X}g(x_i)\mathbb{P}(X=x_i).$$
In fact, considering the random variable $ Y $ given by $ Y=g(X) $, we have to
$$\mathbb{E}(Y)=\sum_{y\in\mathcal{R}_Y} y \mathbb{P}(Y = y) =\sum_{y\in\mathcal{R}_Y} \sum_{(x:g(x)=y)}g(x) \mathbb{P}(X = x)$$
from which we conclude that
$$\mathbb{E}[g(X)] = \sum_{i=1}^{n}g(x_i)\mathbb{P}(X = x_i)$$
Example 3.1.2
Be $ X $ a random variable with probability distribution given in the table below:
| $ X $ | -2 | -1 | 0 | 1 | 2 |
|---|---|---|---|---|---|
| $ \mathbb{P}(X = x) $ | 1/5 | 1/5 | 1/5 | 1/5 | 1/5 |
and be $ g(X)=X^{2} $. Let’s calculate the expected value of $ X $ and of $ g(X) $.
The expected value of $ X $ is given by
$$\mathbb{E}(X)= \sum_{i=1}^{5}x_i \mathbb{P}(X = x_i)=-2\frac{1}{5}-1\frac{1}{5}+0\frac{1}{5}+1\frac{1}{5}+2\frac{1}{5}=0.$$
To calculate the expectation of $ g(X) $, there are two possibilities: using Theorem 3.1.1 or through the traditional way, that is, finding the probability distribution of the variable $ Y = g(X) $. Through Theorem 3.1.1 we have that:
$$\mathbb{E}[g(X)]=\sum_{i=1}^{5}g(x_i)\mathbb{P}(X = x_i)=(-2)^2\frac{1}{5}-1^2\frac{1}{5}+0^2\frac{1}{5}+1^2\frac{1}{5}+2^2\frac{1}{5}=2.$$
For the calculation using the traditional way, we must initially find the probability distribution of $ g(X) $, which is given by
| $ g(X) $ | 0 | 1 | 4 |
|---|---|---|---|
| $ \mathbb{P}(g(X) = g(x)) $ | 1/5 | 2/5 | 2/5 |
and then, we have to
$$\mathbb{E}[g(X)]=\sum_{i=1}^{3} g(x_i)\mathbb{P}(g(X) = g(x_i))= 0\frac{1}{5}+1\frac{2}{5}+4\frac{2}{5}=2.$$
Example 3.1.3
A food industry is participating in three public tenders, with possible profits of 30, 50 and 60 thousand reais, respectively. If the probability of this industry winning the bids is 0.3; 0.7 and 0.2 respectively, what is the expected profit value of this industry?
In this case, we simply apply the definition of expected value directly, that is:
$$\mathbb{E}(X)=0,3~\cdot ~ 30 + 0,7~ \cdot ~50 + 0,2~ \cdot~ 60=56.$$
Thus, the expected value of this industry’s profit in bidding is 56 thousand reais.
Expected value and functions of discrete random vectors

$$\mathbb{P}\left[W=w\right]=\mathbb{P}\left[(X,Y) \in B_w\right],$$

Definition 3.1.2

$$\mathbb{E}[g(\widetilde{Z})]=\sum_{x\in\mathcal{R}_X}\sum_{y\in\mathcal{R}_Y}g(x,y)p(x,y) = \sum_{x\in\mathcal{R}_X}\sum_{y\in\mathcal{R}_Y}g(x,y)\mathbb{P}(X = x; Y = y).$$
Note 3.1.3
Definition 3.1.2 above can be generalized to the case where we have an n-dimensional random vector.
Definition 3.1.3
Be $ \widetilde{Z} = (X,Y) $ a discrete two-dimensional random vector, $ p(x,y) $ the joint probability function of $ \widetilde{Z} $ and $ p_{X}(x) $ and $ p_{Y}(y) $ the marginal probability functions of the variables $ X $ and $ Y $ respectively. So, we have the expected value of the variables $ X $ and $ Y $ are given by
$$\mathbb{E}(X) = \sum_{x\in\mathcal{R}_X}xp_X(x) \quad \text{e} \quad \mathbb{E}(Y) = \sum_{y\in\mathcal{R}_Y}yp_Y(y).$$
Furthermore, we have that the expected value of the random vector $ \widetilde{Z} $ is given by
$$\mathbb{E}(\widetilde{Z}) = (\mathbb{E}(X),\mathbb{E}(Y))$$
Example 3.1.4
Suppose a machine is used for a certain task in the morning and for another task in the afternoon. Suppose that the number of times the machine presents a problem in the morning and in the afternoon are represented, respectively, by random variables $ X $ and $ Y $ with joint probability function.
| X\Y | 0 | 1 | 2 | $ p_X(x) $ |
|---|---|---|---|---|
| 0 | 0,1 | 0,2 | 0,2 | 0,5 |
| 1 | 0,04 | 0,08 | 0,08 | 0,2 |
| 2 | 0,06 | 0,12 | 0,12 | 0,3 |
| $ p_Y(y) $ | 0,2 | 0,4 | 0,4 | 1 |
In this case, we have to
$$\mathbb{E}(X) = \sum_{x\in\mathcal{R}_X}xp_X(x) = 0\cdot 0,5 + 1 \cdot 0,2 + 2\cdot 0,3 = 0,8.$$
$$\mathbb{E}(Y) = \sum_{y\in\mathcal{R}_Y}yp_Y(y) = 0\cdot 0,2 + 1 \cdot 0,4 + 2\cdot 0,4 = 1,2.$$
Where does it follow that $ \mathbb{E}(\widetilde{Z}) = (\mathbb{E}(X),\mathbb{E}(Y)) = (0,8;1,2) $.
Be $ g(X,Y) = XY $. Then the expected value of $ g(X,Y) $ is given by
$$\mathbb{E}(g(X,Y)) = 0\cdot 0\cdot p(0,0) + 0\cdot 1\cdot p(0,1) + \ldots + 2\cdot 2\cdot p(2,2) = 0,96.$$
Note that in this example, for all $ (x,y)\in\mathcal{R}_X\times\mathcal{R}_Y $, we have to $ p(x,y) = p_X(x)\cdot p_Y(y) $ and therefore, from Corollary 2.5.2 we conclude that $ X $ and $ Y $ are independent.
8.3.2 Expected value of continuous random variables and continuous vectors
Definition 3.2.1
Be $ X $ a continuous random variable with probability density function $ f(x) $. We define the expected value or mathematical expectation or average $ X $ by
$$\mathbb{E}(X)=\int_{-\infty}^{\infty}xf(x) dx,$$
as long as the integral is well defined.
Note 3.2.1
- If the variable is limited, the calculation is done without ambiguity and the existence of the expected value is assured. In the non-limited case, undefined situations of the type $ \infty-\infty $, in which we will say that hope does not exist. So, we have to $ \mathbb{E}(X) $ will be well defined if the integral, in at least one of these intervals, is finite; this is
$$\int_{-\infty}^0 xf(x)dx \ < \ \infty \qquad \text{e} \qquad \int_0^\infty xf(x)dx \ < \ \infty.$$
-
The interpretation of $ \mathbb{E}(X) $ for the continuous case it is similar to that mentioned for discrete random variables.
-
Se $ g:\mathbb{R}\rightarrow\mathbb{R} $ is a measurable function, so $ \mathbb{E}(g(X))=\int_{-\infty}^{\infty}g(x)f(x)dx. $
Example 3.2.1
Be $ X $ the time (in minutes) during which electrical equipment is used at maximum load within a specified period of time. So, $ X $ is a continuous random variable and its pdf is given by

Calculate the expected value of $ X $.
$$\mathbb{E}(X)=\int_{-\infty}^\infty xf(x)dx=\frac{1}{(1500)(1500)}\left[ \int_0^{1500} x^2dx-\int_ {1500}^{3000} x(x-3000)dx\right]=1500 \ \hbox{minutos}.$$
Example 3.2.2
Let the density function of a random variable be $ X $ given by


Find the expected value of $ X $.
By definition 3.2.1, we have that:
$$\mathbb{E}(X)=\int_{-\infty}^{\infty}xf(x) dx=\int_{0}^{2}xf(x)=\int_{0}^{2}\frac{1}{2}x^2=\frac{4}{3}.$$
So $ \mathbb{E}(X)=4/3 $.
Example 3.2.3
Be $ X $ a random variable with a probability density function given by:


Find the expected value of the random variable $ X $.
$$\mathbb{E}(X)= \int_{-\infty}^{\infty}xf(x) dx=\int_{0}^{\infty}6xe^{-6 x}dx=6\int_{0}^{\infty}xe^{-6x}dx.$$
Solving the integral by parts we conclude that
$$6\left[\frac{xe^{-6 x}}{-6}-\int_{0}^{\infty} \frac{e^{-6 x}}{-6}dx \right]=6 \left[ \frac{xe^{-6 x}}{-6}- \frac{e^{-6 x}}{36} \right]^{\infty}_{0}= \frac{1}{6}$$
Example 3.2.4
Be $ X $ a random variable with a density function given by

Find the expected value of the random variable $ X $ and of $ X^2 $
$$\mathbb{E}(X)=\int_{-\infty}^{\infty}xf(x) dx=\int_{0}^{\infty}x\lambda e^{-\lambda x}dx=\lambda\int_{0}^{\infty}xe^{-\lambda x}dx$$
Solving the integral by parts we conclude that
$$\lambda\left[\frac{xe^{-\lambda x}}{-\lambda}-\int_{0}^{\infty}\frac{e^{-\lambda x}}{-\lambda}dx \right]=\lambda \left[ \frac{xe^{-\lambda x}}{-\lambda}- \frac{e^{-\lambda x}}{\lambda^2} \right]^{\infty}_{0}=\frac{1}{\lambda}.$$
Now we calculate the expected value of $ X^2 $ using item 3 of Note 3.2.1.
$$\mathbb{E}(X^2)=\int_{-\infty}^{\infty}g(x)f(x)dx=\int_{0}^{\infty}x^2\lambda e^{-\lambda x}dx.$$
Solving the integral by parts, we obtain that
$$\lambda \int_{0}^{\infty}x^2 \lambda e^{-\lambda x} dx = \lambda \left[x^2\frac{e^{-\lambda x}}{-\lambda}-2x \frac{e^{-\lambda x}}{\lambda^2}+ 2\frac{e^{-\lambda x}}{-\lambda^3} \right]_{0}^{\infty}=\frac{2}{\lambda^2}.$$
Example 3.2.5
Be $ X $ a random variable with probability density function given below


Determine the expected value of $ X $.
$$\mathbb{E}(X)= \frac{4}{81}\int_{0}^{3}x^2 (9-x^2)dx=\frac{8}{5}.$$
Expected value and functions of continuous random vectors
Definition 3.2.2
Be $ \widetilde{Z} = (X,Y) $ a continuous two-dimensional random vector, $ f(x,y) $ the joint probability density function of $ \widetilde{Z} $ and $ f_X(x) $ and $ f_Y(y) $ the marginal probability density functions of $ X $ and $ Y $ respectively. So, we have the expected value of the random variables $ X $ and $ Y $ are given by
$$\mathbb{E}(X) = \int_{-\infty}^{\infty}xf_X(x)dx \quad \text{e} \quad \mathbb{E}(Y) = \int_{-\infty}^{\infty}yf_Y(y)dy.$$
Furthermore, we have that the expected value of the two-dimensional random vector $ \widetilde{Z} $ is given by
$$\mathbb{E}(\widetilde{Z})=(\mathbb{E}(X),\mathbb{E}(Y)).$$
Definition 3.2.3
Be $ \widetilde{Z} = (X,Y) $ a continuous two-dimensional random vector, $ f(x,y) $ the joint probability density function of $ \widetilde{Z} $ and $ g:\mathbb{R}^2\rightarrow\mathbb{R} $ a real measurable Borel function. So, we define the expected value of the random variable $ g(\widetilde{Z}) $ by
$$\mathbb{E}[g(\widetilde{Z})] = \mathbb{E}[g(X,Y)] = \int_{-\infty}^{\infty}\int_{-\infty}^{\infty}g(x,y)f(x,y)dxdy.$$
Note 3.2.2
Definitions 3.2.2 and 3.2.3 above can be generalized to the n-dimensional case in a natural way.
Example 3.2.6
Two characteristics of a rocket engine’s performance are thrust ($ X $) and the mixing rate ($ Y $). Suppose $ (X,Y) $ be a continuous two-dimensional random variable with joint probability density function given by

In this case, we have the marginal probability density functions of $ X $ and $ Y $ are given respectively, by
$$f_X(x)=\int_{-\infty}^{\infty}f(x,y)dy=\int_0^12(x+y-2xy)dy = 2\left(xy+\frac{y^2}{2}-xy^2\right)\big|_0^1 = 1, \ \text{se} \ 0\leq x\leq 1.$$
That is,

and
$$f_Y(y)=\int_{-\infty}^{\infty}f(x,y)dx=\int_0^12(x+y-2xy)dx = 2\left(\frac{x^2}{2}+xy-x^2y\right) \big|_0^1 = 1, \ \text{se} \ 0\leq y\leq 1.$$
That is,

Therefore, we conclude that
$$\mathbb{E}(X) = \int_{-\infty}^{\infty}xf_X(x)dx = \int_0^1xdx = \frac{1}{2} \quad \text{e} \quad \mathbb{E}(Y) = \int_{-\infty}^{\infty}yf_Y(y)dy = \int_0^1ydy = \frac{1}{2}.$$
Se $ \widetilde{Z} = (X,Y) $ it then follows that
$$\mathbb{E}(\widetilde{Z}) = (\mathbb{E}(X),\mathbb{E}(Y)) = \left(\frac{1}{2},\frac{1}{2}\right).$$
8.3.3 Expected value properties
In this section, we will look at some important properties of the expected value of a random variable. In each case, we assume that all the expected values mentioned exist.
P1. Se $ X=c $ with $ c $ a real constant, then $ \mathbb{E}(X)=c $.
In fact, if $ X $ is a discrete random variable, we have
$$\mathbb{E}(X) =\sum_{\mathcal{R}_X}x\mathbb{P}(X=x) = c\mathbb{P}(X=c) = c\cdot 1=c$$
P2. Be $ c $ a real constant and $ X $ a random variable. So,
$$\mathbb{E}(cX) = c\mathbb{E}(X)$$
In fact, in the discrete case we have
$$\mathbb{E}(cX)=\sum_{x\in\mathcal{R}_X}cx\mathbb{P}(X = x)=c\sum_{x\in\mathcal{R}_X}x\mathbb{P}(X = x)= c\mathbb{E}(X).$$
Similarly, we have in the continuous case, which
$$\mathbb{E}(cX)=\int_{-\infty}^{\infty}cxf(x)dx=c\int_{-\infty}^{\infty}xf(x)dx=c\mathbb{E}(X)$$
P3. Be $ X $ and $ Y $ any two random variables. Then,
$$\mathbb{E}(X + Y) = \mathbb{E}(X) + \mathbb{E}(Y).$$
In fact, in the discrete case, consider $ p(x,y) $ the joint probability function and $ p_X(x) $ and $ p_Y(y) $ the marginal probability functions of $ X $ and $ Y $ respectively. So, we have to
$$\mathbb{E}(X+Y)=\sum_{y\in\mathcal{R}_Y}\sum_{x\in\mathcal{R}_X}(x+y)p(x,y)=\sum_{x\in\mathcal{R}_X}\sum_{y\in\mathcal{R}_Y}xp(x,y)+\sum_{y\in\mathcal{R}_Y}\sum_{x\in\mathcal{R}_X}yf(x,y)$$
whence it follows that
$$\mathbb{E}(X+Y)\sum_{x\in\mathcal{R}_X}xp_X(x) +\sum_{y\in\mathcal{R}_Y}yp_Y(y).$$
Therefore, we conclude that
$$\mathbb{E}(X+Y)=\mathbb{E}(X)+\mathbb{E}(Y).$$
Se $ X $ and $ Y $ are continuous random variables, consider $ f(x,y) $ the joint probability density function and $ f_X(x) $ and $ f_Y(y) $ the marginal probability density functions of $ X $ and $ Y $ respectively. So
$$\mathbb{E}(X+Y)=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}(x+y)f(x,y)dxdy=\int_{-\infty}^{\infty}x\left(\int_{-\infty}^{\infty}f(x,y)dy\right)dx+\int_{-\infty}^{\infty}y\left(\int_{-\infty}^{\infty}f(x,y)dx\right)dy.$$
i.e.
$$\mathbb{E}(X+Y)=\int_{-\infty}^{\infty}xf_X(x,y)dx+\int_{-\infty}^{\infty}yf_Y(x,y)dy=\mathbb{E}(X)+\mathbb{E}(Y)$$
demonstrating the result.
P4. Be $ n $ random variables $ X_1,\ldots,X_n $. So,
$$\mathbb{E}(X_1+X_2+\ldots+X_n)=\mathbb{E}(X_1)+\mathbb{E}(X_2)+\ldots+\mathbb{E}(X_n).$$
The demonstration of this case is similar to the previous one. Just make an induction on $ n $.
P5. Be $ X $ and $ Y $ independent random variables. So,
$$\mathbb{E}(XY) = \mathbb{E}(X)\mathbb{E}(Y).$$
In fact, suppose that $ X $ and $ Y $ are independent random variables with a joint probability function $ p(x,y) $ for the discrete case or joint probability density function $ f(x,y) $ for the continuous case. As, hypothetically, $ X $ and $ Y $ are independent, we have from Theorem 3.1.2 that
$$p(x,y) = p_X(x) \cdot p_Y(y)$$
in the discrete case and from Theorem 3.2.1 that
$$f(x,y) = f_X(x)\cdot f_Y(y)$$
in the continuous case. In this way, if $ X $ and $ Y $ are independent discrete random variables, we have
$$\mathbb{E}(XY)=\sum_{x\in\mathcal{R}_X}\sum_{y\in\mathcal{R}_Y}xyp(x,y)= \sum_{x\in\mathcal{R}_X}\sum_{y\in\mathcal{R}_Y}xyp_X(x)p_Y(y)= \sum_{x\in\mathcal{R}_X}xp_X(x)\sum_{y\in\mathcal{R}_Y}yp_Y(y)$$
whence it follows that
$$\mathbb{E}(XY)=\mathbb{E}(X)\mathbb{E}(Y).$$
Similarly, for the continuous case, we have
$$\mathbb{E}(XY)=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}xyf(x,y)dxdy=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}xyf_X(x)f_Y(y)dxdy$$
i.e.
$$\mathbb{E}(XY)=\int_{-\infty}^{\infty}xf_X(x)\left(\int_{-\infty}^{\infty}yf_Y(y)dy\right)dx=\mathbb{E}(X)\mathbb{E}(Y).$$
thus demonstrating the result.
P6 (Jensen Inequality). Be $ f:\mathbb{R}\rightarrow\mathbb{R} $ a convex function and $ X $ an integrable random variable, that is, $ E(X)\leq \infty $. So we have to
$$\mathbb{E}(f(X))\geq f(\mathbb{E}(X)).$$
We emphasize that a function is said to be convex if its graph is convex, that is, given any points $ a,b\in \mathbb{R} $ the line that passes through the ordered pairs $ (a,f(a)) $ and $ (b,f(b)) $ does not intersect the graph $ f $ at no point in the range $ (a,b) $.
An equivalent definition would be that for any $ x, y \in [a,b] $ and for everyone $ t\in [0,1] $ we have to:
$$f(tx+(1-t)y)\leq tf(x)+(1-t)f(y)$$
In fact if $ f $ is a convex function so given an ordered pair $ (y,f(y)) $ on the graph of $ f $, we have that there is a straight line $ r $ such that the line passes through the point $ (y,f(y)) $ and leave the curve $ f $ all above it, that is, there is a $ \lambda\in\mathbb{R} $ such that $ r(x)=\lambda(x-y)+f(y) $.
So we have to
$$f(x)\geq r(x)=\lambda(x-y)+f(y),~~~\forall x \in\mathbb{R}.$$
Therefore, if we apply the expected value on both sides we obtain:
$$\mathbb{E}(f(X))\geq \mathbb{E}(r(X))=f(y)+\lambda(\mathbb{E}(X)-y).$$
And, taking $ y=\mathbb{E}(X) $, the result follows.
Theorem 3.3.1
Let X be a random variable, $ \varphi(x) $ a real measurable function. So
$$\mathbb{E}(\varphi(X))=\int y dF_{\varphi(X)}(y)=\int \varphi(x)dF_X(x),$$
in which the existence of one of the integrals implies the existence of the other and the equality of the two.
Example 3.3.1
We say that the distribution of X is symmetric (around zero) if $ \mathbb{P}(X\geq x)=\mathbb{P}(X\leq -x) $ for everyone $ x\in \mathbb{R} $, and that its distribution is symmetric around $ \mu $ if
$$\mathbb{P}(X\geq \mu +x)=\mathbb{P}(X\leq \mu -x) \forall x \in \mathbb{R}$$
(a) Prove: If the distribution of X is symmetric about $ \mu $ and if X is symmetric about $ \mu $ and if X is integrable, then $ \mathbb{E}(X)=\mu $
Firstly, we will prove $ \mu=0 $. Se $ \mu=0 $ This implies that X is integrable and has a symmetric distribution at zero, which implies that
$$\mathbb{P}(X\geq 0)=\mathbb{P}(X\leq -x)$$
which implies that
$$(1-F_X(x))=F_X(-x)$$
Then we have to
$$\mathbb{E}(X)=\int_0^\infty (1-F_X(x))dx-\int_{-\infty}^0 F_X(x)dx$$
Making a change of variable we have
$$\mathbb{E}(X)=\int_0^\infty (1-F_X(x))dx-\int_{0}^\infty F_X(-x)dx=0$$
Now, for $ \mu\neq 0 $, we have to $ X $ is integrable and has a symmetric distribution in $ \mu $, that is,
$$\mathbb{P}(X\geq \mu+x)=\mathbb{P}(X\leq \mu - x), \quad \quad \forall x\in \mathbb{R}$$
Thus, we define $ Y=X-\mu $ then $ Y\leq X $, and since X is integrable it implies that Y is integrable, since
$ Y=X-\mu $ what does it imply
$$|X|-\mu \leq |X-\mu|=|Y|=|X-\mu|\leq |X|+\mu$$
Now $ Y $ is symmetric at zero, since
$$\mathbb{P}(Y\geq y)=\mathbb{P}(X-\mu \geq y)=\mathbb{P}(X\geq \mu +y)=\mathbb{P}(X\leq \mu-y)=\mathbb{P}(X-\mu\leq -y)=\mathbb{P}(Y\leq -y)$$
So, in the case where $ \mu=0 $ we have to $ \mathbb{E}(Y)=0 $.
(b) Suppose that X has density $ f(x) $. Show that if $ f(\mu+x)=f(\mu-x) $$ \forall x $, then the distribution of X is symmetric about $ \mu $. State and prove the analogous property for the discrete case.
$$\mathbb{P}(X\geq \mu +x)=\int_{\mu+x}^\infty f_X(x)dx$$
Making a variable change $ y=2\mu-x $ and $ dy=-dx $, we have to
$$\int_{\mu+x}^\infty f_X(x)dx=-\int_{\mu-x}^{-\infty} f_X(2\mu+y)dy=\int_{-\infty}^{\mu-x}f_X(2\mu+y)dy=\int_{-\infty}^{\mu-x}f_X(y)dy=\mathbb{P}(X\leq \mu +x)$$
Discrete Case: Suppose that X has a probability function $ p $. Show that if
$$\mathbb{P}(\mu+x)=\mathbb{P}(\mu-x), \quad \quad \forall x$$
then the distribution of X is symmetric about $ \mu $.
$$\mathbb{P}(X\geq \mu +x)=\sum_{\mu+x}^\infty \mathbb{P}(x)$$
taking $ y=\mu-x $ we have to
$$\sum_{\mu+x}^\infty \mathbb{P}(x)=\sum_{-x}^{-\infty} \mathbb{P}(\mu-y)=\sum_{-\infty}^{-x}\mathbb{P}(\mu+y)=\sum_{-\infty}^{\mu-x}\mathbb{P}(X)=\mathbb{P}(X\leq \mu-x)$$
and the result follows.
(c) What is the point of symmetry of the distributions of the following random variables? Give the expectation of each random variable, if it exists.
(i) $ X\sim N(\mu,\sigma^2) $.
We have to
$$f(x)=\frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{1}{2\sigma^2}(x-\mu)^2}, \quad \quad x\in \mathbb{R}$$
we have to:
$$f(\mu-x)=\frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{1}{2\sigma^2}(\mu-x-\mu)^2}=\frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{1}{2\sigma^2}x^2}, \quad \quad x\in \mathbb{R}$$
and
$$f(\mu+x)=\frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{1}{2\sigma^2}(\mu+x-\mu)^2}=\frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{1}{2\sigma^2}x^2}, \quad \quad x\in \mathbb{R}$$
by part (b) X is symmetric about $ \mu $.
$$\mathbb{E}(X)=\int_{-\infty}^\infty x \frac{1}{\sigma \sqrt{2\pi}}e^{-\frac{1}{2\sigma^2}(x-\mu)^2}$$
taking $ y=\frac{x-\mu}{\sigma} $ and $ x=\sigma y +\mu $ and $ dx=\sigma dy $ then
$$\mathbb{E}(X)=\int_{-\infty}^\infty (\sigma y+\mu)\frac{1}{\sigma \sqrt{2\pi}}e^{-\frac{1}{2}y^2}\sigma dy= \frac{\sigma}{\sqrt{2 \pi}}\int_{-\infty}^\infty y e^{-\frac{1}{2}y^2}dy+\mu \int_{-\infty}^\infty \frac{1}{\sqrt{2\pi}}e^{-\frac{1}{2}y^2}dy= \frac{\sigma}{\sqrt{2\pi}}\left[-e^{-\frac{1}{2}y^2}\right]_{-\infty}^{\infty}+\mu=\mu$$
(ii)$ X\sim Cauchy(M,b) $ i.e., $ f(x)=\frac{b}{\pi[b^2+(x-M)^2]}, \quad \quad x \in \mathbb{R} $
$$f(M-x)=\frac{b}{\pi[b^2+(M-x-M)^2]}=\frac{b}{\pi(b^2+x^2)}$$
and
$$f(M+x)=\frac{b}{\pi[b^2+(M+x-M)^2]}=\frac{b}{\pi(b^2+x^2)}$$
then by part (b) X is symmetric in M.
$$\mathbb{E}(X)=\int_{-\infty}^\infty x\frac{b}{\pi[b^2+(x-M)^2]}dx$$
taking $ y=x-M $, $ x=y+M $ and $ dx=dy $ then we have to
$$\mathbb{E}(X)=\frac{2}{\pi}\int_{-\infty}^\infty (y+M)\frac{b}{b^2+y^2}dy=\frac{b}{\pi}\int_0^{\infty}\frac{2y}{b^2+y^2}dy+\frac{2bM}{\pi}\int_{0}^\infty \frac{1}{b^2+y^2}dy$$
so, we have to
$$\frac{b}{\pi}\int_0^{\infty}\frac{2y}{b^2+y^2}dy+\frac{2bM}{\pi}\int_{0}^\infty \frac{1}{b^2+y^2}dy=\frac{b}{\pi}\lim_{a\rightarrow \infty}\left(\ln(b^2+y^2)\right)_0^\infty+\frac{2bM}{\pi}\left[\frac{1}{\pi}arctg\left(\frac{M}{b}\right)\right]_0^\infty= 0$$
(iii)$ X\sim U[a,b] $

So,
$$\mathbb{E}(X)=\int_{-\infty}^\infty x f_X(x)dx=\int_a^b\frac{x}{b-a}dx=\frac{1}{b-a}\left[\frac{x^2}{2}\right]^b_a=\frac{1}{2}\frac{b^2-a^2}{(b-a)}=\frac{a+b}{2}$$
(iv)$ X \sim b\left(n, \frac{1}{2}\right) $
$$\mathbb{P}(x)=\binom{n}{x}\left(\frac{1}{2}\right)^2, x=0,1,2, \dots, n-1,n.$$
Now, we have to
$$\mathbb{P}\left(x+\frac{n}{2}\right)=\binom{n}{x+\frac{n}{2}}\left(\frac{1}{2}\right)^n$$
$$\mathbb{P}\left(-x+\frac{n}{2}\right)=\binom{n}{-x+\frac{n}{2}}\left(\frac{1}{2}\right)^n$$
which are the same because $ x+\frac{n}{2}=n-\left(x-\frac{n}{2}\right) $. X is integrable, since $ 0\leq X \leq n $, then for item (a):
$$\mathbb{E}(X)=\frac{n}{2}$$
(v) X such that $ F_X $ It’s a singer’s job
By construction X is symmetric about $ \frac{1}{2} $ and how limited it is $ 0\leq \mathbb{E}(X)\leq 1 $ which implies that $ \mathbb{E}(X)=\frac{1}{2} $
(vi) X having Laplace (or double exponential) distribution:
$$f(x)=\frac{\lambda}{2}e^{-\lambda |x-\mu|}, \quad x \in \mathbb{R}$$
We have to
$$f(\mu -x)=\frac{\lambda}{2}e^{-\lambda |\mu-x-\mu|}=\frac{\lambda}{2}e^{-\lambda |x|}, \quad x \in \mathbb{R}$$
and
$$f(\mu+ x)=\frac{\lambda}{2}e^{-\lambda |\mu+x-\mu|}=\frac{\lambda}{2}e^{-\lambda |x|}, \quad x \in \mathbb{R}$$
That is, it is symmetric about $ \mu $.
Now
$$\mathbb{E}(X)=\int_{-\infty}^\infty x \frac{\lambda}{2}e^{-\lambda |x-\mu|}dx$$
defining $ x-\mu=y $, $ x=y+\mu $ and $ dx=dy $ we have
$$\mathbb{E}(X)=\int_{-\infty}^\infty (y+\mu) \frac{\lambda}{2}e^{-\lambda |y|}dy= \int_{-\infty}^0 (y+\mu) \frac{\lambda}{2}e^{-\lambda |y|}dy +\int_{0}^\infty (y+\mu) \frac{\lambda}{2}e^{-\lambda |y|}dy = \mu$$
Example 3.3.2
Let X be a random variable having logistic distribution with density
$$f(x)=\frac{e^{-x}}{(1+e^{-x})^2}, \quad x \in \mathbb{R}.$$
(a) Prove that the distribution of X is symmetric about zero
$$\frac{f(x)}{f(-x)}=\frac{\frac{e^{-x}}{(1+e^{-x})^2}}{\frac{e^{x}}{(1+e^{x})^2}}=\frac{e^{-x}(1+e^{x})^2}{e^{x}(1+e^{-x})^2}= \frac{e^{-x}+e^{x}+2}{e^{x}+e^{-x}+2}=1\Rightarrow f(x)=f(-x).$$
So in example 3.3.1 it is symmetric around zero.
(b) Determine whether X has finite hope. If so, find the value.
We know X is integrable if and only if $ \mathbb{E}(|X|)< \infty $
So
$$\mathbb{E}(|X|)=\int_0^\infty x dF_{|X|}(x)=\int_0^\infty x \left[f(x)+f(x)\right]dx=2\int_0^\infty x\frac{e^{-x}}{(1+e^{-x})^2}dx$$
We define, $ t=e^{-x} $, $ x=-\ln(t) $ and $ dx=-\frac{1}{t}dt $ and then
$$2\int_0^\infty x\frac{e^{-x}}{(1+e^{-x})^2}dx=2\int_0^1 \ln(t)\frac{t}{(1+t)^2}\left(\frac{1}{t}\right)dt=-2\int_0^1 \frac{\ln(t)}{(1+t)^2}dt$$
Again making a variable change, $ u=\ln(t) $ which implies that $ du=\frac{1}{t}dt $ and $ dv=\frac{1}{(1+t)^2}dt $ which implies that $ v=-(1+t)^{-1} $. So, we have to
$$-2\int_0^1 \frac{\ln(t)}{(1+t)^2}dt=-2\left(\left[-\frac{\ln(t)}{1+t}\right]_0^1+ \int_0^1 \frac{1}{t(t+1)}dt\right)=$$
$$-2\left(-\frac{\ln(t)}{1+t}+\ln\left(\frac{1+t}{t}\right)\right)_0^1 = -2\left[\ln(t)^{1/(t+1)}\left(\frac{1+t}{t}\right)\right]=$$
$$ -2 \left[\frac{t}{1+t}\ln(t)+\ln(1+t)\right]_0^1=2\ln(2)$$
then $ X $ is integrable by example 3.3.1 we have that $ \mathbb{E}(X)=0 $.
(c) Obtain the density of $ Y=e^{Y} $ and find $ \mathbb{E}(Y). $
We have to

So,
$$\mathbb{E}(Y)=\int_0^\infty \frac{y}{(1+y)^2}dy$$
making a variable change $ u=y $ which implies that $ du=dy $ and $ dv=\frac{dy}{(1+y)^2} $ which implies that $ v=-\frac{1}{1+y} $, we then have to
$$\int_0^\infty \frac{y}{(1+y)^2}dy=\left[-\frac{y}{1+y}\right]_0^\infty + \int_0^\infty \frac{1}{1+y}dy= \infty$$
Example 3.3.3
Calculate $ \mathbb{E}(X) $ if $ X $ has density $ f(x) $, where:
(a) f is the given density

So hope is given by
$$\mathbb{E}(X)=\int_{-1}^1 x f(x)dx=\int_{-1}^1 cx^3 dx =\left[\frac{cx^4}{4}\right]_{-1}^1=0$$
(b) $ f(x)=\displaystyle \frac{1}{(1+x)^2} $ if $ x > 0; $$ f(x)=0 $ if $ x\leq 0 $.
By item (c) of example 3.3.2 $ \mathbb{E}(X)=\infty $.
Example 3.3.4

Calculate $ \mathbb{E}(X) $ in this case.
We then have
$$\mathbb{E}(X)=\int_0^\infty x f(x)dx=\int_0^\infty \lambda \alpha x^{\alpha}e^{-\lambda x^{\alpha}}dx$$
making variable change $ y=\lambda x^\alpha $, $ x=\left(\frac{y}{\lambda}\right)^{1/\alpha} $ with $ dx=\frac{1}{\lambda^{1/\alpha}}\frac{1}{\alpha} y^{\frac{1}{\alpha}-1} $, then we have to
$$\int_0^\infty \lambda \alpha x^{\alpha}e^{-\lambda x^{\alpha}}dx=\int_0^\infty \alpha y e^{-y}\frac{1}{\alpha}\frac{y^{1/\alpha - 1}}{\lambda^{1/\alpha}} dy = \lambda^{-\frac{1}{\alpha}}\int_{0}^\infty y^{1/\alpha}e^{-y}dy= \lambda^{-1/\alpha} \Gamma(1+1/\alpha)$$
Example 3.3.5
Be $ X $ and $ Y $ independent random variables with common distribution $ U[0,1] $. Calculate $ \mathbb{E}(Z) $ and $ \mathbb{E}(W) $, with $ Z=\min(X,Y) $ and $ W=\max(X,Y) $
We have to

then,
$$\mathbb{E}(Z)=\int_0^1 \mathbb{P}(Z> z)dz= \int_0^1 (1-z)^2dz=-\frac{(1-z)^3}{3}\Biggl|_0^1 =\frac{1}{3}$$
Now

So,
$$\mathbb{E}(W)=\int_0^\infty \mathbb{P}(W> z)dz= \int_0^1 (1-w)^2dz=w\Biggl|_0^1- \frac{w^3}{3}\Biggl|_0^1 =\frac{2}{3}$$
Example 3.3.6
A player flips a fair coin. He stops after throwing either two successive heads or two successive tails. What is the hope for the number of launches?
Be $ X $ the number of launches, first we will consider $ X=n $, with $ n $ pair, that is, $ n=2k $ for $ k\in \mathbb{N} $. So,
$$\mathbb{P}(X> 2k)=2p^k(1-p)^k=2\left(\frac{1}{2}\right)^k\left(\frac{1}{2}\right)^k=2\left(\frac{1}{2}\right)^{2k}=2\left(\frac{1}{2}\right)^n$$
Now consider $ n=2k+1 $, then
$$\mathbb{P}(X> 2k+1)=p^k(1-p)^{k+1}+p^{k+1}(1-p)^{k}=2\left(\frac{1}{2}\right)^{2k+1} =2\left(\frac{1}{2}\right)^n$$
and
$$\mathbb{P}(X> 0)=\mathbb{P}(X\geq 1)=1$$
So,
$$\mathbb{E}(X)=\displaystyle \sum_{n=0}^\infty \mathbb{P}(X> 0)=2+\sum_{n=2}^\infty 2\left(\frac{1}{2}\right)^n=2+\frac{1}{1-\frac{1}{2}}=3$$
Example 3.3.7
An urn contains n numbered balls $ 1,2, \dots,n $. One person draws a ball and returns it, draws another and returns it, continuing until they draw a ball a second time. Let X be the total number of withdrawals required to obtain this repetition
(a) Find the distribution of
We have to $ [X> k]= $ the first k balls drawn are different, $ k=2,\dots, (n-1) $. So,
$$\mathbb{P}(X> k)=\frac{C_n^k}{n^k}=\frac{n}{n}\frac{n-1}{n}\frac{n-2}{n}\dots \frac{n-k}{n} = \left(1-\frac{1}{n}\right)\left(1-\frac{2}{n}\right)\dots \left(1-\frac{k}{n}\right)$$
and
$$\mathbb{P}(X> 0)=\mathbb{P}(X\geq 1)=1$$
and
$$\mathbb{P}(X\geq k)=0, k\geq n$$
(b) Show that
$$\mathbb{E}(X)=2+\left(1-\frac{1}{n}\right)+\left(1-\frac{1}{n}\right)\left(1-\frac{2}{n}\right)+\dots +\left(1-\frac{1}{n}\right)\left(1-\frac{2}{n}\right)\dots \left(1-\frac{n-1}{n}\right)$$
We have to $ X $ is a non-negative variable, and by item (a) we have that
$$\mathbb{E}(X)=\sum_{n=0}^\infty \mathbb{P}(X> n)=2+\left(1-\frac{1}{n}\right)+\left(1-\frac{1}{n}\right)\left(1-\frac{2}{n}\right)+\dots +\left(1-\frac{1}{n}\right)\left(1-\frac{1}{n}\right)\left(1-\frac{2}{n}\right)\dots \left(1-\frac{n-1}{n}\right)$$
Example 3.3.8
Let X and Y be random variables. Se $ F_X(x)\leq F_Y(x) $ for everyone $ x\in \mathbb{R} $, we say that X is stochastically greater than Y. Prove that if X is stochastically greater than Y, then $ \mathbb{E}(X)\geq \mathbb{E}(Y) $ (if $ \mathbb{E}(X) $ and $ \mathbb{E}(Y) $ exist)
We have to
$$\mathbb{E}(X)=\int_0^\infty (1-F_X(x))dx-\int_{-\infty}^0 F_X(x)dx$$
and
$$\mathbb{E}(Y)=\int_0^\infty (1-F_Y(y))dy-\int_{-\infty}^0 F_Y(y)dy$$
Now, how
$$F_X(x)\leq F_Y(x), \forall x\in \mathbb{R}$$
which implies that
$$\int_{-\infty}^0 F_{X}(x)dx\leq \int_{-\infty}^0 F_Y(y)dy $$
and
$$(1-F_X(x))\geq (1-F_Y(x)), \forall x\in \mathbb{R}$$
which implies that
$$\int_{0}^\infty(1- F_{X}(x))dx\leq \int_{0}^\infty (1-F_Y(y))dy $$
So we have to
$$\mathbb{E}(X)\geq \mathbb{E}(Y).$$
Example 3.3.9
Two electronic components will be tested simultaneously. Suppose that the “life” in hours of each component is exponentially distributed with parameter $ \lambda $, and that the lives of the components are independent. Calculate:
(a) The expected time until the first failure of one of the components.
We have to $ T_1\sim \exp(\lambda) $ independent $ T_2\sim \exp(\lambda) $ then
$$[T> t ]=[T_1> t]\cap [T_2> t] $$
So,
$$\mathbb{P}(T> t)=\mathbb{P}(T_1> t) \mathbb{P}(T_2> t)= e^{-\lambda t}e^{-\lambda t}=e^{-2\lambda t}$$
So, how
$$\mathbb{E}(T)=\int_0^\infty \mathbb{P}(T> t)dt=\int_0^\infty e^{-2\lambda t}=-\frac{e^{-2\lambda}}{2\lambda}\Bigg|_0^\infty = \frac{1}{2\lambda}$$
(b) The expected time until both components fail.
For this, we have to
$$[T\leq t ]=[T_1\leq t]\cap [T_2\leq t] $$
which implies that
$$\mathbb{P}(T\leq t)=\mathbb{P}(T_1\leq t) \mathbb{P}(T_2\leq t)= \left(1-e^{-\lambda t}\right)^2$$
Since T is a non-negative variable then
$$\mathbb{E}(T)=\int_0^\infty \mathbb{P}(T> t)dt=\int_0^\infty \left(e^{-2\lambda t}+2e^{-\lambda t}\right)dt=\frac{3}{2\lambda}$$
Example 3.3.10
Two players flip coins simultaneously until they get the first marriage (ie. either two heads or two tails). If both players throw “heads” simultaneously, player I wins, if they both throw “tails”, player II wins. For example, if they both get “heads” on the first toss, then the game ends and player I wins the game. Suppose that player I’s coin is fair, but that the other’s coin is not necessarily, that is, having probability $ p $ “face”, $ 0< p< 1 $.
(a) Calculate the expectation of the number of tosses (i.e., the number of times player I tosses the coin until the game ends).
Define

then
$$\mathbb{P}(X_i=0)=\frac{1}{2}=\mathbb{P}(X_i=1)$$
and
$$\mathbb{P}(Y_i=0)=p,\quad \quad \quad \mathbb{P}(Y_i=1)=1-p$$
Let’s define the following sets
$$G_i^{I}=(\text{Ganha o jogador I no Lançamento i})$$
$$G_i^{II}=(\text{Ganha o jogador II no Lançamento i})$$
and yet
$$C_i=(\text{nem o jogador I e o jogador II no lançamento i e então o jogo continua.})$$
So we have to
$$\mathbb{P}\left(G_i^{I}\bigg| C_{i-1}\right)=\mathbb{P}(X_i+Y_i=0)=\mathbb{P}(X_i=0)\mathbb{P}(Y_i=0)=\frac{1}{2}p$$
$$\mathbb{P}\left(G_i^{II}\bigg| C_{i-1}\right)=\mathbb{P}(X_i+Y_i=2)=\mathbb{P}(X_i=1)\mathbb{P}(Y_i=1)=\frac{1}{2}(1-p)$$
$$\mathbb{P}\left(C_i\bigg| C_{i-1}\right)=\mathbb{P}(X_i+Y_i=1)=$$
$$\mathbb{P}(X_i=0)\mathbb{P}(Y_i=1)+ \mathbb{P}(X_i=1)\mathbb{P}(Y_i=0)=$$
$$ \frac{1}{2}p+\frac{1}{2}(1-p)=\frac{1}{2}$$
Be $ Z $ the random variable that counts the number of throws until the game ends. So, we have to
$$\mathbb{P}(Z> n)=\mathbb{P}(C_1)\mathbb{P}\left(C_2\bigg|C_1\right)\mathbb{P}\left(C_3\bigg|C_1\cap C_2\right) \dots \mathbb{P}\left(C_n\bigg|C_1\cap C_2\cap \dots \cap C_{n-1}\right)$$
$$= \mathbb{P}\left(C_1\right)\mathbb{P}\left(C_2\bigg|C_1\right)\dots \mathbb{P}\left(C_n\bigg|C_{n-1}\right)=$$
$$\left(\frac{1}{2}\right)^n, \quad n=0,1,2, \dots$$
Since Z is a non-negative variable, we have
$$\mathbb{E}(Z)=\sum_{n=0}^\infty \mathbb{P}(Z> n)=\sum_{n=0}^\infty\left(\frac{1}{2}\right)^n =\frac{1}{1-\frac{1}{2}}=2$$
(b) Find the probability of player I winning the game (sooner or later)
Define
$$W=(\text{Jogador ganha o Jogo})$$
and
$$W_i=(\text{Jogador ganha o Jogo no lançamento i}).$$
So $ W=\displaystyle \bigcup_{i=1}^\infty W_i $ by $ \sigma $-additivity we have to
$$\mathbb{P}(W)=\sum_{n=1}^\infty \mathbb{P}(W_n)$$
Now
$$\mathbb{P}(W_n)=\mathbb{P}(C_1)\mathbb{P}\left(C_2\bigg|C_1\right)\dots \mathbb{P}\left(C_{n-1}\bigg|C_{n-2}\right) \mathbb{P}\left(G^{I}_{n}\bigg|C_{n-1}\right)=\left(\frac{1}{2}\right)^{n-1}\frac{1}{2}p$$
So,
$$\mathbb{P}(W)=\sum_{n=1}^\infty \left(\frac{1}{2}\right)^n p=\frac{\frac{1}{2}}{1-\frac{1}{2}}p=p$$
Example 3.3.11
Players I and II have 200.00 reais. A coin is tossed with probability $ p $ to give face (0< p < 1). Se der cara, o jogador I recebe 100,00 reais do II, se der coroa, I paga 100,00 reais ao II. Continua-se lançando a moeda, independentemente, até um dos jogadores perder tudo, i.e., até um deles ficar com os 400,00 reais. Determine $ \mathbb{E}(N) $, no qual N é o número de lançamentos até terminar o jogo.
Defina $ X_i=\text{número de caras até a jogada i} $, $ Y_i=\text{ número de coroas até a jogada i} $ o jogo só acaba na i-ésima jogada se $ |X_i-Y_i|=2 $. Assim, considere primeiramente $ n $ um número par e $ n=2k $ então
$$[N> n]=[X_i=k]\cap [Y_i=k]$$
Então,
$$\mathbb{P}(N> n)=p^k(1-p)^k=[p(1-p)]^k$$
Agora, se n é impar então
$$[N> n]=\left([X_i=k]\cap[Y_i=k+1]\right)\bigcup \left([X_i=k+1]\cap[Y_i=k]\right)$$
o que implica que
$$\mathbb{P}(N> n)=p^k(1-p)^{k+1}+p^{k+1}(1-p)^{k}=p^k(1-p)^k[p(1-p)]=p^k(1-p)^k$$
com
$$\mathbb{P}(N> 0)=\mathbb{P}(N> 1)=0$$
Assim,
$$\mathbb{E}(N)=\sum_{n=0}^\infty \mathbb{P}(N> n)=2+\sum_{k=1}^\infty \mathbb{P}(N> 2k)+\sum_{k=1}^\infty \mathbb{P}(N> 2k+1)=2\frac{2p(1-p)}{1-p(1-p)}=\frac{4p(1-p)}{1-p(1-p)}$$
Exemplo 3.3.12
Prove que o critério de integrabilidade ainda vale se “$ \geq $” é substituído por “$ > $”, isto é, X é integrável se, e somente se,
$$\sum_{n=1}^\infty \mathbb{P}(|X|>n)< \infty.$$
Temos que $ X $ é integrável se, e somente, se $ |X| $ é integrável
Agora $ \mathbb{E}(|X|)\leq \mathbb{E}(|X|)+1 $. Porém,
$$\mathbb{E}(|X|)=\sum_{n=0}^\infty \mathbb{P}(|X|> n)=\mathbb{P}(|X|> 0)+ \sum_{n=1}^\infty \mathbb{P}(|X|>n)$$
então,
$$\sum_{n=0}^\infty \mathbb{P}(|X|> n)\leq \mathbb{E}(|X|)\leq 1+\sum_{n=1}^\infty \mathbb{P}(|X|>n)$$
Assim,
$$\sum_{n=1}^\infty \mathbb{P}(|X|> n)\leq \mathbb{E}(|X|)\leq 2+\sum_{n=1}^\infty \mathbb{P}(|X|>n).$$
Então,
$$\mathbb{E}(|X|)> \infty$$
se, e somente se,
$$\sum_{n=1}^\infty \mathbb{P}(|X|>n)< \infty$$
Exemplo 3.3.13
Verifique que a desigualdade de Jensen ainda vale se a função $ \varphi $ é convexa em um intervalo (a,b) tal que
$$\mathbb{P}(a< X < b)=1,$$
no qual admitimos a possibilidade de $ a=-\infty $ ou $ b=\infty $.
Exemplo 3.3.14
Sejam X e Y variáveis aleatórias com densidade conjunta $ f(x,y) $. Verifique se $ \mathbb{E}(aX+bY)=a\mathbb{E}(X)+b\mathbb{E}(Y) $ para esse caso.(Suponha $ \mathbb{E}(X) $ e $ \mathbb{E}(Y) $ finito)
Sabemos que se a X e Y tem densidade conjunta $ f(x,y) $ então:
$$\mathbb{E}(aX+bY)=\int_{-\infty}^\infty \int_{-\infty}^\infty(ax+by)f_{X,Y}(x,y)dxdy=\int_{-\infty}^\infty \int_{-\infty}^\infty a x f_{X,Y}(x,y)dxdy +\int_{-\infty}^\infty \int_{-\infty}^\infty by f_{X,Y}(x,y)dxdy$$
e
$$a\mathbb{E}(X)+b\mathbb{E}(Y)=a\int_{-\infty}^\infty x f_X(x)dx+b\int_{-\infty}^\infty yf_Y(y)dy$$
Mas,
$$\int_{-\infty}^\infty \int_{-\infty}^\infty a x f_{X,Y}(x,y)dxdy +\int_{-\infty}^\infty \int_{-\infty}^\infty by f_{X,Y}(x,y)dxdy=a\int_{-\infty}^\infty x f_X(x)dx+b\int_{-\infty}^\infty yf_Y(y)dy=a\mathbb{E}(X)+b\mathbb{E}(Y)$$
Portanto,
$ \mathbb{E}(aX+bY)=a\mathbb{E}(X)+b\mathbb{E}(Y) $.
Exemplo 3.3.15
Suponha que $ X\sim U[0,1] $. Determine os valores de $ t(t\in \mathbb{R}) $ tais que $ \mathbb{E}(X^t) $ é finita. Qual o valor da esperança nesse caso?
$$\mathbb{E}(X^t)=\int_{-\infty}^\infty x^t f_X(x)dx$$
Agora se $ X\sim U[0,1] $, então $ f_X(x)={1}_{[0,1]} $. Logo,
$$\mathbb{E}(X^t)=\int_0^1 x^tdx=\frac{x^{t+1}}{t+1}\Biggl|_0^1=\frac{1}{t+1}$$
Portanto, $ \mathbb{E}(X^t)\leq \infty $ o que implica que $ t\neq -1 $, assim $ t\in \mathbb{R}-(-1) $ o que implica que $ \mathbb{E}(X^t)=\frac{1}{1+t}< \infty. $
Exemplo 3.3.16
Calcule $ \mathbb{E}(e^X) $, no qual X tem densidade Logística
$$\frac{e^{-x}}{(1+e^{-x})^2}$$
$ x\in \mathbb{R} $, utilizando o Teorema 3.3.1. Compare com o resultado obtido no exemplo 3.3.2(c).
Pelo Teorema 3.3.1 temos:
$$\mathbb{E}(e^x)= \int_{-\infty}^\infty e^x \frac{e^{-x}}{(1+e^{-x})^2}dx=\int_{-\infty}^\infty \frac{1}{(1+e^{-x})^2}dx=\int_{-\infty}^0 \frac{1}{(1+e^{-x})^2}dx+\int_{0}^\infty \frac{1}{(1+e^{-x})^2}dx $$
Agora, fazendo uma mudança de variável $ y=e^{-x} $ e $ dy=\frac{e^{-x}}{y}dx $
$$\int_{-\infty}^0 \frac{1}{(1+e^{-x})^2}dx=\int_0^1\frac{1}{y\left(1+\frac{1}{y}\right)^2}dy=\int_0^1 \frac{y}{(1+y)^2}dy$$
novamente fazendo uma mudança de variável $ z=1+y $ e $ dz=dy $
$$\int_0^1 \frac{y}{(1+y)^2}dy=\int_1^2 \frac{z-1}{z^2}dz= \ln z\Biggl|_1^2 +\frac{1}{z}\Biggl|_1^2=\ln 2-\frac{1}{2}.$$
Temos que
$$\int_{0}^\infty \frac{1}{(1+e^{-x})^2}dx=\infty$$
pois
$$\frac{1}{(1+e^{-x})^2}\geq 0, \quad \quad x\in \mathbb{R}_{+}$$
e
$$\lim_{x\rightarrow \infty}\frac{1}{(1+e^{-x})^2}=1$$
Então,
$$\mathbb{E}(e^{x})=\ln2- \frac{1}{2}+\infty=\infty$$
Exemplo 3.3.17
Calcule a esperança de

For the first case, we have
$$\mathbb{E}(Y)=\int_{-\infty}^\infty f_Y(y)dy=\int_{-1}^1 cy^3dy=\frac{cy^4}{4}\Biggl|_{-1}^{1}=0$$
For the second case we have
$$\mathbb{E}(X)=\int_{-\infty}^\infty f_X(x)dx=\int_{0}^1 3y^3dx=\frac{3y^4}{4}\Biggl|_{0}^{1}=\frac{3}{4}$$
Example 3.3.18
Let X be the waiting time until the first success in a sequence of Bernoulli trials having probability $ p $ success in each trial. Calculate $ \mathbb{E}(X^2) $
$$\mathbb{P}(X=k)=p(1-p)^{k-1},\quad \quad k=1,2, \dots $$
for $ 0< p< 1 $, then
$$\mathbb{E}(X^2)=\sum_{k=1}^\infty \left(k^2 p (1-p)^{k-1}\right)=p\sum_{k=1}^\infty \left(k^2 (1-p)^{k-1}\right)$$
To simplify the notation we will define $ q:=(1-p) $, then we will show that
$$\sum_{k=1}^\infty \left(k^2 q^{k-1}\right)=\frac{1+q}{(1-q)^3}$$
To do this, note that
$$\sum_{k=1}^\infty \left(k^2 q^{k-1}\right)=1+4q+9q^2+16q^3+\dots =\sum_{k=1}^\infty q^{k-1}+3q+8q^2+15q^3+\dots$$
$$=\left(\sum_{k=1}^\infty q^{k-1}\right)+3q(1+q+q^2+q^3+\dots)+5q^2+12q^3+21q^4+\dots =\left(\sum_{k=1}^\infty q^{k-1}\right)(1+3q)+5q^2(\sum_{k=1}^\infty q^{k-1})+7q^3+16q^4+\dots$$
$$=\left(\sum_{k=1}^\infty q^{k-1}\right)(1+3q+5q^2+7q^3+9q^4+\dots)=\left(\sum_{k=1}^\infty q^{k-1}\right)\left(\sum_{k=1}^\infty (2k-1)q^{k-1}\right)$$
So we have to
$$\left(\sum_{k=1}^\infty k^2 q^{k-1}\right)=\left(\sum_{k=1}^\infty q^{k-1}\right)\left[2\left(\sum_{k=1}^\infty q^{k-1}\right)-\left(\sum_{k=1}^\infty k q^{k-1}\right)\right]$$
But, it is known that
$$\left(\sum_{k=1}^\infty q^{k-1}\right)=\frac{1}{1-q}$$
and
$$\left(\sum_{k=1}^\infty kq^{k-1}\right)=\frac{1}{(1-q)^2}$$
So, we have to
$$\left(\sum_{k=1}^\infty k^2 q^{k-1}\right)=\left(\frac{1}{1-q}\right)\left[\frac{2}{(1-q)^2}-\frac{1}{1-q}\right]=\frac{1}{1-q}\left( \frac{2-1+q}{(1-q)^2}\right)=\frac{1+q}{(1-q)^3}$$
In this way we have to
$$\mathbb{E}(X^2)=p\frac{1+q}{(1-q)^3}=\frac{2-p}{p^2}$$
8.3.4 Moments
Be $ X $ a random variable. Se $ \mathbb{E}(X^r) \ < \ \infty $, we say that $ \mathbb{E}(X^r) $ is the rth moment of $ X $.
The rth moment around $ \alpha\in\mathbb{R} $ is defined as being $ \mathbb{E}((X-\alpha)^r) $, if this expected value exists. Se $ \alpha=\mathbb{E}(X) $ so it is called the rth central moment. We observe that $ \text{Var}(X)=\mathbb{E}[(X-\mathbb{E}(X))^2] $, that is, the variance $ \text{Var}(X) $ is defined as the second central moment. A more detailed definition of variance and its properties can be found in Section 4.
Moment generating function
Definition 3.4.1
Be $ X $ a random variable. The moment generating function of the variable $ X $ is defined as the function
$$M_{X}(t)=\mathbb{E}(e^{tX})$$
since $ \mathbb{E}(e^{tX}) $ exists in some interval of the type $ (-h,h) $ for some real number $ h \ > \ 0 $.
The moment generating function has this name because, from it, we can find all the moments of the random variable $ X $ (when these exist). The function only needs to be defined in a neighborhood of the zero point, as the moments will be obtained through successive differentiations applied to zero, using the result below.
Theorem 3.4.1
Be $ X $ a random variable. How $ \mathbb{E}(e^{tX}) $ is set to $ t\in (-h,h) $ for some $ h\in\mathbb{R} $, we have to
$$M_{X}^{(n)}(t)=\frac{d^n}{dt^n}\mathbb{E}\left(e^{tX}\right)=\mathbb{E}\left(\frac{d^n}{dt^n}e^{tX}\right) = \mathbb{E}\left(X^ne^{tX}\right).$$
We observe that
$$M_{X}^\prime(t)=\frac{d}{dt}\mathbb{E}\left(e^{tX}\right)=\mathbb{E}\left(\frac{d}{dt}e^{tX}\right)=\mathbb{E}\left(Xe^{tX}\right)$$
and, at the point $ t = 0 $ we have to $ M_{X}^\prime(0)=\mathbb{E}(X) $. Similarly we have to:
$$M_{X}^{\prime\prime}(t)=\frac{d^2}{dt^2}\mathbb{E}\left(e^{tX}\right)=\mathbb{E}\left(\frac{d^2}{dt^2}e^{tX}\right)=\mathbb{E}\left(X^2e^{tX}\right)$$
and if we calculate $ M_X^{\prime\prime}(t) $ at the point $ t=0 $, we have to $ M_{X}^{\prime\prime}(0)=\mathbb{E}(X^2) $. By induction, it is easy to see that:
$$M_{X}^{(n)}(t)=\frac{d^n}{dt^n}\mathbb{E}\left(e^{tX}\right)=\mathbb{E}\left(X^ne^{tX}\right).$$
whence it follows that $ M_X^{(n)}(0) = \mathbb{E}(X^n) $.
Therefore, if we want to find the nth moment of the random variable $ X $, we just need to derive its moment generating function (when it exists) $ n $ times and then calculate its value at the point $ t = 0 $.
Moment generating function of discrete random variables
Definition 3.4.2
Be $ X $ a discrete random variable that takes on values in $ \mathcal{R}_X $. The moment generating function $ X $, when it exists, is then calculated as follows:
$$M_{X}(t)=\mathbb{E}\left(e^{tX}\right)=\sum_{x\in\mathcal{R}_X}e^{tx}p(x),$$
in which $ p(x) $ is the probability function of the random variable $ X $, that is, $ p(x) = \mathbb{P}(X=x) $.
Next, we present some examples of moment generating functions for some discrete random variables (we will see these random variables in more detail in section 5).
Example 3.4.1
Be $ X $ a discrete random variable with binomial distribution with parameters $ n $ and $ p $, that is, $ X\sim b(n,p) $. So

We can find the mean and variance through the moment generating function. So
$$M^\prime_X(t)=\frac{d}{dt}(p e^t+ 1-p)^n=n(pe^t+1-p)^{n-1}pe^t.$$
So how $ \mathbb{E}(X)=M^\prime_X(0)=n(p+1-p)^{n-1}p=np $.
To find the variance, we just need to differentiate the function once again $ M_X(t) $. So we have to:
$$M^{\prime\prime}_X(t)=\frac{d^2}{dt^2}(p e^t+ 1-p)^n=n(n-1)(pe^t+1-p)^{n-2}pe^t pe^t+pe^t n(pe^t+1-p)^{n-1}$$
and therefore
$$M^{\prime\prime}_X(t)=n(n-1)(pe^t+1-p)^{n-2}(pe^t)^2+npe^t (pe^t+1-p)^{n-1}.$$
Therefore, it follows that $ \mathbb{E}\left(X^2\right)=M^{\prime\prime}_X(0)=n(n-1)p^2+ pn $, then we get that:
$$\text{Var}(X)=\mathbb{E}(X^2)-\mathbb{E}^2(X)=[n(n-1)p^2+pn] -(np)^2=np^2(n-1)+np-n^2p^2=np(1-p).$$
Example 3.4.2
Be $ X $ a discrete random variable with Poisson distribution, with parameter $ \lambda $, that is, $ X\sim Po({\lambda}) $. So
$$M_{X}(t)=\mathbb{E}[e^{tX}]=\sum_{k=0}^{\infty}\frac{e^{tk}e^{\lambda}\lambda^k}{k!}=e^{-\lambda}\sum_{k=0}^{\infty}\frac{(\lambda e^t)^k}{k!}=e^{-\lambda}e^{\lambda e^t}=e^{\lambda[e^t-1]}.$$
Example 3.4.3
Be $ X $ a discrete random variable with geometric distribution with parameter p, that is, $ X\sim \ \text{Geo}(p) $. So
$$M_{X}(t)=\mathbb{E}[e^{tX}]=\sum_{k=0}^{\infty}e^{tk}(1-p)^{k-1}p=\frac{pe^{t}}{1-(1-p)e^t}.$$
The table below summarizes the moment generating function of some of the main discrete distributions already seen above.

Example 3.4.4
Let’s find the moment generating function to calculate the random variable of the independent Poisson sum, therefore, be $ X~\sim ~Po(\lambda_1) $ and $ Y~\sim ~Po(\lambda_2) $.

Due to the uniqueness of the moment generating function, we have that the sum of independent random variables that follow a Poisson distribution also has a Poisson distribution. I.e, $ X+Y~\sim ~Po(\lambda_1+\lambda_2) $. By finite induction we can conclude that if $ X_i~\sim ~Po(\lambda_i) $, then $ \displaystyle\sum_{i=1}^{n}X_i~\sim ~Po\left(\displaystyle\sum_{i=1}^{n}\lambda_i \right) $.
Example 3.4.5
We will use the moment generating function to find the distribution of $ X+Y $, knowing that $ X $ and $ Y $ are independent with $ X~\sim ~b(n,p) $ and $ Y~\sim ~b(m,p) $.
$$M_{X+Y}(t)=\mathbb{E}(e^{(X+Y)t})=\mathbb{E}(e^{Xt}e^{Yt})=\mathbb{E}(e^{Xt})\mathbb{E}(e^{Yt})=M_X(t)M_Y(t)=(pe^t+ 1-p)^{m+n}.$$
In the same way as the previous example, we conclude that the moment generating function that $ X+Y~\sim ~b(m+n,p) $. So by finite induction we conclude that $ X_i~\sim ~ b(n_i,p) $, then $ \displaystyle\sum_{i=1}^{k}X_i~\sim ~b\left(\displaystyle\sum_{i=1}^{k}n_i,p \right) $
Moment generating function of continuous random variables
Just as was defined for discrete random variables, we have the following definition for the moment generating function of a continuous random variable
Definition 3.4.3
Be $ X $ a continuous random variable. The moment generating function, also denoted by $ M_X(t) $ is given by:
$$M_{X}(t)=\mathbb{E}[e^{tX}]=\int_{-\infty}^{\infty}e^{tx}f(x)dx$$
in which $ f(x) $ is the probability density function of $ X $. Next, we will calculate the moment generating function for some continuous random variables, and we will see each of them in more detail in section 6.
Example 3.4.6
Be $ X $ a continuous random variable with exponential parameter distribution $ \lambda $, that is, $ X\sim \ \text{Exp}(\lambda) $. So, we have to
$$M_{X}(t)=\mathbb{E}[e^{tX}]=\int_{-\infty}^{\infty}e^{tx}\lambda e^{-\lambda x}dx=\lambda \int_{0}^{\infty}e^{-(\lambda-t)x}dx=\frac{\lambda}{\lambda -t},~~~t<\lambda.$$
Example 3.4.7
Be $ X $ a continuous random variable with normal distribution with mean $ \mu=0 $ and variance $ \sigma^2=1 $, that is, $ X\sim N(0,1) $. So
$$M_{X}(t)=\mathbb{E}[e^{tX}]=\frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty}e^{tx}e^{-x^2/2}dx=\frac{e^{t^2/2}}{\sqrt{2\pi}}\int_{-\infty}^{\infty}e^{-(x-t)^2/2}dx=e^{t^2/2}.$$
Example 3.4.8
Be $ X $ a continuous random variable with normal distribution with mean $ \mu $ and variance $ \sigma^2 $, that is, $ X \sim N(\mu,\sigma^2) $ and be $ Z\sim N(0,1) $. Then $ X=\sigma Z+\mu $. Therefore, we can use the moment generating function $ Z $ to calculate the moment generating function of X, as follows:
$$M_X(t)=\mathbb{E}[e^{tX}]=\mathbb{E}[e^{t(\sigma Z+ \mu)}]=e^{t\mu}\mathbb{E}[e^{t\sigma Z}]=e^{t\mu}e^{\frac{(t\sigma)^2}{2}}=\exp\left(\frac{\sigma^2 t^2}{2}+ \mu t\right).$$
Let’s calculate the variance and mean of X from the moment generating function.
$$M^\prime_X(t)=\frac{d}{dt}\exp\left(\frac{\sigma^2t^2}{2}+ \mu t\right)=(\mu+t\sigma^2)\exp\left(\frac{\sigma^2t^2}{2}+ \mu t\right)$$
and
$$M^{\prime\prime}_X(t)=\frac{d^2}{dt^2}\exp\left(\frac{\sigma^2t^2}{2}+ \mu t\right)=(\mu+ t\sigma^2)^2 \exp\left(\frac{\sigma^2t^2}{2}+ \mu t\right)+ \sigma^2 \exp\left(\frac{\sigma^2t^2}{2}+ \mu t\right)$$
And therefore, $ \mathbb{E}[X]=M^\prime_X(0)=\mu $ and $ \mathbb{E}[X^2]=\mu^2+\sigma^2 $ from which it follows that the variance is given by
$$\text{Var}(X)=\mathbb{E}(X^2)-\mathbb{E}^2(X)=\mu^2-\sigma^2-\mu^2=\sigma^2.$$
An alternative demonstration of this fact can be seen in section 8.6.2.
Example 3.4.9
Se $ X\sim N(\mu_1,\sigma_1^2) $ and $ Y\sim N(\mu_2,\sigma_2^2) $ are independent random variables, then $ X+Y\sim N(\mu_1+ \mu_2,\sigma_1^2+\sigma_2^2) $.
In fact,
$$M_{X+Y}(t)=\mathbb{E}(e^{(X+Y)t})=\mathbb{E}(e^{Xt}e^{Yt})=\mathbb{E}(e^{Xt})\mathbb{E}(e^{Yt})=M_X(t)M_Y(t)$$
whence it follows that
$$M_{X+Y}(t)=\exp\left(\frac{\sigma_1^2 t^2}{2}+ \mu_1 t\right)\exp\left(\frac{\sigma_2^2 t^2}{2}+ \mu_2 t\right)=\exp\left( \frac{(\sigma_1^2+\sigma_2^2)t^2}{2}+(\mu_1+\mu_2)t\right).$$
Therefore, due to the uniqueness of the moment generating function, we conclude that $ X+Y\sim N(\mu_1+ \mu_2,\sigma_1^2+\sigma_2^2) $. By finite induction we can conclude that if $ X_i~\sim ~ N(\mu_i,\sigma_i^2) $, then $ \displaystyle\sum_{i=1}^{k}X_i~\sim ~N\left(\displaystyle\sum_{i=1}^{k}\mu_i,\sum_{i=1}^{k}\sigma_i\right) $.
Example 3.4.10
Suppose the random variable X has the following “triangular” density:

Calculate $ \mathbb{E}(X) $ and $ Var(X) $.
$$\mathbb{E}\left(X\right)=\int_{-\infty}^\infty x f(x)dx=\int_{-1}^0 x(1+x)dx+\int_{0}^1x(1-x)dx=\left[\frac{x^2}{2}+\frac{x^3}{3}\right]_{-1}^0+ \left[\frac{x^2}{2}+\frac{x^3}{3}\right]_{0}^1=-\frac{1}{2}+\frac{1}{3}+\frac{1}{2}-\frac{1}{3}=0$$
$$\mathbb{E}(X^2)=\int_{-\infty}^\infty x^2 f(x)dx =\int_{-1}^0x^2(1+x)dx+\int_{0}^1 x^2(1+x)dx=\left[\frac{x^3}{3}+\frac{x^4}{4}\right]_{-1}^0 + \left[\frac{x^3}{3}+\frac{x^4}{4}\right]_{0}^1=\frac{1}{3}-\frac{1}{4}+\frac{1}{3}-\frac{1}{4}=\frac{1}{6}$$
So,
$$Var(X)=\mathbb{E}(X^2)-\mathbb{E}^2(X)=\frac{1}{6}$$
Example 3.4.11
(a) Prove: if the random variable X is limited, then it has finite moments of all orders.
X is limited which implies that there is $ k> 0 $ such that $ |X|< k $ which implies that $ \mathbb{E}(|X|)< k $ which implies that X is integrable. Now, if X is limited $ |X|^t< k^t $, $ t> 0 $ which implies that $ \mathbb{E}(|X|^t)< k^t $ which implies that $ X^t $ is integrable. Thus, X will have finite moments of all orders.
(b) Let A be a random event. Calculate all absolute moments of the random variable $ X={1}_A $.
We have to $ X^t=\left({1}_A\right)^t={1}_A $ which implies that
$$\mathbb{E}(X^t)=\mathbb{E}(X)=\mathbb{E}({1}_A)=\int_A f_x(x)dx=\mathbb{P}(X\in A), \forall t \in A$$
(c) Show: if $ X\sim N(\mu,\sigma^2) $, then all absolute moments of X are finite.
(d) Be $ X\sim Cauchy(0,1) $.
What are the finite absolute moments of X?
Example 3.4.12
Get the variance of $ Z $ and $ W $ given by

Now, we already know that $ \mathbb{E}(Z)=\frac{1}{3} $ and $ \mathbb{E}(W)=\frac{2}{3} $. Now,
$$\mathbb{E}(Z^2)=\int_{-\infty}^\infty z^2f_Z(z)dz =\int_0^1 2z^2(1-z)dz=\left(\frac{2}{3}z^3-\frac{z^4}{2}\right)_0^1=\frac{2}{3}-\frac{1}{2}=\frac{1}{6}$$
and
$$\mathbb{E}(W^2)=\int_{-\infty}^\infty w^2f_W(w)dw =\int_0^1 2w^3dw=\left(\frac{w^4}{2}\right)_0^1=\frac{1}{2}$$
So,
$$Var(Z)=\mathbb{E}(Z^2)-\mathbb{E}^2(Z)=\frac{1}{6}-\frac{1}{9}=\frac{1}{18}$$
$$Var(W)=\mathbb{E}(W^2)-\mathbb{E}^2(W)=\frac{1}{2}-\frac{4}{9}=\frac{1}{18}$$
Example 3.4.13
Through statistical experiments, it is determined that the duration of a certain type of telephone call satisfies the relationship
$$\mathbb{P}(T> t)=ae^{-\lambda t}+(1-a)e^{-\xi t}$$
$ t\geq 0 $, in which $ 0\leq a\leq 1 $, $ \lambda > 0 $, $ \xi > 0 $. Find the mean and variance of T.
We have that T is a non-negative variable, then:
$$\mathbb{E}(T)=\int_0^\infty \mathbb{P}(T> t)dt=\int_0^\infty a e^{-\lambda t}dt+\int_0^\infty (1-a)e^{-\xi t}dt= a \int_0^\infty e^{-\lambda t}dt+(1-a)\int_0^\infty e^{-\xi t}dt$$
which implies that $ \mathbb{E}(T)=\frac{a}{\lambda}+\frac{(1-a)}{\xi} $. Now $ T^2 $ is also a non-negative random variable, so:
$$\mathbb{E}(T^2)=2\int_0^\infty t \mathbb{P}(T> t)dt=2\left( a \int_0^\infty te^{-\lambda t}dt+(1-a)\int_0^\infty t e^{-\xi t}dt\right)=2\left[\frac{a}{\lambda^2}+\frac{(1-a)}{\xi^2}\right]$$
So,
$$Var(T)=\mathbb{E}(T^2)-\left(\mathbb{E}(T)\right)^2=2\left[\frac{a}{\lambda^2}+\frac{1-a}{\xi^2}\right]- \left[\frac{a}{\lambda}-\frac{1-a}{\xi}\right]^2$$
Example 3.4.14
Prove that if X takes on values only in the interval $ [a,b] $, then $ a\leq \mathbb{E}(X)\leq b $ and $ Var(X)\leq \frac{(b-a)^2}{4} $. Display a random variable that achieves maximum variance.
Define a variable $ Y $ such that $ 0\leq Y \leq 1 $ which implies that $ 0\leq \mathbb{E}(Y)\leq 1 $. Now, let m be a median of Y then
$$Var(Y)=Var(Y-m)\leq \mathbb{E}(Y-m)^2=\int_0^m (Y-m)^2 dF_Y+ \int_m^1 (Y-m)^2 dF_Y\leq m^2 \mathbb{P}(Y\leq m)+ (1-m^2)\mathbb{P}(Y\geq m) \leq \frac{1}{2}m^2+\frac{1}{2}(1- m^2)=m^2- m +\frac{1}{2}=\left(m-\frac{1}{2}\right)^2+\frac{1}{4}\leq \frac{1}{4}$$
In short $ Var(Y)\leq \frac{1}{4} $. Now take $ Y-(b-a)X+a $ which implies that $ Var(Y)=(b-a)^2Var(X)\leq \frac{(b-a)^2}{4} $ and $ \mathbb{E}(Y)=(b-a)\mathbb{E}(X)+a $ which implies that $ a\leq \mathbb{E}(Y)\leq b $. The random variable that achieves maximum variance is
$$\mathbb{P}(X=a)=\mathbb{P}(X=b)=\frac{1}{2}$$
Example 3.4.15
Show that Jensen’s inequality is strict, that is, $ \mathbb{E}(\varphi(X))> \varphi\left(\mathbb{E}(X)\right) $, if the function $ \varphi $ is strictly convex and X is not constant.
We have to $ \varphi(x) $ is strictly convex. So, for $ X\neq X_0 $ we have
$$\varphi(x)> \varphi(x_0)+\lambda (x-x_0)$$
Now doing $ X_0=\mathbb{E}(X) $ and how
$$\mathbb{P}(X\neq X_0)=\mathbb{P}(X\neq \mathbb{E}(X))=\mathbb{P}(|X-\mathbb{E}(X)|> 0)$$
because $ \mathbb{P}(X=X_0)< 1, $ for everyone $ X_0\in \mathbb{R} $ (X is not constant), then:
$$\mathbb{E}(\varphi(X))> \varphi(X_0)+\lambda \mathbb{E}(X-X_0)=\varphi(\mathbb{E}(X)).$$
Example 3.4.16
Be $ X_1,\dots, X_n $ independent random variables with $ \mathbb{E}(X_j)=\mu_j $ and $ Var(X_j)=\sigma_j^2 $. Consider linear combinations
$$Y=\sum_{j=1}^n p_j X_j$$
in which $ p_j\geq 0 $ and
$$\sum_{j=1}^n p_j =1$$
Prove that $ Var(Y) $. Prove that $ Var(Y) $ is minimized by the choice of
$$p_j=\frac{\sigma_j^{-2}}{\sum_{i=1}^n \sigma_i^{-2}}, \quad \quad j=1, \dots, n.$$
We have, with $ X_1, \dots, X_n $ are independent random variables
$$Var(Y)=Var\left(\sum_{j=1}^n p_jX_j\right)=\sum_{j=1}^n p_j^2\left(Var(X_j)\right)=\sum_{j=1}^n p_j^2\sigma^2_j.$$
To solve this problem we will use the lagrange method, so we want:
$$\min_{p_1,p_2,\dots,p_j}\sum_{j=1}^n p_j^2 \sigma_j^2$$
with $ \sum_{j=1}^n p_j=1 $ and $ p_j> 0, \forall j=1, \dots, n. $
So,
$$L=\sum_{j=1}^n p_j^2\sigma_j^2+\lambda\left(1-\sum_{j=1}^n p_j\right)$$
then, $ \frac{dL}{dp_j=0} $ which implies that
$$2p_j\sigma_k^2-\lambda =0$$
which implies that $ p_j=\frac{\lambda}{2}\sigma^{-2}_j $. So,
$$\sum_{j=1}^n p_j=\frac{\lambda}{2}\sum_{j=1}^n \sigma^{-2}_j=1 $$
which implies that
$$\lambda=\frac{2}{\displaystyle \sum_{j=1}^n \sigma_j^{-2}}$$
replacing we have to
$$p_j=\frac{\sigma_j^{-2}}{\displaystyle \sum_{j=1}^n \sigma_j^{-2}}$$
for $ j=1,2,\dots,n $, which is a minimum point because
$$\frac{d^2L}{d^2 p_j}=2\sigma_j^2> 0$$
for $ j=1,2,\dots,n $.
Example 3.4.17
Let X and Y be random variables with finite variances. Show that if $ Var(X)\neq Var(Y) $, then $ X+Y $ and $ X-Y $ are not independent
Firstly note that
$$\mathbb{E}[(X+Y)(X-Y)]=\mathbb{E}[X^2-Y^2]=\mathbb{E}(X^2)-\mathbb{E}(Y^2)$$
As it has finite variance, we have
$$\mathbb{E}(X^2)-\mathbb{E}(Y^2)=Var(X)+\left(\mathbb{E}(X)\right)^2-Var(Y)-\left(\mathbb{E}(Y)\right)^2$$
$$=\left(\mathbb{E}(X)-\mathbb{E}(Y)\right)+\left(Var(X)-Var(Y)\right)=\mathbb{E}(X+Y)\mathbb{E}(X-Y)+Var(X)-Var(Y)$$
So we have to
$$\mathbb{E}[(X+Y)(X-Y)]=\mathbb{E}(X+Y)\mathbb{E}(X-Y)+Var(X)-Var(Y)$$
Now since $ Var(X)\neq Var(Y) $, we have that (X+Y) and (X-Y) are not independent as this implies that
$$\mathbb{E}[(X+Y)(X-Y)]\neq \mathbb{E}(X+Y)\mathbb{E}(X-Y)$$
(because if they were independent we would have to $ \mathbb{E}[(X+Y)(X-Y)]= \mathbb{E}(X+Y)\mathbb{E}(X-Y) $)
Example 3.4.18
Let X be a random variable having distribution $ b(n,p) $. Show that X has the same distribution as $ X_1+\dots +X_n $, with $ X_i $ being independent and identically distributed random variables that only take on the values 0.1. Calculate the expectation and variance of X.
We will prove that this holds when $ \mathbb{P}(X_i=1)=p $ for $ i=1,2,\dots,n. $
Now, notice that
$$\left[X_1+\dots +X_n=k\right]=\bigcup_{(i_1,i_2,\dots, i_n)\in \Pi}\left([X_{i_1}=1]\cap[X_{i_k}=1]\cap[X_{i_{k}+1}=0]\cap \dots \cap [X_{i_n}=0]\right)$$
in which $ \Pi $ is the set of all permutations $ (1,2,3,\dots,n) $. So
$$\mathbb{P}(X_1+\dots+X_n=k)=\sum_{(i_1,i_2,\dots, i_n)\in \Pi} \left(\mathbb{P}(X_1=1)\right)^k\left(1-\mathbb{P}(X_1=1)\right)^{n-k}=\binom{n}{k}p^k(1-p)^{n-k}, k=0,1,\dots,n.$$
So, $ X_1+\dots X_n \sim b(n,p) $. In this way;
$$\mathbb{E}(X)=\mathbb{E}(X_1+\dots +X_n)=n\mathbb{E}(X_1)=n(0(1-p)+1p)=np$$
$$Var(X)=Var(X_1+\dots+X_n)=nVar(X_1)$$
But
$$\mathbb{E}(X_1^2)=0^2(1-p)+1^2p=p$$
So,
$$Var(X_1)=\mathbb{E}(X_1^2)-\left(X_1\right)^2=p-p^2=p(1-p)$$
In this way we have to
$$Var(X)=np(1-p)$$
Example 3.4.19
Let (X,Y) be uniformly distributed in the following region:
(image missing)
Calculate $ Cov(X,Y) $.
We have to $ Cov(X,Y)=\mathbb{E}(XY)-\mathbb{E}(X)\mathbb{E}(Y) $. Now, X is symmetric about zero and bounded so integrable, so by example 3.3.1, we have that $ \mathbb{E}(X)=0 $.
So, $ Cov(X,Y)=\mathbb{E}(XY) $. Now, $ A=A_1\cup A_2 $, with $ A_1=((x,y): 0\leq x \leq 1, x-1\leq y\leq 1) $ and $ A_2=((x,y): -1\leq x< 0, -x-1\leq y\leq 1) $, then the area of $ A=3 $ soon

So,
$$\mathbb{E}(XY)=\int xy f(x,y)dxdy=\int_0^1\int_{x-1}^1 \frac{xy}{3}dxdy+\int_{-1}^0\int_{-x-1}^1 \frac{xy}{3}dxdy = \frac{1}{3}\int_{0}^1 x\left[\frac{y^2}{2}\right]_{x-1}^1dx + \frac{1}{3}\int_{-1}^0 x\left[\frac{y^2}{2}\right]_{-x-1}^1dx$$
$$=-\frac{1}{6}\left(\int_{0}^1 x^2(x-2)dx +\int_{-1}^0 x^2(x+2)dx\right)=-\frac{1}{6}\left(\left[\frac{x^4}{4}-\frac{2x^3}{3}\right]_0^1 +\left[\frac{x^4}{4}+\frac{2x^3}{3}\right]_{-1}^0\right) $$
$$=0$$
8.3.5 Conditional Expectation
In this module, we will define and present the main properties of conditional expectation, as an extension of the concept of conditional probability. Here, we present the concept of conditional hope through a simple approach full of examples. The definition of conditional hope with respect to a $ \sigma $-algebra can be found in the conditional expectation section with respect to a sigma-algebra.
Consider $ (\Omega, \mathcal{F}, \mathbb{P}) $ a probability space. The conditional probability of the event $ A $ given the event $ B $ is defined by
$$\displaystyle \mathbb{P}(A|B)=\frac{\mathbb{P}(A\cap B)}{\mathbb{P}(B)}$$
assuming that $ \mathbb{P}(B)> 0 $. Data $ X $ and $ Y $ discrete random variables taking on values $ \mathcal{R}_X=(x_1, x_2, \cdots , x_n) $ and $ \mathcal{R}_Y=(y_1, y_2, \cdots , y_m) $, respectively. A natural definition for conditional hope of $ X $ given $ Y=y $ is given by
$$\displaystyle \mathbb{E}[X|Y=y]=\sum_{x\in \mathcal{R}_X}x\mathbb{P}[X=x|Y=y], \quad y \in \mathcal{R}_Y.$$
Thus, we obtain that the conditional expectation of the random variable $ X $ given the random variable $ Y $, denoted by $ \mathbb{E}[X\mid Y] $, is a function of the random variable $ Y $ and with that, conditional expectation is also a random variable. Therefore, we have to
$$ \mathbb{E} \left[\mathbb{E}[X\mid Y]\right]=\sum_{y \in \mathcal{R}_Y} \mathbb{E}[X\mid Y=y] \mathbb{P}[Y=y]=\sum_{y \in \mathcal{R}_Y}\sum_{x\in \mathcal{R}_X}x\mathbb{P}[X=x|Y=y]\mathbb{P}[Y=y]=$$
$$\sum_{y \in \mathcal{R}_Y}\sum_{x\in \mathcal{R}_X}x \frac{\mathbb{P}[X=x;Y=y]}{\mathbb{P}[Y=y]}\mathbb{P}[Y=y]=\sum_{x\in \mathcal{R}_X}x \sum_{y \in \mathcal{R}_Y}\mathbb{P}[X=x;Y=y]=\sum_{x\in \mathcal{R}_X}x\mathbb{P}[X=x]=\mathbb{E}[X].$$
Next, we take $ X $ and $ Y $ discrete random variables taking values in enumerable sets $ \mathcal{R}_X=(x_1, x_2, \cdots) $ and $ \mathcal{R}_Y=(y_1, y_2, \cdots) $, respectively. The conditional hope of $ X $ given $ Y $ is defined in the form
$$\mathbb{E}[X|Y=y]=\sum_{x\in \mathcal{R}_X}x\mathbb{P}[X=x|Y=y],$$
if this series is well defined for all $ y \in \mathbb{R}_Y $. Likewise, if $ \mathbb{E}\mid X \mid <\infty $, we obtain that $ \mathbb{E}[\mathbb{E}(X\mid Y)]=\mathbb{E}(X) $.
Consider $ I_x=1!!1_{(X=x)} $ the event indicator function $ (X=x) $, which takes on the value $ 1 $ if $ X=x $ or zero otherwise. In this case, the conditional hope of $ I_x $ given the random variable $ Y $ is given by
$$\mathbb{E}[I_x\mid Y] = \sum_{i=0}^{1}i\mathbb{P}[I_x=i\mid Y=y]= \mathbb{P}[X=x\mid Y=y],$$
for everyone $ x \in \mathcal{R}_X $ and $ y \in \mathcal{R}_Y $. Thus, we obtain that conditional probability is a particular case of conditional expectation and, consequently, a random variable. In this case, we obtain that $ \mathbb{E}[\mathbb{P}[X=x\mid Y]]=\mathbb{E}[\mathbb{E}[I_x\mid Y]]=\mathbb{E}[I_x]=\mathbb{P}[X=x] $.
Now, consider $ (X,Y) $ an absolutely continuous random vector with joint probability density function $ f_{X,Y} $. The conditional density function of $ X $ given $ Y $ is defined by
$$\displaystyle f_{X|Y}(x,y)=\frac{f_{X,Y}(x,y)}{f_{Y}(y)},$$
in which $ f_Y $ is the probability density function of the random variable $ Y $. By definition, we have to
$$\mathbb{P}[a\leq X \leq b\mid y-\epsilon \leq Y \leq y+\epsilon]=\frac{\mathbb{P}[a\leq X \leq b;y-\epsilon \leq Y \leq y+\epsilon]}{\mathbb{P}[y-\epsilon \leq Y \leq y+\epsilon]}=\frac{\int_{a}^{b}\int_{y-\epsilon}^{y+\epsilon} f_{X,Y}(x,t)dxdt}{\int_{y-\epsilon}^{y+\epsilon}f_Y(t) dt}=$$
$$\frac{\int_{y-\epsilon}^{y+\epsilon} \int_{a}^{b}f_{X,Y}(x,t)dxdt}{\int_{y-\epsilon}^{y+\epsilon}f_Y(t) dt} \sim \int_{a}^b \frac{f_{X,Y}(x,y)}{f_Y(y)}dx,$$
for $ \epsilon > 0 $ small enough.
So, the conditional probability in this case is defined by
$$\displaystyle \mathbb{P}(a\leq X\leq b|Y=y)=\int_{a}^b f_{X|Y}(x,y)dx$$
and the conditional expectation of the random variable $ X $ given the random variable $ Y $ is defined by
$$\displaystyle \mathbb{E}[X|Y=y]=\int_{-\infty}^{\infty}xf_{X|Y}(x,y)dx.$$
Proposition 3.5.1
Be $ X $ and $ Y $ absolutely continuous random variables then
$$\displaystyle \mathbb{E}[X]=\mathbb{E}[\mathbb{E}(X\mid Y)]=\int_{-\infty}^{\infty}\mathbb{E}[X|Y=y]f_{Y}(y)dy$$
Demo:
$$\displaystyle \mathbb{E}[X]=\int_{-\infty}^{\infty}\mathbb{E}[X|Y=y]f_{Y}(y)dy$$
$$=\displaystyle\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}xf_{X|Y}(x,y)f_Y(y)dxdy$$
$$=\displaystyle\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}x\frac{f_{X,Y}(x,y)}{f_{Y}(y)}f_Y(y)dydx$$
$$=\displaystyle\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}xf_{X,Y}(x,y)dydx$$
$$=\displaystyle\int_{-\infty}^{\infty}x\int_{-\infty}^{\infty} f_{X,Y}(x,y)dydx$$
$$=\displaystyle \int_{-\infty}^{\infty}xf_X(x)dx=\mathbb{E}[X]$$
Example 3.5.1
A fair die is rolled until the number occurs $ 6 $. Let Y be the random variable that counts the number of times we roll the dice until the number occurs $ 6 $ and $ X $ the random variable that counts the number of ones we had in these releases. Let’s calculate $ \mathbb{E}[X|Y=y] $. The event $ Y=y $, it means we rolled the dice $ y $ times when, $ y-1 $ Sometimes we didn’t get the number $ 6 $ and then in $ y $-th release we got the number $ 6 $. So, given $ Y=y $, we have that X has a binomial distribution $ B(n,p) $, with $ n=y-1 $ and $ p=\frac{1}{5} $, because we have $ y-1 $ possibilities of the number having occurred $ 1 $. In fact, as we know that within these $ n $ releases the number $ 6 $ cannot have occurred, we only have the possibility of the following results $ (1,2,3,4,5) $, with equal probability for each of them. Therefore, the probability of occurrence of the event of interest (leave the number $ 1 $) is $ p=1/5 $. So, we have to
$$\displaystyle \mathbb{E}[X|Y=y]=np=\frac{y-1}{5}$$
How conditional expectation is a function of the random variable $ Y $, we know that $ \mathbb{E}[X|Y] $ is a random variable. In the example, we have to
$$\mathbb{E}[X|Y=y]=\displaystyle \frac{y-1}{5},$$
and thus, the random variable conditional expectation is given by
$$\mathbb{E}[X|Y]=\displaystyle \frac{Y-1}{5}.$$
Example 3.5.2
Using the same example as above, we will calculate $ \mathbb{E}[X^2|Y] $.
Note that again $ \mathbb{E}[X|Y=y] $ is a binomial, and yet its variance is given by
$$\mathbb{E}[X^2|Y=y]-(\mathbb{E}[X|Y=y])^2=np(1-p)=\displaystyle \frac{4(y-1)}{25}$$
We know from example 3.5.1 that
$$\displaystyle \mathbb{E}[X^2|Y=y]-\left(\frac{y-1}{5}\right)^2=\frac{4(y-1)}{25}$$
Therefore
$$\displaystyle \mathbb{E}[X^2|Y=y]=\frac{(y-1)^2}{25}+\frac{4(y-1)}{25}$$
So, we have to
$$\displaystyle \mathbb{E}[X^2|Y]=\frac{(Y-1)^2}{25}+\frac{4(Y-1)}{25}=\frac{Y^2+2Y-3}{25}$$
Example 3.5.3
Be $ X,Y\stackrel{iid}{\sim}B(n,p) $. Calculate $ \mathbb{E}[X|X+Y=y] $.
To do this, first we will calculate the conditional probability of $ X $ given $ X+Y=m $. For $ k\leq \min(n,m) $,
$$\mathbb{P}(X=k|X+Y=m)=\displaystyle \frac{\mathbb{P}(X=k,X+Y=m)}{\mathbb{P}(X+Y=m)}$$
$$=\displaystyle \frac{\mathbb{P}(X=k, Y=m-k)}{\mathbb{P}(X+Y=m)}$$
$$=\displaystyle \frac{\mathbb{P}(X=k)\mathbb{P}(Y=m-k)}{\mathbb{P}(X+Y=m)}$$

We use the fact that $ X+Y $ is a binomial $ 2n $ and $ p $. Therefore, the distribution of X, given $ X+Y=m $, has a hypergeometric distribution and we obtain
$$\displaystyle \mathbb{E}[X|X+Y=m]=\frac{m}{2}$$
Example 3.5.4
Suppose X and Y with joint density given by
$$f(x,y)=\displaystyle\frac{e^{-x/y}e^{-y}}{y},~~0< x<\infty,~~0< y< \infty$$
Calculate $ \mathbb{E}[X|Y=y] $.
To do this, we will first calculate the conditional density
$$f_{X|Y}(x|y)=\displaystyle \frac{f(x,y)}{f_Y(y)}=\frac{f(x,y)}{\int_{0}^{\infty}f_{X,Y}(x,y)}dx$$
$$=\displaystyle \frac{e^{-x/y}e^{-y}}{y\int_{0}^{\infty}e^{-x/y}e^{-y}/y}$$
$$=\displaystyle \frac{e^{-x/y}}{y}$$
Therefore, the conditional distribution of $ X $ given $ Y=y $, has an exponential distribution with mean y.
So
$$\displaystyle \mathbb{E}[X|Y=y]=\int_{0}^{\infty}\frac{x}{y}e^{-x/y}dx=y\Rightarrow \mathbb{E}[X|Y]=Y$$
Example 3.5.5
Let X and Z be random variables in $ (\Omega, \mathbb{A}, \mathbb{P}) $
(a) Show that for Borelian A and B,

So, if $ x\in A $ which implies that
$$\mathbb{P}(X\in A| X=x)=1$$
which implies that
$$\mathbb{P}(Z\in B,X\in A|X=x)=\mathbb{P}(Z\in B|X=x)=\mathbb{P}(Z\in B|X=x)$$
Now if $ x\notin A $, then $ \mathbb{P}(X\in | X=x)=0 $ then
$$\mathbb{P}(Z\in B,X\in A| X=x)\leq \mathbb{P}(X\in A| X=x)=0$$
which implies that
$$\mathbb{P}(Z\in B, X\in A|X=x)=0\Rightarrow \mathbb{P}(Z\in B, X\in A| X=x)=0$$
(b) Show that if $ \mathbb{P}(Z\in B|X=x)\geq \frac{1}{2} $, for all $ x\in A $, then $ \mathbb{P}(Z\in B|X\in A)\geq \frac{1}{2} $
we have to:

Now if we assume
$$\mathbb{P}(X\in A)> 0,$$
then
$$\mathbb{P}(Z\in B|X\in A)=\frac{\mathbb{P}(Z\in B,X\in A)}{\mathbb{P}(X\in A)}\geq \frac{\frac{1}{2}\mathbb{P}(X\in A)}{\mathbb{P}(X\in A)}\geq \frac{1}{2}$$
(c) Let X and Y be independent such that $ \mathbb{P}(Y\geq 0)\geq \frac{1}{2} $. Demonstrate that $ \mathbb{P}(X+Y\geq a| X\geq a)\geq \frac{1}{2} $.
We assume that $ \mathbb{P}(X\geq a)> 0 $, then:
$$\mathbb{P}(X+Y\geq a | X\geq a)=\frac{\mathbb{P}(X+Y\geq a, X\geq a)}{\mathbb{P}(X\geq a)}\geq \frac{\mathbb{P}(Y\geq 0, X\geq 0)}{\mathbb{P}(X\geq a)}$$
$$=\frac{\mathbb{P}(Y\geq 0)\mathbb{P}(X\geq a)}{\mathbb{P}(X\geq a)}=\mathbb{P}(Y\geq 0)\geq \frac{1}{2}$$
Now, if $ \mathbb{P}(X\geq a)=0 $, we can arbitrarily define and assume that
$$\mathbb{P}(X+Y\geq a| X\geq a)=\frac{1}{2}$$
of equality above the fact that $ \mathbb{P}(Y\geq 0)\geq \frac{1}{2} $, and therefore the result follows.
Example 3.5.6
Prove: if X is constant almost certainly, i.e., $ \mathbb{P}(X=c)=1 $, then $ \mathbb{P}(X=c| Y=y)=1 $. Deduct property if $ X=c $, for some constant c, then
$$\mathbb{E}(X|Y)=c$$
Let’s take, $ I=(a,b) $ in which $ a,b\in \mathbb{Q} $ and $ a< y< b $, then
$$\mathbb{P}(X=c, Y\in I)=\mathbb{P}(Y\in I)$$
because $ \mathbb{P}(X=C)=1 $. So, we have to

So,
$$\mathbb{E}(X|Y=y)=C\mathbb{P}(X=C|Y=y)=C$$
if $ \mathbb{P}(X=C)=1 $.
Example 3.5.7
Let X and Y be random variables such that $ \mathbb{E}(X^2)< \infty $ and $ \mathbb{E}(Y^2)< \infty $. Demonstrate that $ Cov(X,Y)=Cov(X, \mathbb{E}(Y|X)) $.
Initially, we have from Cauchy-Schwarz that XY is integrable, since
$$\mathbb{E}(|XY|)\leq \sqrt{\mathbb{E}(X^2)\mathbb{E}(Y^2)}< \infty$$
Naturally, as X and Y are integrable, we use the basic property

$$Cov(X,Y)=\mathbb{E}(XY)-\mathbb{E}(X)\mathbb{E}(Y)=\mathbb{E}(X\mathbb{E}(Y|X))-\mathbb{E}(X)(\mathbb{E}(Y|X))=Cov(X,\mathbb{E}(Y|X))$$
Example 3.5.8
I suppose that X and Y have joint density

(a) Find the conditional distribution of Y given X. Calculate $ \mathbb{E}(Y|X) $.
Using example 2.7.5, in which $ A=((x,y)\in \mathbb{R}^2,x^2+y^2\leq 1) $
we have to $ Y|X=x $ has a uniform distribution in $ A_X $, in which $ A_X=(y:(x,y)\in A)=[-\sqrt{1-x^2},\sqrt{1-x^2}] $
So,

(b) Are X and Y independent? Why ?
No, because

and then to $ (x,y)\in A $ we have to
$$f_X(x)f_Y(y)=\frac{4}{\pi^2}[(1-x^2)(1-y^2)]^{1/2}\neq \frac{1}{\pi}=f_{X,Y}(x,y)$$
So, $ ((x,y):f_{X,Y}(x,y)\neq f_X(x)f_Y(y))\subset A $, and A has a positive Lebesgue measure $ (Area(A)=\pi) $, then $ X $ and $ Y $ are not independent.
(c) Prove that X and Y are uncorrelated
By Example 3.5.8:
$$COV(X,Y)=COV(X,\mathbb{E}(Y|X))=\mathbb{E}(X\mathbb{E}(Y|X))-\mathbb{E}(X)\mathbb{E}(\mathbb{E}(Y|X))=\mathbb{E}(X.0)-\mathbb{E}(X)0=0$$
so X and Y are not correlated.
Example 3.5.9
Let X be a standard Cauchy random variable.
(a) According to Definition 4.3, what is $ \mathbb{E}(X||X|=y) $?
As X is symmetric around zero, using example 2.6.12, we have
$$\mathbb{P}(X=y||X|=y)=\mathbb{P}(X=-y||X|=y)=\frac{1}{2}$$
So,
$$\mathbb{E}(X||X|=y)=y\frac{1}{2}+(-y)\frac{1}{2}=0$$
(b) Deduce that $ \mathbb{E}(\mathbb{E}(X||X|))=0 $.
From item (a)
$$\mathbb{E}(X||X|=y)=0$$
then $ \mathbb{E}(\mathbb{E}(X||X|))=\mathbb{E}(X||X|)=0 $
(c) The basic property $ \mathbb{E}(\mathbb{E}(X|Y))=\mathbb{E}(X) $ is not valid in this case. Is there a contradiction in this?
No, it turns out that the basic property was proven using the hypothesis that X is integrable, which does not happen in this case;
Example 3.5.10
Se $ X\geq 0 $, it turns out that $ \mathbb{E}(X)=\mathbb{E}(\mathbb{E}(X|Y)) $ without the hypothesis of integrability of X. Prove this result when X and Y are discrete.
If X is a random variable and $ X\geq 0 $ then $ X|Y=y $ is a discrete and non-negative random variable like this
$$\mathbb{E}(X|Y=y)=\sum_{n=0}^\infty \mathbb{P}(X> n|Y=y)$$
Now Y is a discrete random variable that takes values in $ y_m $, $ m=\pm 1, \pm 2, \dots $, then
$$\mathbb{P}(X\in B| Y=y_n)=\frac{\mathbb{P}(X\in B, Y=y_m)}{\mathbb{P}(Y=y_m)}$$
for $ \mathbb{P}(Y=y_m)> 0 $, then
$$\mathbb{E}(X|Y=y_m)=\sum_{n=0}^\infty \mathbb{P}(X> n| Y=y_n)=\sum_{n=0}^\infty \frac{\mathbb{P}(X> n, Y=y_m)}{\mathbb{P}(Y=y_m)}$$
And then
$$\mathbb{E}(\mathbb{E}(X|Y))=\sum_{m\in \mathbb{Z}}\mathbb{P}(Y=y_m)\sum_{n=0}^\infty \frac{\mathbb{P}(X> n, Y=y_m)}{\mathbb{P}(Y=y_m)} = \sum_{m\in \mathbb{Z}}\sum_{n=0}\mathbb{P}(X> n, Y=y_m)$$
Now, how $ \mathbb{P}(X> n, Y=y_m)\geq 0 $, for all $ n\geq 0 $ and $ m\in \mathbb{Z}^\star $, we can invert the sums and
$$\mathbb{E}(\mathbb{E}(X|Y))=\sum_{n=0}\sum_{m\in \mathbb{Z}^\star}\mathbb{P}(X> n,Y=y_m)=\sum_{n=0}\mathbb{P}([X> n]\bigcup_{m\in \mathbb{Z}^\star}[y=y_m])$$
$$\sum_{n=0}^\infty \mathbb{P}([X> n]\cap \Omega)=\sum_{n=0}^\infty \mathbb{P}(X> n)=\mathbb{E}(X)$$
Example 3.5.11
The number of accidents that occur in a certain factory in a week is a random variable with mean $ \mu $ and variance $ \sigma^2 $. The numbers of individuals injured in different accidents are independent and identically distributed with an average $ \xi $ and variance $ \tau^2 $, and are independent of the number of accidents. Determine the mean and variance of the number of individuals injured in a week.
Be $ N $=number of accidents in a week: Discrete and non-negative random variable with

and $ X=F_1+F_2+\dots+F_N $ number of injuries in a week. We have to $ X $ It is also a discrete and non-negative random variable and, in example 3.5.10, the basic property holds:
$$\mathbb{E}(X)=\mathbb{E}(\mathbb{E}(X|N=n)).$$
Now
$$\mathbb{E}(X|N=n)=\mathbb{E}(F_1+\dots+F_N)=N\mathbb{E}(F_1)=N$$
then $ \mathbb{E}(X)=\mathbb{E}(N\xi)=\xi\mathbb{E}(N)=\xi\mu $
We also have to $ X^2 $ is v.a. discrete and non-negative and then:
$$\mathbb{E}(X^2)=\mathbb{E}(\mathbb{E}(X^2|N=n))$$
Now
$$\mathbb{E}(X^2|N=n)=\mathbb{E}((F_1+\dots+F_N)^2)=Var(F_1+\dots+F_N)+\left(\mathbb{E}(F_1+\dots+F_n)\right)^2$$
$$=NVar(F_1)+(N\mathbb{E}(F_1))^2=N\tau^2+N^2\xi^2$$
So,
$$\mathbb{E}(X^2)=\mathbb{E}(N\tau^2+N^2\xi^2)=\tau^2\mathbb{E}(N)+\xi^2\mathbb{E}(N^2)=\tau^2\mu+\xi^2(\sigma^2+\mu^2)$$
And then
$$Var(X)=\mathbb{E}(X^2)-(\mathbb{E}(X))^2=\tau^2\mu+\xi^2(\sigma^2+\mu^2)-(\xi\mu)^2=\tau^2\mu+\xi^2\sigma^2$$
Example 3.5.12
Calculate $ \mathbb{E}(X_{(2)}|X_{(1)},X_{(3)}) $, in which $ X_{(1)},X_{(2)} $ and $ X_{(3)} $ are the order statistics of a random sample from the $ U[0,1] $.
Using example 3.5.5(b), we have that $ X_{(2)}|(X_{(1)},X_{(3)})=(x_{(1)},x_{(3)})\sim U[x_{(1)}],x_{(3)} $, then
$$\mathbb{E}(X_{(2)}|X_{(1)},X_{(3)})=\frac{X_{(1)}+X_{(3)}}{2}$$
Example 3.5.13
Let X be a random variable with exponential distribution of parameter 1. Let $ t> 0 $ fixed. Find $ \mathbb{E}(X|\max(X,t)) $ and $ \mathbb{E}(X|\min(X,t)) $.
Be $ Z=\max(X,t) $ and $ W=\min(X,t) $. Let us first obtain the distribution of $ X|Z=z $
\textbf{a1)} $ 0\leq t\leq z $ then $ \max(X,t)=z> t\Rightarrow X=z $. So our conditional distribution candidate will be
$$\mathbb{P}(X=z)=1$$
which implies that
$$\mathbb{E}(X|z)=z$$
a2) $ z=t $ then using the principle of preserved relative chances, the conditional distribution candidate will be

Formally we should check
$$\mathbb{P}(X\in B| Y=y)=\lim_{\Delta y\rightarrow 0}\mathbb{P}(X\in B| Y\in I)$$
or
$$F_{X,Y}(x,y)=\int_{-\infty}^y F_X(x|Y=t)dF_Y(t),(x,y)\in \mathbb{R}^2$$
to validate the choices of the conditional distributions, but assuming that these are the same correct we have to

Now making a replacement $ x=u $ and $ \lambda e^{-\lambda x}dx=dv $ and
$$\frac{\int_0^tx e^{-\lambda x}dx}{1-e^{-\lambda t}}=\frac{-xe^{-\lambda x}\big|_0^t+\int_0^t e^{-\lambda x}dx}{1-e^{-\lambda t}}$$
$$=\frac{\frac{1}{\lambda}(1-e^{-\lambda t})-te^{-\lambda t}}{(1-e^{-\lambda t})}=\frac{1}{\lambda} -\frac{te^{-\lambda t}}{(1-e^{-\lambda t})},z=t$$
So,

Similarly, we conclude that the distribution $ X|W=w $ will be
b1) $ 0\leq w< t $ which implies that $ \min(X,t)=w< t $ which implies that $ X-w $. So,
$$\mathbb{P}(X=w)=1$$
\textbf{b2)} $ W=t $, by the principle of preservation of relative chances we have

Example 3.5.14
Show that if X and Y are random variables, then
$$F_{X,Y}(x,y)\leq \sqrt{F_X(x)F_Y(y)}$$

then, applying the Cauchy-Schwarz inequality, then


$$\mathbb{P}(X\leq x, Y\leq y)\leq \sqrt{\mathbb{P}(X\leq x)\mathbb{P}(Y\leq y)}\Rightarrow F_{X,Y}(x,y)\leq \sqrt{F_X(x)F_Y(y)}.$$
Example 3.5.15
Be $ (X,Y) $ a two-dimensional random vector. Suppose $ (i) $ X has an exponential distribution with parameter $ \frac{1}{2} $ and $ (ii) $ for each $ x> 0, $ the conditional distribution of Y given that $ X=x $ is $ U[0,x^2] $. In other words, $ X\sim Exp\left(\frac{1}{2}\right) $ and $ Y|X=x\sim U[0,x^2] $.
(a) What is the distribution of $ Z=Y|X^2=t $?
Our candidate will be $ Z\sim U[0,t] $, we will check this using
$$\mathbb{P}(X\in B| Y=y)=\lim_{\Delta y\rightarrow 0}\mathbb{P}(X\in B| Y\in I)$$
Be $ I=(a,b) $ in which $ 0< a< t< b $, so
$$\mathbb{P}(X^2\in I)=\mathbb{P}(a< X^2< b)=\mathbb{P}(\sqrt{a}< X<\sqrt{b})=\mathbb{P}(X\in I^{1/2})$$
in which, $ I^{1/2}=(a^{1/2},b^{1/2}) $ and $ t^{1/2}\in I^{1/2} $. Furthermore,
$$\displaystyle \lim_{a\rightarrow t, b\rightarrow t}\frac{\mathbb{P}(Y\in B, X^2\in I)}{\mathbb{P}(X^2\in I)}=\lim_{a\rightarrow t, b\rightarrow t}\frac{\mathbb{P}(Y\in B, X\in I^{1/2})}{\mathbb{P}(X\in I^{1/2})}$$
$$=\lim_{\sqrt{a}\rightarrow t, \sqrt{b}\rightarrow t}\frac{\mathbb{P}(Y\in B, X^2\in I)}{\mathbb{P}(X^2\in I)}=\mathbb{P}(Y\in B| X=\sqrt{t})$$
By hypothesis we have $ Y|X=x\sim U[0,x^2]. $
$$\mathbb{P}(Y\in B| X=\sqrt{t})=\frac{Comp(B\cap [0,t])}{t}$$
So $ Y|X^2=t\sim U[0,t] $.
(b) Calculate $ \mathbb{E}(X) $, $ \mathbb{E}(Y) $ and $ Cov(X,Y) $.
Initially $ \mathbb{E}(X)=\mathbb{E}(\exp(\frac{1}{2}))=2 $ and how $ Y $ is non-negative v.a., through the fundamental property $ Y $Example 3.5.11, we have
$$\mathbb{E}(Y)=\mathbb{E}(\mathbb{E}(Y|X=x))$$
Now $ \mathbb{E}(Y|X=x)=\frac{x^2}{2} $, then
$$\mathbb{E}(Y)=\mathbb{E}\left(\frac{X^2}{2}\right)=\frac{1}{2} \mathbb{E}(X^2)=4$$
The last equality arises from the fact that $ X\sim \exp(1/2) $ and then $ \mathbb{E}(X^2)=\frac{2}{(1/2)^2}=8 $. Similarly $ XY $ is v.a. non-negative, then
$$\mathbb{E}(XY)=\mathbb{E}(\mathbb{E}(XY|X))$$
By the substitution principle we have
$$\mathbb{E}(X\mathbb{E}(Y|X))=\mathbb{E}(XX^2/2)=\frac{1}{2}\mathbb{E}(X^3)=24$$
in which the last equality follows from $ X\sim \exp(1/2) $ and $ \mathbb{E}(X^3)=\frac{6}{(1/2)^3}=48 $. So,
$$Cov(X,Y)=\mathbb{E}(XY)-\mathbb{E}(X)\mathbb{E}(Y)=24-2(4)=16$$
Example 3.5.16
Let X and Y be random variables such that $ Y $ has finite hope.
(a) Show that the conditional variance of Y given X, as defined in example 2.7.2, is the variance of the conditional distribution.
$$Var(Y|X=x)=\mathbb{E}[(Y|X=x)^2]-[\mathbb{E}(Y|X=x)]^2=\mathbb{E}(Y^2|X=x)-\mathbb{E}^2(Y|X=x)$$
(b) Show that $ Var(Y)=\mathbb{E}(Var(Y|X))+Var(\mathbb{E}(Y|X)) $, i.e., the variance of Y is the sum of the expected conditional variance and the variance of the conditional expectation.
We assume that $ Var(Y)< \infty $ if, and only if, $ \mathbb{E}(Y^2)< \infty $.
$$\mathbb{E}(Var(X|Y))=\mathbb{E}(\mathbb{E}(Y^2|X))-\mathbb{E}(\mathbb{E}^2(Y|X))=\mathbb{E}(Y^2)-\mathbb{E}(\mathbb{E}^2(Y|X))$$
in which the last equality we have $ \mathbb{E}(Y^2)< \infty $ and $ Y^2 $ is integrable. Furthermore, we have to
$$Var(\mathbb{E}(Y|X))=\mathbb{E}(\mathbb{E}^2(Y|X))-\left(\mathbb{E}(\mathbb{E}(Y|X))\right)^2=\mathbb{E}(\mathbb{E}^2(Y|X))-(\mathbb{E}(Y))^2$$
So
$$\mathbb{E}(Var(X|Y))+Var(\mathbb{E}(Y|X))=\mathbb{E}(Y^2)-\mathbb{E}^2(Y)=Var(Y)$$
Example 3.5.17
Let X and Y be random variables with finite second moments, and let Z be another random variable. Demonstrate the following formula:
$$Cov(X,Y)=\mathbb{E}(Cov(X,Y)|Z)+Cov(\mathbb{E}(X|Z), \mathbb{E}(Y|Z)),$$
in which $ Cov((X,Y)|Z)=\mathbb{E}(XY|Z)-\mathbb{E}(X|Z)\mathbb{E}(Y|Z) $.
How $ \mathbb{E}(Y^2)< \infty $ and $ \mathbb{E}(X^2)< \infty $, then $ Y^2,X^2,Y,X $ are integrable and therefore by Cauchy-Schwarz $ XY $ is integrable
$$\mathbb{E}(Cov(X,Y)|Z)=\mathbb{E}(\mathbb{E}(XY|Z))-\mathbb{E}(\mathbb{E}(X|Z)\mathbb{E}(Y|X))=\mathbb{E}(XY)- \mathbb{E}(\mathbb{E}(X|Z))\mathbb{E}(Y|Z)$$
and
$$Cov(\mathbb{E}(X|Z),\mathbb{E}(Y|Z))=\mathbb{E}(\mathbb{E}(X|Z)\mathbb{E}(Y|Z))-(\mathbb{E}(\mathbb{E}(X|Z))\mathbb{E}(\mathbb{E}(Y|Z)))$$
$$\mathbb{E}(\mathbb{E}(X|Z)\mathbb{E}(Y|Z))-\mathbb{E}(X)\mathbb{E}(Y)$$
So
$$\mathbb{E}(Cov(X,Y)|Z)+Cov(\mathbb{E}(X|Z),\mathbb{E}(Y|Z))=\mathbb{E}(XY)-\mathbb{E}(X)\mathbb{E}(Y)=Cov(X,Y)$$
Example 3.5.18
Suppose that in a storm, the number X of raindrops that fall on IMPA during one second has a Poisson distribution with parameter $ \lambda> 0 $, in which $ \lambda $ represents the intensity of rain. Suppose the parameter $ \lambda $ is a random variable that has a gamma distribution with parameters $ \alpha> 0 $ and $ \beta=1 $, i.e. its density is given by

(a) Show that
$$\mathbb{P}(X=k)=\frac{\Gamma(k+\alpha)}{\Gamma(\alpha)\Gamma(k+1)}\left(\frac{1}{2}\right)^{k+\alpha}, k=0,1,2,\dots$$
We have to: $ X|\lambda=s\sim Poisson(s) $, then
$$\mathbb{P}(X=k)=\int_{-\infty}^\infty \mathbb{P}(X=k|\lambda=s)dF_{\lambda}(s)=\int_0^\infty \left(\frac{s^k}{k!}e^{-s}\right)\frac{1}{\Gamma(\alpha)}s^{\alpha-1}e^{-s}ds$$
$$=\frac{\Gamma(k+\alpha)}{\Gamma(\alpha)\Gamma(k+1)}\int_0^\infty \frac{s^{k+\alpha-1}e^{-2s}}{\Gamma(k+\alpha)} e^{-2s}ds = \frac{\Gamma(k+\alpha)}{\Gamma(\alpha)\Gamma(k+1)}\frac{1}{2^{k+\alpha-1}}\int_0^\infty \frac{2s^{(k+\alpha)-1}e^{-2\lambda}}{\Gamma(k+\alpha)}ds$$
making a variable change $ t=2s $ and $ dt=2ds $ then
$$\frac{\Gamma(k+\alpha)}{\Gamma(\alpha)\Gamma(k+1)}\left(\frac{1}{2}\right)^{k+\alpha-1}\frac{1}{2}\int_0^\infty \frac{t^{k+\alpha-1}}{\Gamma(k+\alpha)}e^{-t}dt=\frac{\Gamma(k+\alpha)}{\Gamma(\alpha)\Gamma(k+1)}\left(\frac{1}{2}\right)^{k+\alpha-1}\frac{1}{2}$$
for $ k=1,2,\dots. $
(b) Using probabilistic methods, demonstrate that
$$\sum_{k=1}^\infty \binom{k+n-1}{n}\frac{1}{2^k}=2^n,\quad\quad para\quad n=1,2,\dots.$$
We have to,
$$\mathbb{E}(X)=\mathbb{E}(\mathbb{E}(X|s=\lambda)),$$
Now $ X|s=\lambda\sim Poisson(\lambda) $ then $ \mathbb{E}(X|s=\lambda)=\lambda $. So,
$$\mathbb{E}(X)=\mathbb{E}(\mathbb{E}(X|s=\lambda))=\int_0^\infty \frac{\lambda \lambda^{\alpha-1}e^{-\lambda}}{\Gamma(\lambda)}d\lambda$$
$$=\frac{\Gamma(\alpha+1)}{\Gamma(\alpha)}\int_0^\infty \frac{\lambda^\alpha}{\Gamma(\alpha+1)}e^{-\lambda}d\lambda=\frac{\Gamma(\alpha+1)}{\Gamma(\alpha)}=\alpha$$
Now, calculating the expectation of
$$\mathbb{E}(X)=\displaystyle \sum_{k=0}^\infty k\mathbb{P}(X=k)=\sum_{k=0}^\infty k\frac{\Gamma(k+\alpha)}{\Gamma(\alpha)\Gamma(k+1)}\left(\frac{1}{2}\right)^{k+\alpha}$$
$$=\sum_{k=1}^\infty \frac{\Gamma(k+\alpha)}{\Gamma(\alpha)\Gamma(k)}\left(\frac{1}{2}\right)^{k+\alpha}=\sum_{k=1}^\infty \frac{(k+\alpha-1)!}{(\alpha-1)!(k-1)!}\frac{1}{2^{k+\alpha}}$$
$$=\alpha\frac{1}{2^{\alpha}}\sum_{k=1}^\infty \binom{k+\alpha-1}{\alpha}\frac{1}{2^k}$$
Now, using the above equalities, we have
$$\alpha\frac{1}{2^{\alpha}}\sum_{k=1}^\infty \binom{k+\alpha-1}{\alpha}\frac{1}{2^k}=\alpha$$
which implies that
$$\sum_{k=1}^\infty \binom{k+\alpha-1}{\alpha}\frac{1}{2^k}=2^{\alpha}$$
Now doing $ n=\alpha=1,2,3,\dots $ we have to
$$\sum_{k=1}^\infty \binom{k+n-1}{n}\frac{1}{2^k}=2^{n},\quad\quad n=1,2,3,\dots$$
Example 3.5.19
Calculate $ \mathbb{E}(X_k|X=t) $ in exercise 23;
We have to $ X_k $ is a random variable with distribution

we have to
$$\mathbb{E}(X)=-\int_{-\infty}^0 F_X(x)dx+\int_0^\infty(1-F_X(x))dx$$
So,
$$\mathbb{E}(X_k|X=t)=-\int_{-\infty}^0 F_{X_k|X=t}(x)dx+\int_0^\infty(1-F_{X_k|X=t}(x))dx$$
Now, if $ t\leq 0 $, then
$$\mathbb{E}(X_k|X=t)=-\left[\int_{-\infty}^t \frac{(n-1)F(x)}{nF(t)}dx+\int_t^0 dx\right]=t-\frac{(n-1)}{nF(t)}\int_{-\infty}^t F(x)dx$$
and if $ t> 0 $, we have
$$\mathbb{E}(X_k|X=t)=-\int_{-\infty}^0 \frac{(n-1)}{n}\frac{F(x)}{F(t)}dx+\int_0^t\left(1-\frac{n-1}{n}\frac{F(x)}{F(t)}\right)dx$$
$$=-\frac{(n-1)}{nF(t)}\int_{-\infty}^0 F(x)dx+t-\frac{(n-1)}{nF(t)}dx=t-\frac{(n-1)}{nF(t)}\int_{-\infty}^tF(x)dx$$
So from the above equations we have
$$\mathbb{E}(X_k|X=t)=t-\frac{(n-1)}{nF(t)}\int_{-\infty}^0F(x)dx, \quad\quad \forall t \in \mathbb{R}$$
Example 3.5.20
Determine $ \mathbb{E}(X|Y) $ and $ \mathbb{E}(Y|X) $ in example 2.7.3. Calculate $ Cov(X,Y) $. $ X $ and $ Y $ Are they independent?
$ f_{X,Y}(x,y)=\frac{1}{2x},\quad\quad (x,y)\in A, $ in which $ A=((x,y):0\leq x\leq 1,-x\leq y\leq x) $. According to the principle of relative flame preservation, we have to

We also have to: $ Y|X=x\sim U[-x,x]\Rightarrow \mathbb{E}(Y|X=x)=0, x\in [0,1] $. Now we also have to $ Y $ is integrable because $ |y|\leq 1 $ and $ XY $ is integrable because $ |XY|=|X||Y|\leq 1 $. So,
$$Cov(X,Y)=\mathbb{E}(XY)=\mathbb{E}(X)\mathbb{E}(Y)=\mathbb{E}(\mathbb{E}(XY|X))-\mathbb{E}(X)\mathbb{E}(Y|X)=\mathbb{E}(X\mathbb{E}(Y|X=x)) -\mathbb{E}(X)\mathbb{E}(\mathbb{E}(Y|X))=\mathbb{E}(X 0)-\mathbb{E}(X)\mathbb{E}(0)=0$$
However, X and Y are not independent because for $ (x,y)\in B=(A^c\cap [0,1]\times(-1,1)) $.
$$f_X(x)f_Y(y)=1(-\ln{(|y|)})=-\ln{|y|}\neq 0=f_{X,Y}(x,y)$$
As the Lebesgue measure of $ B $ is not null then $ X $ and $ Y $ are not independent.
Example 3.5.21
A number between 0 and 1 is selected at random. If x is the selected number, a coin with probability x of coming up “heads” is tossed n times. Let Y be the random variable that represents the number of heads tossed.
(a) Is Y a discrete or continuous random variable?
$ Y $ is a discrete variable because the possible outcomes of Y are $ 0,1,2,3,\dots $
(b) Calculate the expectation and variance of Y.
$ Y $ and $ Y^2 $ are v.a. non-negative so for them the basic properties hold we have to $ X\sim U[0,1] $ which implies that $ \mathbb{E}(X)=1/2 $ and $ \mathbb{E}(X^2)=1/3 $ and $ Y|X=x\sim b(n,x) $ what does it imply $ \mathbb{E}(Y|X=x)=nx $ and $ \mathbb{E}(Y^2|X=x)=nx(1-x)+(nx)^2 $. And then
$$\mathbb{E}(Y)=\mathbb{E}(\mathbb{E}(Y|X=x))=\mathbb{E}(nX)=n\mathbb{E}(X)=\frac{n}{2}$$
and
$$\mathbb{E}(Y^2)=\mathbb{E}(\mathbb{E}(Y^2|X=x))=\mathbb{E}(nX-nX^2+n^2X^2)=n\mathbb{E}(X)+n(n-1)\mathbb{E}(X^2)=\frac{n}{2}+\frac{n(n-1)}{3}$$
and therefore,
$$Var(Y)=\mathbb{E}(Y^2)-\mathbb{E}^2(Y)=\frac{n}{2}+\frac{n(n-1)}{3}-\frac{n^2}{4}=\frac{6n+4n^2-4n-3n^2}{12}\Rightarrow Var(Y)=\frac{n(n+2)}{12}$$
Example 3.5.22
(a) Show that if $ X $ and $ Y $ are independent, so
$$\mathbb{P}(X< Y)=\int_{-\infty}^\infty (1-F_{Y}(x))dF_X(x).$$


$$=\mathbb{E}(1-F_Y(x))=\int_{-\infty}^\infty (1-F_Y(x))dF_X(x)$$
(b) Let X and Y be independent, X parameter exponential $ \lambda $ and uniform Y in $ [0,\lambda] $, in which $ \lambda> 0 $. Calculate
$$\mathbb{P}(X< Y),\mathbb{P}(X> Y)$$
and
$$\mathbb{P}(X= Y)$$
In this case, we have to
$$\mathbb{P}(X< y)=\int_{-\infty}^\infty (1-F_Y(x))dF_X(x)=\int_0^\lambda (1-x/\lambda)\lambda e^{-\lambda x}dx+ \int_{\lambda}^\infty (1-1)\lambda e^{-\lambda x}dx$$
$$=\int_0^\lambda \lambda e^{-\lambda x}dx-\frac{1}{\lambda}\int_0^\lambda x\lambda e^{-\lambda x}dx=1-e^{-\lambda^2}-\frac{1}{\lambda}\int_0^\lambda x\lambda e^{-\lambda x}dx$$
Now,
$$\int_0^\lambda x\lambda e^{-\lambda x}dx=-xe^{-\lambda x}\bigg|_0^{\lambda}+\int_0^\lambda e^{-\lambda x}dx=-\lambda e^{-\lambda^2}-\frac{e^{-\lambda x}}{\lambda}\bigg|_0^\lambda$$
$$=-\lambda e^{-\lambda^2}+\frac{1}{\lambda}-\frac{1}{\lambda}e^{-\lambda^2}$$
So,
$$\mathbb{P}(X< y)=1-e^{-\lambda^2}+e^{-\lambda^2}-\frac{1}{\lambda^2}+\frac{1}{\lambda^2}e^{-\lambda^2} =1-\frac{1}{\lambda^2}(1-e^{-\lambda^2})$$
Now
$$\mathbb{P}(Y< X)=\int_{-\infty}^\infty (1-F_X(y))dF_Y(y)=\int_0^\lambda e^{-\lambda y}\frac{1}{\lambda}dy=-\frac{e^{-\lambda y}}{\lambda^2}\bigg|_0^\lambda=\frac{1}{\lambda^2}(1-e^{-\lambda^2})$$
And how
$$\mathbb{P}(X> Y)+\mathbb{P}(X< Y)+\mathbb{P}(X=Y)=1,$$
because $ \Omega=[X> Y]\cup[X< Y]\cup [X=Y] $ we have
$$\mathbb{P}(X=Y)=1-\mathbb{P}(X> Y)-\mathbb{P}(X< Y)=1-\frac{1}{\lambda^2}(1-e^{-\lambda^2})=1$$
Example 3.5.23
Customers enter a supermarket according to a Poisson process with parameter $ \lambda $. There is light in the supermarket as long as a fuse installed in time does not blow $ t=0 $, and whose useful life T has an exponential distribution with parameter $ \xi $. What is the expected number of customers entering the supermarket while there is electricity?
We have to $ (X_t)_{t\geq 0} $ is a process of $ Poisson(\lambda) $ and T is a random variable $ Exp(\xi) $ then $ \mathbb{E}(T)=\frac{1}{\xi} $
Y is the number of customers who enter the supermarket while the light is on. So $ Y=X_T $, in which T is a random variable with distribution $ Exp(\lambda) $. Now $ (Y|T=t)= X_t\sim Poisson(\lambda t) $ which implies that $ \mathbb{E}(Y|T=t)=\lambda t $. But Y is v.a. non-negative, so the basic property holds for it and then
$$\mathbb{E}(Y)=\mathbb{E}(\mathbb{E}(Y|T=t))=\mathbb{E}(\lambda T)=\lambda\mathbb{E}(T)=\frac{\lambda}{\xi}$$
8.3.5.1 Properties of Conditional Expectation
Theorem 3.5.1.1
Let X,Y and Z be v.a’s and $ a,b\in\mathbb{R} $ and $ g:\mathbb{R}\rightarrow \mathbb{R} $. Assuming that all of the following conditional expectations exist, we have
P1) $ \mathbb{E}[a|Y]=a $
P2) $ \mathbb{E}[aX+bY|Z]=a\mathbb{E}[X|Z]+b\mathbb{E}[Y|Z] $
P3) $ \mathbb{E}[X|Y]\geq 0 $ if $ X\geq 0 $
P4) $ \mathbb{E}[X|Y]=\mathbb{E}[X] $ if X is independent of Y.
P5) $ \mathbb{E}[\mathbb{E}[X|Y]]=\mathbb{E}[X] $
P6) $ \mathbb{E}[Xg(Y)|Y]=g(Y)\mathbb{E}[X|Y] $. In particular $ \mathbb{E}[g(Y)|X]=g(Y) $
P7) $ \mathbb{E}[X|Y,g(Y)]=\mathbb{E}[X|Y] $
P8) $ \mathbb{E}[\mathbb{E}[X|Y,Z]|Y]=\mathbb{E}[X|Y] $
Demo
Proofs will be made for the continuous case, for the discrete case it is done in a similar way
P1)
$$\mathbb{E}[a|Y]=a\mathbb{P}(a|Y)=a$$
Q2)Firstly note that
$$\mathbb{E}[aX+bY|Z]=\displaystyle \int_{-\infty}^{\infty}\int_{-\infty}^{\infty}(ax+by) f_{X,Y|Z}(X,Y|Z)dxdy$$
$$=\displaystyle a\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}xf_{X,Y|Z}(X,Y|Z)dydx+b\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}y f_{X,Y|Z}(X,Y|Z)dxdy$$
$$=\displaystyle a\int_{-\infty}^{\infty}x\left[\int_{-\infty}^{\infty}f_{X,Y|Z}(X,Y|Z)dy\right]dx+b\int_{-\infty}^{\infty}y\left[\int_{-\infty}^{\infty} f_{X,Y|Z}(X,Y|Z)dx\right]dy$$
$$=\displaystyle a\int_{-\infty}^{\infty}xf_{X|Z}(X|Z)dx+\displaystyle b\int_{-\infty}^{\infty}yf_{Y|Z}(Y|Z)dy$$
$$=a\mathbb{E}[X|Z]+b\mathbb{E}[Y|Z]$$
Q3)Suppose $ X\geq 0 $ then
$$\mathbb{E}[X|Y]=\displaystyle \int_{-\infty}^{\infty}xf_{X|Y}(x|Y)dx=\int_{0}^{\infty}xf_{X|Y}(x|Y)dx\geq 0,$$
because $ f_{X|Y}(x|Y)\geq 0 $
P4) If X and Y are independent we have
$$\displaystyle f_{X|Y}(x|y)=\frac{f_{X,Y}(x,y)}{f_Y(y)}=\frac{f_{X}(x)f_Y(y)}{f_Y(y)}=f_X(x)$$
then
$$\displaystyle\mathbb{E}[X|Y]=\int_{-\infty}^{\infty}xf_{X|Y}(x|y)dx=\int_{-\infty}^{\infty}xf_{X}(x)dx=\mathbb{E}[X]$$
Q5) Just note that
$$\displaystyle \mathbb{E}[\mathbb{E}[X|Y]]=\int_{-\infty}^{\infty}\mathbb{E}[X|Y=y]f_Y(y)dy$$
$$=\displaystyle\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}xf_{X|Y}(x|y)f_Y(y)dydx$$
$$=\displaystyle\int_{-\infty}^{\infty}x\int_{-\infty}^{\infty}\frac{f_{X,Y}(x,y)}{f_Y(y)}f_Y(y)dydx$$
$$=\displaystyle\int_{-\infty}^{\infty}x\int_{-\infty}^{\infty}f_{X,Y}(x,y)dydx$$
$$=\displaystyle\int_{-\infty}^{\infty}xf_{X}(x)dx$$
$$=\mathbb{E}[X]$$
Q6)Note that
$$\mathbb{E}[Xg(Y)|Y=y]=\displaystyle \int_{-\infty}^{\infty}xg(y)f_{X|Y}(x|Y=y)dx$$
$$\displaystyle g(y)\int_{-\infty}^{\infty}xf_{X|Y}(x|Y=y)dx=g(y)\mathbb{E}[X|Y=y]\Rightarrow g(Y))\mathbb{E}[X|Y]$$
Q7)Note that
$$\mathbb{E}[X|Y=y,g(y)]=\displaystyle \int_{-\infty}^{\infty}xf_{X|Y,g(Y)}(x|y,g(y))dx$$
$$=\displaystyle \int_{-\infty}^{\infty}x\frac{f_{X,Y,g(Y)}(x,y,g(y))}{f_{Y,g(Y)}(y,g(y))}dx$$
$$=\displaystyle \int_{-\infty}^{\infty}x\frac{f_{X,Y,g(Y)}(x,y,g(y))}{f_{g(Y)|Y}(g(y)|y)}dx$$
$$=\displaystyle \int_{-\infty}^{\infty}x\frac{f_{X,g(Y)|Y}(x,g(y)|y)f_Y(y)}{g(y)f_{Y}(y)}dx$$
$$=\displaystyle \int_{-\infty}^{\infty}x\frac{g(y)f_{X|Y}(x|y)f_Y(y)}{g(y)f_{Y}(y)}dx$$
$$=\displaystyle \int_{-\infty}^{\infty}xf_{X|Y}(x|y)dx=\mathbb{E}[X|Y]$$
Q8) It is important to keep in mind that $ \mathbb{E}[X|Y,Z] $ is a random variable, so
$$\mathbb{E}[\mathbb{E}[X|Y,Z]|Y=y]=\displaystyle \int_{-\infty}^{\infty}\mathbb{E}[X|Y=y,Z=z]f_{Z|Y}(z|y)dz$$
$$=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}xf_{X|Y,Z}(x|y,z)f_{Z|Y}(z|y)dzdx$$
$$=\int_{-\infty}^{\infty}x\int_{-\infty}^{\infty}\frac{f_{X,Y,Z}(x,y,z)}{f_{Z,Y}(z,y)}\frac{f_{Z,Y}(z,y)}{f_Y(y)}dzdx$$
$$=\int_{-\infty}^{\infty}x\int_{-\infty}^{\infty}\frac{f_{X,Y,Z}(x,y,z)}{f_Y(y)}dzdx$$
$$=\int_{-\infty}^{\infty}x\int_{-\infty}^{\infty}f_{X,Z|Y}(x,z|y)dzdx$$
$$=\int_{-\infty}^{\infty}xf_{X|Y}(x|y)dx=\mathbb{E}(X|Y=y)\Rightarrow \mathbb{E}[\mathbb{E}[X|Y,Z]|Y]=\mathbb{E}[X|Y]$$
Example 3.5.1.1
Be $ X,Y\stackrel{iid}{\sim}U(0,1) $, and $ Z=X+Y $. Find $ \mathbb{E}[Z|X],\mathbb{E}[XZ|X],\mathbb{E}[X|Z],\mathbb{E}[XZ|Z] $.
Let’s start with the simplest
$$\displaystyle\mathbb{E}[Z|X]=\mathbb{E}[X+Y|X]=\mathbb{E}[X|X]+\mathbb{E}[Y|X]\stackrel{P4,P6}{=}X+\mathbb{E}[Y]=X+\frac{1}{2}$$
Now
$$\mathbb{E}[XZ|X]\stackrel{P6}{=}X\mathbb{E}[Z|X]=X(X+\frac{1}{2})$$
To calculate $ \mathbb{E}[X|Z] $, we need to find the joint density of X and Z. We need to find image of the square $ 0\leq x,y\leq 1 $ through our transformation $ X, Z=X+Y $, for more details see section 8.2.8 of joint probability. To check our transformation, just check what happens at the edges, since our transformation is linear.
$$(x,y)=(0,0)\rightarrow (0,0)$$
$$(x,y)=(0,1)\rightarrow (0,1)$$
$$(x,y)=(1,0)\rightarrow (1,1)$$
$$(x,y)=(1,1)\rightarrow (1,2)$$
forming a parallelogram as in the figure

Note that the area of the parallelogram is 1, so the joint density is given by

Solving the integrals we have
$$\mathbb{E}[X|Z=z]=z/2$$
Therefore
$$\mathbb{E}[X|Z]=Z/2 $$
And finally we have to
$$\mathbb{E}[XZ|Z]\stackrel{P6}{=}Z\mathbb{E}[X|Z]=Z(Z/2)=Z^2/2$$
Example 3.5.1.2
Be $ (X_n)_{n\in\mathbb{N}} $ a sequence of iid random variables with mean $ \mu $ and variance $ \sigma^2 $. Be $ N $ a random variable that takes on natural values. Define
$$\displaystyle S_N=\sum_{i=1}^N X_i$$
note that $ S_N $ is a random variable whose number of terms varies according to the value that the variable $ N $ assume. We want to find $ \mathbb{E}[S_N|N] $ and $ \mathbb{S}^2_{N|N} $ and calculate $ Var[S_N] $.
To do this, consider
$$\mathbb{E}[S_N^2|N=n]=\displaystyle \sum_{i=1}^n \mathbb{E}[X_i]=n\mu\Rightarrow \mathbb{E}[S_N|N]=N\mu$$
Now how $ X_i $ are independent we have
$$\mathbb{E}[S_N^2|N=n]-\left(\mathbb{E}[S_N|N=n]\right)=Var[S_N|N=n]=\sum_{i=1}^n Var[X_i]=n\sigma^2\Rightarrow Var[S_N|N]=N\sigma^2$$
which implies that
$$\mathbb{E}[S_N^2|N]=N\sigma^2+N^2\mu^2$$
Now using P5, we have
$$\mathbb{E}[S_N]=\mathbb{E}[\mathbb{E}[S_N|N]]=\mathbb{E}[N\mu]=\mu\mathbb{E}[N]$$
And yet
$$\mathbb{E}[S_N^2]=\mathbb{E}[\mathbb{E}[S_N^2|N]]=\mathbb{E}[N\sigma^2+N\mu^2]=\sigma^2\mathbb{E}[N]+\mu^2\mathbb{E}[N^2]$$
Finally we have that the variance of $ S_N $ is
$$Var[S_N]=\mathbb{E}[S^2_N]-\left(\mathbb{E}[S_N]\right)^2=\sigma^2\mathbb{E}[N]+\mu^2Var[N]$$
Example 3.5.1.3
Suppose that the number of customers who enter a supermarket in a day is a random variable with an average of 100. Suppose also that the amount spent in this supermarket by each customer is an independent random variable with an average of 40 reais, also suppose that the amount spent by customers is independent of the total number of customers on the day, that is, whether the supermarket is full or empty, the amount that each customer spends is independent of this. What is the expected value of the total amount of money entering this supermarket?
If we take N as the total number of customers entering the supermarket and $ X_i $ as the amount each customer spends, so we want to calculate
$$\displaystyle \mathbb{E}\left[\sum_{i=1}^N X_i\right]$$
using example 3.5.1.2 we have
$$\mathbb{E}[S_N]=\mathbb{E}[N]\mathbb{E}[X_i]=100\star40=(reais)4000,00$$