# I don't understand why $X = \sum_{i=1}^n X_i$ and $Y = \sum_{i=1}^n Y_i$

I was reading the solution to this problem and noticed it used $X = \sum_{i=1}^n X_i$ and $Y = \sum_{i=1}^n Y_i$. I think I understand all other parts except this one. Would you please explain why $X = \sum_{i=1}^n X_i$ and $Y = \sum_{i=1}^n Y_i$?

-

## 2 Answers

$X_k$ and $Y_k$ are always either $0$ or $1$. $X_k=1$ precisely when the $k$-th die shows a $1$, and $Y_k=1$ precisely when the $k$-th die shows a $2$. When you sum the $X_k$’s, you add $1$ for each die that shows a $1$ and $0$ for each die that shows something else, so the total is simply the number of dice showing a $1$. Similarly, when you sum the $Y_k$’s, you add $1$ for each die that shows a $2$ and $0$ for each die that shows something else, so the total is simply the number of dice showing a $2$.

For example, suppose that $n=8$, and the $5$ dice show $1,3,1,2,6,4,2,2$; then $X_1=X_3=1$, and all of the other $X_k$ are $0$, while $Y_4=Y_7=Y_8=1$, and the other five $Y_k$ are all $0$. Thus,

$$\begin{align*} X&=X_1+X_2+X_3+X_4+X_5+X_6+X_7+X_8\\ &=1+0+1+0+0+0+0+0\\ &=2\;, \end{align*}$$

which is indeed the number of dice showing a $1$, and

$$\begin{align*} Y&=Y_1+Y_2+Y_3+Y_4+Y_5+Y_6+Y_7+Y_8\\ &=0+0+0+1+0+0+1+1\\ &=3\;, \end{align*}$$

the number of dice showing a $2$.

-
i've been told that capital X and Y are random variables, I never knew you can obtain the actual value of X and Y by summing $X_k$ and $Y_k$. This summation method to obtain X and Y would not work if X and Y are, say, binomially distributed correct? – user133466 Nov 21 '12 at 19:32
@user133466: The distributions of $X$ and $Y$ are completely determined by those of the $X_k$ and the $Y_k$, respectively; if they’re binomial, they’re binomial, and if not, not. The random variables $X$ and $Y$ are defined to be these sums of other random variables. You can always define random variables in such fashion. – Brian M. Scott Nov 21 '12 at 19:34
say we have $X$ ~ $Bin(n,p)$ what would big $X$ equal to in this case? – user133466 Nov 21 '12 at 19:38
@user133466: I don’t understand the question. As I said, the distribution of $X=\sum_{k=1}^nX_k$ depends entirely on the distributions of the random variables $X_k$, and you’ve not said anything about them. – Brian M. Scott Nov 21 '12 at 19:40

1
@user133466: We define $X$ to be $\sum_{i=1}^nX_i$, so of course it’s equal to $\sum_{i=1}^nX_i$. I’m really not sure what you’re trying to ask. If the random variables $X_i$ are $1$ when something happens and $0$ when it doesn’t, then $X$ will count the number of successes, regardless of the distribution(s) of the $X_i$’s. – Brian M. Scott Nov 21 '12 at 20:08
show 2 more comments

Here $X$ is the number of $1$'s when you roll a fair die $n$ times.

Recall that the random variables $X_1, X_2, X_3, \dots, X_n$ were defined as follows. $X_1=1$ if we get a $1$ on the first roll, and $X_1=0$ otherwise.

$X_2=1$ if we get a $1$ on the second roll, and $X_2=0$ otherwise.

$X_3=1$ if we get a $1$ on the third roll, and $X_3=0$ otherwise.

In general, $X_i=1$ if we get a $1$ on the $i$-th roll, and $X_i=0$ otherwise.

Then $$X_1+X_2+X_3+\cdots+X_n$$ is the total number of times you got a $1$, so it is the number of $1$'s that you got. But $X$ is by definition the number of $1$'s ou got.

Every time you get a $1$ on the die you write down a $1$, every time you don't get a $1$, you write down a $0$. So the sum of the numbers you write down is just the total number of $1$'s that you rolled.

Exactly the same idea works for $Y$. You write down a $1$ if you roll a $2$, and write down a $0$ if you don't roll a $2$. The sum of all the numbers you wrote down is the total number of $2$'s that you rolled.

This trick of using what are called indicator random variables $X_i$ is useful in many calculations.

-

i've been told that capital X and Y are random variables, I never knew you can obtain the actual value of X and Y by summing $X_k$ and $Y_k$. This summation method to obtain X and Y would not work if X and Y are, say, binomially distributed correct? – user133466 Nov 21 '12 at 19:35
Actually, $X$ and $Y$ are binomially distributed random variables. Each time, for $X$, the probability of "success" is $1/6$.  Every binomially distributed random variable is the sum of indicator random variables. For example, toss a coin $10$ times in a row. Let $X_i=1$ if on the $i$-th toss you get a head, and $X_i=0$ if you get a tail. Then $X_1+X_2+\cdots+X_{10}$ is the total number of heads. This as you know has binomial distribution. – André Nicolas Nov 21 '12 at 19:40
– user133466 Nov 21 '12 at 19:44
No, sorry. They are used in many ways, sometimes very complicated. The simplest is for finding the mean and variance of the binomial. Since $X=X_1+\cdots+X_n$, we have $E(X)=E(X_1+\cdots+X_n)$. But expectation of a sum is sum of the expectations, and $E(X_i)$ is very easy to find. A not much harder argument gives you the variance of the binomial. – André Nicolas Nov 21 '12 at 19:49
I understand $E(X)=E(X_1+...+X_n)$ but I did not know $X = X_1 + ... +X_n$. Does that mean if we have $X_1,X_2,...X_n$ are independent Poisson, $X$ would still equal to $\sum_{i=1}^n X_i$? – user133466 Nov 21 '12 at 19:58
show 5 more comments
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 110, "mathjax_display_tex": 3, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9226962327957153, "perplexity_flag": "head"}