Variance of the number of digits in PINs I have a task:
A 5-digit pin is valid when all digits are different. So a set of correct pins:
$A=\{(d_1,d_2, d_3, d_4, d_5):d_{i}\in \{0,...,9\},i\in \{1,...,5\}, \forall_{(i\ne j, i,j \in \{1,2,3,4,5 \})}  d_{i} \ne d_{j} \} $
Two PINs were randomly and independently drawn from the $A$ set. Let $X$ be the number of different digits that appear in both PINs.
Calculate $Var(X)$.
I tried from definition:$Var(X)=EX^2-(EX)^2$, so I tried to calculate:
$P(X=5)=\frac{{10 \choose 5}5!(5!-1) }{{10 \choose 5}^2(5!-1)5!}$.
But later I have no idea how to calculate $P(X=6)$ in the easy way.
Please help me to solve this task.
Thanks in advance.
 A: 
i do not know how to get the mean by linearity.

It refers to applying the Linearity of Expectation to the sum of Indicator Random Variables.
Let $X_i = 1$ when digit at position $i$ is different in the PINs, and $X_i = 0$ when the digit is identical at that position.   These are indicator random variables.   $X_i, X_j$ will be independent for all $i\neq j$.
$$\forall i{\in}\{1,2,3,4,5\}~.\mathsf P(X_i=1)=\dfrac{1}{10}$$
Then $\mathsf E(X_i)=1\cdot\mathsf P(X_i{=}1)$ and $X=\sum_{i=1}^5 X_i$ . So we may use Linearity of Expectation to find: $$\textstyle{~~\mathsf E(X)=\mathsf E\left(\sum_{i=1}^5 X_i\right)\\\mathsf E(X^2)=\mathsf E\left(\left(\sum_{i=1}^5 X_i\right)\left(\sum_{j=1}^5 X_j\right)\right)}$$

Update: If you are counting $X$ as "distinct digits that appear in the two PINs" then the solution shall just use slightly different indicators.
Let $Y_k$ indicate that digit $k$ appears in at least one among the PINs. So for all $k\in[[0..9]]$ and $\ell\in[[0..9]]$ when $k\neq\ell$:
Thus, as above : $$\textstyle{~~\mathsf E(X)=\mathsf E\left(\sum_{k=0}^9 Y_k\right)\\\mathsf E(X^2)=\mathsf E\left(\left(\sum_{k=0}^9 Y_k\right)\left(\sum_{\ell=0}^9 Y_\ell\right)\right)}$$
You just need to evaluate$\mathsf P(Y_k=1)$ and $\mathsf P(Y_k=1,Y_\ell=1)$
