# The probability that Student $1$ performs better than Student $2$ on an examination

Suppose there's a exam with 5 questions. If the probability that Student $1$ correctly answers question $i$ is $P_{1.i}$, then

$P_{1.1} = 0.3$ , $P_{1.2} = 0.4$ , $P_{1.3} = 0.9$, $P_{1.4} = 0.7$ , $P_{1.5} = 0.1$

For Student $2$,

$P_{2.1} = 0.4$ , $P_{2.2} = 0.5$ , $P_{2.3} = 0.2$, $P_{2.4} = 0.8$ , $P_{2.5} = 0.1$

What is the probability that Student $1$ performs better than Student $2$ ?

How to solve something like that? I want an expression to do this.

Compute all probabilities $P(C_i = j)$ where $C_i$ is the number of correct questions scored by student $i$. These are just sums of products of the $P_{i,j}$ really. Then sum all $P(C_1 = j)P(C_2 = k)$ over all pairs $j > k$ that are allowed. This is allowed by independence of the scores of both students.

E.g. to compute the probability that student 1 has 2 correct answers, consider all combinations of two answers out of the five. Say one of these is $\{i,j\}$, which means that student $1$ answers questions $i$ and $j$ correctly and the others incorrectly. The chance of exactly that happening is $P_{1,i} \times P_{1,j}$ times all factors $(1-P_{1,n})$ where $n \neq i,j$. And this we have to do for all $\binom{5}{2}$ sets of possible $\{i,j\}$ to compute $P(C_1 = 2)$.

This is quite tedious to do by hand, so I wrote a program:

The results were:

P student 1 has 0 correct = 0.011340 P student 2 has 0 correct = 0.043200 P student 1 has 1 correct = 0.142200 P student 2 has 1 correct = 0.260400 P student 1 has 2 correct = 0.397800 P student 2 has 2 correct = 0.406400 P student 1 has 3 correct = 0.340000 P student 2 has 3 correct = 0.236400 P student 1 has 4 correct = 0.101100 P student 2 has 4 correct = 0.050400 P student 1 has 5 correct = 0.007560 P student 2 has 5 correct = 0.003200 1 does better with probability 0.471532 2 does better with probability 0.243788 equal score with probability 0.284680

• What is the mathematical expression to do this? $0.3 \cdot 0.4 \cdot 0.9 \cdot 0.7 \cdot 0.1 + 0.4 \cdot 0.5 \cdot 0.2 \cdot 0.8 \cdot 0.1$ ? then what? – Pinteco Apr 29 '18 at 22:19
• If you have been studying normal approximations, then maybe you need to find $\mu_i$ and $\sigma_i^2$ for the total number correct by Student $i.$ Then find the mean $\mu_d = \mu_1-\mu_2$ difference between Student 1's total and Student2's and also $\sigma_d^2 = \sigma_1^2 + \sigma_2^2$ for that difference. Finally, assume the difference is nearly normal with $\mu_d$ and $\sigma_d^2.$ – BruceET Apr 29 '18 at 23:44
• Actually I don't know none of this. It's suppose to use basic concepts of probability. – Pinteco Apr 29 '18 at 23:57
• Well, then: I assume Student 1's score is the number correct. Similarly, for Student 2. // If all questions equally difficult for each, you would be comparing BINOM(5, p) with BINOM(5, q), where $p > q.$ Because questions differ, it will be messier. But would you know how to answer the Problem if both students had binomial scores? – BruceET Apr 30 '18 at 1:09

Comment: I wish you success with @HennoBrandsma's approach (+1). It seems there will be some bookkeeping in considering all the possibilties. In case it is of any use (e.g., for checking intermediate results), here are simulated distributions for Student 1, Student 2, and Difference scores.

It is reasonable to expect the simulated probabilities to be accurate to two or three places.

Although Student 1 will do slightly better on average, it seems that there is slightly less than a 50:50 chance for Student 1 to do better than Student 2. However, there are about 3 chances in 4 Student 1 will do as well or better.

set.seed(429)
m = 10^6;  p1=c(3,4,9,7,1)/10;  p2=c(4,5,2,8,1)/10
s1 = replicate(10^6, sum(rbinom(5, 1, p1)))
round(table(s1)/m,3)
s1
0     1     2     3     4     5
0.011 0.142 0.398 0.340 0.101 0.008
s2 = replicate(10^6, sum(rbinom(5, 1, p2)))
round(table(s2)/m,3)
s2
0     1     2     3     4     5
0.043 0.260 0.407 0.236 0.051 0.003
d = s1 - s2
round(table(d)/m,3)
d
-5    -4    -3    -2    -1     0     1     2     3     4     5
0.000 0.001 0.011 0.060 0.172 0.285 0.272 0.148 0.044 0.006 0.000

mean(s1 > s2)
 0.471404
mean(s1 >= s2)
 0.756087

par(mfrow=c(1,3))
hist(s1, prob=T, br=(0:6)-.5, col="skyblue2", main="Student 1 Scores")
hist(s2, prob=T, br=(0:6)-.5, col="skyblue2", main="Student 2 Scores")
hist(d, prob=T, br=(-5:6)-.5, col="skyblue2", main="Difference in Scores")
abline(v = .5, col="red", lwd=3, lty="dashed")
par(mfrow=c(1,1)) • The results of the simulation nicely match those of my C-program. – Henno Brandsma May 1 '18 at 21:31