When two balanced dices are rolled, the total possible outcomes is 36
Xdenotes the absolute value of the difference between thetwo numbers that appear.
With X=0, the pairs are (1,1), (2,2), (3,3), (3,2), (4,4), (5,5) and (6,6), so
\(\begin{aligned}{}\Pr \left( {X = 0} \right) &= \frac{6}{{36}}\\& = \frac{1}{6}\end{aligned}\)
With X=1, the pairs are (1,2), (2,1), (2,3), (3,2), (3,4), (4,3), (4,5), (5,4), (5,6) and (6,5), so
\(\begin{aligned}{}\Pr \left( {X = 1} \right)& = \frac{{10}}{{36}}\\ &= \frac{5}{{18}}\end{aligned}\)
With X=2, the pairs are (1,3), (3,1), (2,4), (4,2), (3,5), (5,3), (4,6) and (6,4), so
\(\begin{aligned}{}\Pr \left( {X = 2} \right) &= \frac{8}{{36}}\\ &= \frac{2}{9}\end{aligned}\)
With X=3, the pairs are (1,4), (4,1), (2,5), (5,2), (3,6) and (6,3), so
\(\begin{aligned}{}\Pr \left( {X = 3} \right)& = \frac{6}{{36}}\\ &= \frac{1}{6}\end{aligned}\)
With X=4, the pairs are (1,5), (5,1), (2,6) and (6,2), so
p(4) = 4/36 = 1/9
\(\begin{aligned}{}\Pr \left( {X = 4} \right) &= \frac{4}{{36}}\\ &= \frac{1}{9}\end{aligned}\)
Finally, with X=5, the pairs are (1,6) and (6,1), so
\(\begin{aligned}{}\Pr \left( {X = 5} \right)& = \frac{2}{{36}}\\& = \frac{1}{{18}}\end{aligned}\)
Therefore the probability function is
\(f\left( x \right) = \left\{ \begin{array}{l}\frac{1}{6}\,\,\,\,\,\,\,for\,\,\,x = 0\\\frac{5}{{18}}\,\,\,\,for\,\,\,x = 1\\\frac{2}{9}\,\,\,\,\,\,\,for\,\,\,x = 2\\\frac{1}{6}\,\,\,\,\,\,\,for\,\,\,x = 3\\\frac{1}{9}\,\,\,\,\,\,\,for\,\,\,x = 4\\\frac{1}{{18}}\,\,\,\,for\,\,\,x = 5\end{array} \right.\)