Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. 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

Suppose that we have an expression of random variables including $X-X$ or $2X-X$ or $XY-XY$ and so on. can we treat random variables as real numbers? That is, can we delete $X-X$ or replace $2X-X$ by $X$? what about $X/X$?

share|cite|improve this question
If $X-X$ stands to denote $X(\omega) - X(\omega)$ then, yes, it is zero, but if you meant $X_1-X_2$ were $X_1$ and $X_2$ are identically distributed, but independent random variables, than $X_1-X_2$ need not be zero. – Sasha Apr 1 '13 at 18:06
X−X stands to denote X(ω)−X(ω) , they are the same random variable. – May Apr 1 '13 at 18:17
up vote 3 down vote accepted

Random variables are functions. Any algebraic step valid for functions is therefore valid for random variables. In particular, we can replace $2X-X$ by $X$, and, with the usual caution about division by $0$, we can replace $\frac{X}{X}$ by $1$.

Remark: Imagine tossing a fair die twice. The result on the first toss is a random variable. The result on the second toss is a random variable. These two random variables have the same distribution. But they are not the same random variable. Calling both of them $X$, and manipulating "algebraically" will lead to disaster.

share|cite|improve this answer
@Nicolas: Thank you a lot. You answer is really helpful. Just a question about the Remark; In my mind, Tossing a fair dice twice would result in different outcomes (not different random variables), but tossing a dice itself is a random variable. is it correct? – May Apr 1 '13 at 18:28
They are different random variables. The range of the two functions is the same, but the domains are not. – André Nicolas Apr 1 '13 at 18:37

Formally, a random variable $X$ is a mapping $X:\Omega\to\mathbb{R}$ where $\Omega$ is the set of outcomes (sample space) in a probability space. The mapping also needs to be measurable but that is less important here.

So if $X$ and $Y$ are two random variables, then how can $X-Y$ be a random variable? The answer is that it is defined as the mapping $(X-Y):\Omega\to\mathbb{R}$ which sends an outcome $\omega$ to the difference of the real numbers $X(\omega)$ and $Y(\omega)$, that is, it is defined by:

$$ (X-Y)(\omega) = X(\omega)-Y(\omega) $$

The minus on the right-hand side is a minus between two real numbers. So this is "pointwise subtraction". It entirely the same as $f-g$ for two functions $f$ and $g$.

So since for every $\omega$, $X(\omega) - X(\omega) = 0$ (zero the number), it is true that the mapping $X-X$ is the mapping that sends everything to zero, that is the zero function $0$. So $X-X=0$ (zero the function).

So the answer is yes.

Regarding $X/X$: In the points where $X(\omega)$ is not zero, this is the constant function $1$. But in the points where $X(\omega)$ is zero, this is not defined ($0/0$). So if you know that $X$ is never zero, it's safe to replace $X/X$ by $1$. If you know $X$ is zero in some points $\omega$, formally $X/X$ is not defined on all of $\Omega$ and so is not a random variable.

(However, in the last case, the event $\{X=0\} = X^{-1}(\{0\})$ may have zero probability even if it's non-empty as a set, and in that case it's not a problem in practice to disregard the division by zero, since the random variables are "identified" if they only disagree on a null set (null event).)

share|cite|improve this answer

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.