Probability of dice roll Rolling a fair $6$ sided die $2n$ times.
let $X$ be the sum of even sides from the first $n$ rolls.
let $T$ be the number of times the $i^{th}$ roll have the same side as the $n+i$ roll.
for example :
let $n = 3 $ and the rolls are :
$ r_1 = 4  ,r_2 = 3 , r_3 = 2,r_4 = 6 , r_5 = 3 , r_6 = 1 $.
then $ T = 1$ , and $X = 4+2 = 6$.
My question :

*

*What is the distribution of $T$.

*let $n=30$ what is the value of $E(X^2)=?$.

I think that $T$ is a binomial distributed random variable because it represents the number of successes from $(n+1,2n)$ after getting randomly values for the first $n$ rolls.
 A: Indeed $T$ is the number of success among $n$ trials where the probability of success is $1/6$, so it should follow the binomial distribution $\mathcal B(n,1/6)$.
More formally, let $X_i$ be the side of the $i^{th}$ roll. Then $T=\sum_{i=1}^n1_{\{X_i=X_{n+i}\}}$. The random variables $(X_i,X_{n+i})_{1\le i\le n}$ are independent, and for all $i\in\{1,\cdots,n\}$, $1_{\{X_i=X_{n+i}\}}$ equals $1$ with probability $1/6$ and $0$ with probability $5/6$ hence it follows the Bernoulli distribution $\mathcal B(1/6)$. Then $T$ is the sum of $n$ independent Bernoulli variables with parameter $1/6$, so $T$ is a Binomial variable with parameter $(n,1/6)$.
For the second question, you have $X=\sum_{i=1}^nX_i1_{\{X_i\in\{2,4,6\}\}}$. Let $Y_i=X_i1_{\{X_i\in\{2,4,6\}\}}$. Clearly the distribution of $Y_i$ is given by
$$
\mathbb P(Y_i=2)=\mathbb P(Y_i=4)=\mathbb P(Y_i=6)=\frac16\quad\textrm{and}\quad\mathbb P(Y_i=0)=\frac12,
$$
hence
$$
\mathbb E[Y_i]=2\quad\textrm{and}\quad\operatorname{var}(Y_i)=\frac{16}{3}\cdot
$$
Since the variance of the sum of independent random variables is equal to the sum of the variances, we have
$$
\operatorname{var}(X)=\sum_{i=1}^n\operatorname{var}(Y_i)=\mathbb E[X^2]-\mathbb E[X]^2,
$$
hence
$$
\mathbb E[X^2]=\sum_{i=1}^n\operatorname{var}(Y_i)+\left(\sum_{i=1}^n\mathbb E[Y_i]\right)^2=\frac{16}{3}n+4n^2.
$$
