Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This was inspired by this question and the comment of user @Did to it. At first it may appear as some subtlety that would interest some educational course only. But since it relates to how we communicate verbally information about random variables, I think it may interest the CV community.

I will pose it as a question and I will provide an answer. The use of the normal distribution below is just a convenience.

QUESTION : Assume that we have two i.i.d standard normal random variables $X$ and $Y$. Consider a random variable that is equal to $X$ with probability $1/2$, and equal to $Y$ with probability $1/2$. Can you find what is its distribution? At least, can you calculate its expected value?

share|improve this question
up vote 4 down vote accepted

The information that the random variable in question "is equal to $X$ with probability $1/2$, and equal to $Y$ with probability $1/2$" is not sufficiently clear, as stated, in order to allow us to provide some definite answer. Proof by example:

1) Assume that the random variable in question, denote it $W$, is defined as:

$$W = \left\{ \begin{array}{lr} X \;\; \text{with probability } \frac{1}{2}\\ Y \;\;\text{with probability } \frac{1}{2} \end{array} \right.\\$$

This is equivalent to define an independent Bernoulli rv $B(p=0.5)$ and set

$$W = X\cdot B + Y\cdot (1-B)$$

It is not difficult to conclude that $W$ will also be a standard normal random variable, with $E(W) = 0$.

2) But define now the rv $Z = \max\{X,Y\}$. Its distribution function is

$F_Z(z) = \Phi(z)^2$, and its density is $f_Z(z) = 2\phi(z)\Phi(z)$, where $\phi(z)$ is the standard normal density, and $\Phi(z)$ the standard normal distribution function. We see that $Z$ is Azzalini's Skew Normal distribution, with location parameter $0$, scale parameter $1$, and shape (or skew or slant) parameter $1$. Then we have $E(Z) = \frac 1{\sqrt {\pi}}$.

Now note that $$P(X > Y) = \int_{-\infty}^{\infty}\int_{y}^{\infty}\phi(y)\phi(x) dxdy = \int_{-\infty}^{\infty}\phi(y)\cdot [1-\Phi(y)]dy$$

$$=1-E[\Phi(Y)] = 1-\frac 12 = \frac 12$$

by the probability integral transform.

So the event "$Z$ is equal to $X$" has probability equal to $1/2$, and the event "$Z$ is equal to $Y$" has also probability $1/2$.

Therefore, what defines $W$, holds also for $Z$, although they are different random variables, and they are characterized by different distributions... but this means that, at the verbal level, we should clearly distinguish between the statements

$A$: "A random variable is defined as being equal to $X$ with probability $1/2$ and equal to $Y$ with probability $1/2$"


$B$: "A random variable has the property of being equal to $X$ with probability $1/2$ and $Y$ with probability $1/2$".

We see that the information, as given in the question, is fatally vague, and could be matched either to statement $A$ or to statement $B$.

If it had been given as statement $A$ above, we could definitely provide an answer. If it had been given as statement $B$ above, we could definitely say that we cannot provide a definite answer.

Essentially, the property in question is not a defining property. To the degree that we are not sure whether the property we want to communicate leads indeed to a unique characterization, we should take the trouble to choose either statement $A$, or statement $B$, and avoid the seemingly transparent statement provided in the question.

share|improve this answer
Sure, the description '$W=X$ with probability $0.5$ and $W=Y$ with probability $0.5$' doesn't uniquely define $W$ and hence we should refrain from using this kind of notation. To define $W$, you have to define $W(\omega)$ for all $\omega$, and the former description doesn't do that. As you note yourself, $W=X\mathbf{1}_{A}+Y\mathbf{1}_{A^c}$ with $A$ being independent of $(X,Y)$ and $P(A)=0.5$ is one definition of $W$ consistent with the above description, and $W=X\mathbf{1}_{X\geqslant Y}+Y\mathbf{1}_{X<Y}=\max(X,Y)$ is another one (at least for i.i.d continuous $X$ and $Y$). – Stefan Hansen Jan 5 at 8:35
@StefanHansen This is a very good compact summary, expressing the two rv's in similar notation that brings in the surface where their difference lies. Perhaps you should upgrade it to an answer. – Alecos Papadopoulos Jan 5 at 16:16

I am afraid I disagree with your answer! If you define a random variable as $$W = \left\{ \begin{array}{lr} X \;\; \text{with probability } \frac{1}{2}\\ Y \;\;\text{with probability } \frac{1}{2} \end{array} \right.\\$$ the probability $1/2$ is unconditional on the pair $(X,Y)$ and the density of $W$ is $$f_W(w)=\frac{1}{2} f_X(w)+\frac{1}{2} f_Y(w)$$ Introducing the Bernoulli random variable $B$ that defines which value $W$ takes between $X$ and $Y$ with no further indication simply highlights that this Bernoulli $B$ is defined unconditionally against $X$ and $Y$.

Your counter-example with $Z$ is a case when $P(Z=X)=1/2$ as well, except that here the Bernoulli $B$ is dependent on the pair $(X,Y)$, which makes the "definition"$$Z = \left\{ \begin{array}{lr} X \;\; \text{with probability } \frac{1}{2}\\ Y \;\;\text{with probability } \frac{1}{2} \end{array} \right.\\$$ incomplete and hence not a definition.

share|improve this answer
$Z$ is clearly defined as $Z = max(X,Y)$ in my answer, and not otherwise. – Alecos Papadopoulos Jan 5 at 3:04
The whole point of this thread is that verbal expressions like "a random variable is equal to $X$ with prob 0.5 and equal to $Y$ with prob 0.5" are not, after all, clear and definite enough to tell us whether we are dealing with an rv like $W$, or with an rv like $Z$. – Alecos Papadopoulos Jan 5 at 3:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.