This is the question:

There are particular readers for swipe cards, Under normal operating conditions, there is a small probability of 0.02 that swiping a card fails to open the entrance - some of these readers have a particular fault. If this fault occurs, then the probability of swipe failure rises to 0.1.

an estimate says that 22% of all the readers it has sold so far have this fault. It decides to send technicians around to test all the readers it has sold, and replace the faulty ones. You are tasked with designing a rule to help the technicians decide whether or not a card reader is faulty. They are to test each reader by swiping a card through it repeatedly in successive independent trials, until a failure occurs on the N-th trial. Based on N, the technician must decide whether or not the tested reader is faulty.

My question and answer:

Translating problems like this from words to math has always been a problem for me; I'm trying to work out the two main random variables as per a question, my answer so far has been that it is two Bernoulli random variables where one describes the probablility of a faulty card reader and the other one describes the probability of swipe failure, where you can use the law of total probability to determine the values.

P(Fail|Fault) = 0.1, P(Fail|Fault') = 0.02, P(Pass|Fault) = 0.9, P(Pass|Fault') = 0.98.

The bit that confuses me is when they ask for the two main random variables, as far as I know N is a random variable too correct? So am I interpreting the conditional variables incorrectly in the above paragraph?


Welcome to CV. Nice question. Here's my attempt:

Let $X$ be random variable such that $X=k$ denotes, first swipe failure occurs in $k^{th}$ swipe. Let the probability of swipe failure in any random swipe be $p_x$. So we have:

$$X \sim Geometric(p_x)$$

Now define another random variable $Y$ that takes value $1$ if machine is faulty and $0$ otherwise. So we have:

$$Y \sim Bern(p_y)$$


$$Pr(X=x)=\sum_y Pr(X=x|Y=y)Pr(Y=y)$$

Now, $$Pr(X=N|Y=1)Pr(Y=1) = (1-p_{x|y=1})^{N-1}p_{x|y=1}p_y = (1-0.1)^{N-1}*0.1*0.22$$ Similarly, $$Pr(X=N|Y=0)Pr(Y=0) = (1-p_{x|y=0})^{N-1}p_{x|y=0}(1-p_y) = (1-0.02)^{N-1}*0.02*0.78$$ Therefore, $$Pr(X=N)=0.1*0.22*0.9^{N-1}+0.02*0.78*0.98^{N-1}$$

Now the technician only observes $N$ and must decide whether machine is faulty. So we are interested in:


Using Bayes:


Let us assume that technician decides that the machine is faulty if $Pr(Y=1|X=N)\geq0.95$

So, we finally have: $$\frac{0.1*0.22*0.9^{N-1}}{0.1*0.22*0.9^{N-1}+0.02*0.78*0.98^{N-1}}\geq0.95$$

From here you can calculate an upper bound on $N$. Hope there aren't any mistakes.

  • $\begingroup$ Thanks for your insight. I didn't think of adopting the probability of a failure into the geometric random variable, and thought my original solution was a bit odd using 2 bernoulli random variables. $\endgroup$ – Jeygopi Oct 15 '19 at 10:57
  • $\begingroup$ Do you have any reccomendations to get better at translating worded problems into mathematics, or how did you learn this concept? $\endgroup$ – Jeygopi Oct 15 '19 at 10:58
  • $\begingroup$ @Jeygopi I think as you solve more problems, you get a hang of it. If you are new to statistics, see examples from any standard textbook and solve some problems from its exercise. Also, if you think the above answer is correct please do close the question by accepting/voting the answer, otherwise it remains doubtful whether you found the answer to be correct or not. $\endgroup$ – Dayne Oct 15 '19 at 11:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.