# Probability of i > j, double summation

I am trying to find the probability of one discrete random variable, $i$, being greater than discrete random variable, $j$.

The probability of $j$ taking a particular integer value $\{-c, -c + 2, \text{...} , c - 2, c\}$, given $t_1$, and $p$, where $t_1$ is one of the possible integers $\{-c, -c + 2, \text{...} , c - 2, c\}$, and where $0\leq p\leq 1$, is given by:

\[Alpha][j_] := Sum[Binomial[(1/2)*(c + Subscript[t, 1]), k]*
p^(2*k - (1/2)*(i + Subscript[t, 1]))*
Binomial[(1/2)*(c - Subscript[t, 1]), (c + i)/2 - k]*
(1 - p)^(c - (2*k - (1/2)*(i + Subscript[t, 1]))),
{k, Max[0, (1/2)*(i + Subscript[t, 1])],
Min[(c + i)/2, (1/2)*(c + Subscript[t, 1])]}]

while the probability of $i$ taking a particular integer value $\{-c, -c + 2, \text{...} , c - 2, c\}$, given $t_2$, and $p$, where $t_2$ is one of the possible integers $\{-c, -c + 2, \text{...} , c - 2, c\}$, is given by:

\[Beta][i_] := Sum[Binomial[(1/2)*(c + Subscript[t, 2]), k]*
p^(2*k - (1/2)*(i + Subscript[t, 2]))*
Binomial[(1/2)*(c - Subscript[t, 2]), (c + i)/2 - k]*
(1 - p)^(c - (2*k - (1/2)*(i + Subscript[t, 2]))),
{k, Max[0, (1/2)*(i + Subscript[t, 2])],
Min[(c + i)/2, (1/2)*(c + Subscript[t, 2])]}]

My approach to solving this problem is shown below. My problem is that I can't seem to formulate the final expression using Mathematica. Or, perhaps my problem is deeper yet. In any case, I am looking for help using Mathematica on this problem:

Sum[\[Beta][i_]*\[Alpha][j_], {i, c, -c + 2}, {j, i - c, -c}], in steps of -2
• Functions should be input as Wolfram Language code, not LaTeX. Edit your question, copy and paste in the code, select the block of code, then use the {} button to format the code. Also, post code, not pictures of code. – Edmund Nov 8 '17 at 21:57
• Edmund, I hope this suffices? – user120911 Nov 8 '17 at 22:09

You may use WeightedData to construct an EmpiricalDistribution and then frame your problem as an inequality using Probability.

First realise that you only need define on probability mass function. This can be done by using parameters instead of relying on global variables. Use your α definition:

pmf[c_, t_, p_, x_] :=
Sum[Binomial[(c + t)/2, k] p^(2 k - (x + t)/2 )
Binomial[(c - t)/2, (c + x)/2 - k]
(1 - p)^(c - (2 k - (x + t)/2)),
{k, Max[0, (x + t)/2], Min[(c + x)/2, (c + t)/2]}]

The PMF looks good; sums to 1 and positive over the domain.

With[{c = 5},
Sum[pmf[c, -3, .5, x], {x, -c, c, 2}]
]
1.
With[{c = 5},
DiscretePlot[pmf[c, -3, .5, x], {x, -c, c, 2}]
]

The PMF can be used to create an EmpiricalDistribution. Create a distribution for i and j. I used c = 5 and p = .5 for both with t1 = -3 and t2 = -1.

With[{c = 5},
iDist = EmpiricalDistribution@WeightedData[Range[-c, c, 2], pmf[c, -3, .5, #] &];
jDist = EmpiricalDistribution@WeightedData[Range[-c, c, 2], pmf[c, -1, .5, #] &];
]

Next use Probability to evaluate your result.

Probability[i > j, {i \[Distributed] iDist, j \[Distributed] jDist}]
0.376953

I also tried using ProbabilityDistribution on the PMF but it would not cooperate so went for EmpiricalDistribution. The ProbabilityDistribution approach would allow for symbolic evaluation and I have gone out to WRI to find out why this PMF does not cooperate. Perhaps the above is all you need.

Hope this helps.

• Thank you very much for your instructive answer, Edmund. This certainly helps me a lot. Of course, it would have been ideal if ProbabilityDistribution worked here. What, by the way is WRI? – user120911 Nov 10 '17 at 18:24
• @user120911 WRI = Wolfram Research Inc. – Edmund Nov 10 '17 at 19:17
• thank you. That is much appreciated. I would be very interested to hear what they say about this problem. – user120911 Nov 10 '17 at 19:26
• Did you ever hear from WRI about why Mathematica had trouble with the PMF? – user120911 Feb 12 '18 at 8:29