# Probability calc

Hi, hope someone can help! In an automotive application, an emissions monitor tests a system intermittently. If the system is faulty then the 'check engine' light must be illuminated on the dashboard.

The legislation says that if the fault is detected on 2 successive occasions then the light must be lit. This is so that one rogue result doesn't light the light.

Let us say there is a fault with the system being monitored. When there is a fault, the monitor correctly diagnoses it 70% of the time. If the monitor runs, say, 10 times, what is the probability that there will have been 2 successive detections of the fault.

I can compute the probability of 2 or more detections in 10 trials using the Binomial distribution. Integrating nCx . p^x . q^(n-x) for x = 2:n, where n=10, p = 0.7; q = 1-p.

But this obviously isn't the answer because the 2 detections need to be CONSECUTIVE. So, how do I calc the probability?

It seems like it should be really simple but I'm not a mathematician and therefore not clever enough to see it!

Justin

### Re: Probability calc

Thanks Daniel.

Because I needed an answer quickly I wrote something in Matlab to simulate it. A formula would be more elegant but seems it's a more difficult problem than I thought. Anyway, I get probability of 2 consecutive detections of 0.98555 in simulation - in case anyone comes up with a formula and wants to check it.

### Re: Probability calc

Hi Justin,

You want a formula, here it comes. Following the Z-transform approach suggested in my firs post, I got the Z-transform of the failure function (no two successive detections in n runs):

F(z) = z(z + p) / (z^2 - qz - pq)

Let a and b be the roots of the denominator:

z^2 - qz - pq = (z-a)(z-b)
a = [q + sqrt(q^2 + 4pq)] / 2 and b = [q - sqrt(q^2 + 4pq)] / 2

Let us define two coefficients A and B such that

F(z) = Az/z-a) + Bz/z-b)

Then A = (p+a)/(a-b) and B = (p+b)/(b-a)

The general failure probability F_n for n runs is then simply:

F_n = A(a^n)+ B(b^n)

With p = 0.7 and q = 1-p = 0.3, we get the following numerical values:

a = 0.63218254 and b = -0.33218254 and A = 1.38140894 and B = -0.38140894

For n = 10, F_n = 0.01407845 and the success probability S_n = 1-F_n = 0.98592155

This result fits with your simulation, up to roundoff errors.

Note that for large n (10 is "large"), the second term in the F_n formula is much smaller than the first one and can be neglected.

### Re: Probability calc

Hi Justin,

The problem is not so easy. It seems to me that it would be simpler to compute first the probability of failure F_n for not detecting the fault after n runs. That is: some detections could have occurred, but no two consecutive ones.
Split F_n into two cases: P_n is the probability of failure after n runs with a detection at the last one, Q_n is the probability of failure after n runs with a missing detection at the last one. F_n = P_n + Q_n.
Now, the probabilities P_n+1 and Q_n+1 after n+1 runs are obviously:

P_n+1 = p(Q_n) and Q_n+1 = q(P_n + Q_n)

You have now a system of two recursive equations. Since this system is linear, there are plenty of techniques to solve it. If you are from the engineering field, you are probably familiar with the Z-transform which will lead you automatically to the solution. Mathematicians would rather use characteristic functions, which, up to the denomination, are exactly the same as Z-transforms.

I hope that this helps, Daniel