# Probability of being from a certain distribution

I was preparing for an exam in Image Analysis, when I found this probability problem in one of the old exam sets.

A bunch of products is measured, and two features $(x_1,x_2)$ are measured on each. A product is either fine, or defect. If the product is fine, it is assumed that its features belongs to a bivariate normal distribution

$$\mu = \begin{pmatrix} 0.5\\0.5 \end{pmatrix} , \;\; \Sigma = \begin{bmatrix} 1 & 0\\ 0 & 1 \end{bmatrix}$$

If the product is defect, it belongs to a uniform distribution

$$f\left( \begin{pmatrix} x_1\\ x_2 \end{pmatrix} |\text{ defect}\right) = 1, x_1 \in [0;1], x_2 \in[0;1]$$

The prior probability of being either defect or fine, is equal.

Now we are given a product with features $(0.2, 0.3)$, and we want to determine with what probability the product was fine.

I tried to find the probability of being the region $x_1\in[0;1], x_2 \in [0,1]$ given that the product was fine, and found (using a double integral of the density function of the bivariate normal distribution over the region) that this was approx. 0.6. Then I tried applying Bayes rule, but this did not work out well.

-
$\mu$ should be a vector with two components. – Michael Hardy Oct 21 '11 at 13:48
Thanks, that is corrected now. – utdiscant Oct 21 '11 at 15:54

You don't need the probability of the features being in $[0,1]^2$ to find this probability. Since the features are given, there are only two possibilities left, and the probabilities are just the a priori probability densities for those two events, normalized to $1$.

The probability density for the features to have those values if the product is defective is $1$. The corresponding density if the product is fine is

$$\frac1{\sqrt{2\pi}^2}\mathrm e^{-\frac12((0.2-0.5)^2+(0.3-0.5)^2)}=\frac1{2\pi}\mathrm e^{-0.065}\approx0.15\;.$$

Thus the probability that the product is fine is

$$\frac{0.15}{1+0.15}\approx0.13\;.$$

If you're worried that these are probability densities and not probabilities, consider that the features can't be measured exactly; what you actually know is that they're in some small region around the measured values, and if that region is small enough, the probability for the features to be in that region will be proportional to the density at the point.

-