Probability with expected value for diagnostic tests Two percent of the population has a certain condition for which there are two diagnostic tests. 
Test A, which costs $1 per person, gives positive results for 80% of persons with the condition and for 5% of persons without the condition. 
Test B, which costs 100$ per person, gives positive results for all persons with the condition and negative results for all persons without it.
(a) Suppose that test B is given to 150 persons, at a cost of 15,000$. How many cases of the condition would one expect to detect?
(b) Suppose that 2000 persons are given test A, and then only those who test positive are given test B. 
Show that the expected cost is $15,000 but that the expected number of cases detected is much larger than in part (a).
Hey I've been currently stuck on this question for a bit, but I don't know which formula to use at the beginning.  If anyone can just point me in the right direction it'll help a lot! thanks :)
 A: This problem can be solved by using the linearity of expectation again and again. I will give a complete illustration for part (a), but leave only hints part (b) as an exercise.
Let the probability that each person has the condition is $p$ independently of each other. In your question, $p$ would be $0.02$. For part (a), let $X_i$ be the random variable that takes the value of $1$ if the $i$-th person tested has the condition. Clearly $E(X_i) = p$. Then by the linearity of expectation,
$$E(\sum_{1 \le i \le 150} X_i) = \sum_{1 \le i \le 150} E(X_i) = 150p$$
And that answers part (a).
For part (b), there are two things to calculate: the expected cost and the expected number of people who tested positive in both tests. To calculate the expected cost, define the random variable $Y_i$ to be the expected cost of testing the $i$-th person. What is $E(Y_i)$? What is $E(\sum_{1 \le i \le 2000} Y_i)$? Do a similar thing for the expected number of people who tested positive in both tests, and you will get your answer.
A: In question(b), we have (150,000-2000*1)/100=130 persons who test positive after test A.So they go to Test A.
In 2000 persons, persons who are actually negative but test positive are 2000*0.98*0.05=98.
So when we deduct the number of false positive 130-98=32, it gives us the persons who actually has the condition.
