# Joint distribution of random variables

A self driving car has a computer vision component that is used to distinguish between colors of a traffic light: red, yellow and green. This component sometimes makes a wrong decision. The red light is not recognized correctly in 5% of the cases (in 3% of the cases it is mistaken for the green light and in 2% for the yellow light); the yellow light is not recognized correctly in 2% of the cases (in 1% of the cases it is mistaken for the green light and in 1% of the cases for the red light(; and the green light is not recognized correctly in 4% of the cases (in 3% of the cases it is mistaken for the red light and in 1% for the yellow light). It is known that the traffic light in a town are showing red and green 45% of the time and yellow 10% of the time.

Let X be a random variable showing the actual color of the traffic light and Y be a random variable showing the outcome of the computer vision component. Find the joint distribution of X and Y and write it in a form of a table.

I do not know how to find this joint distribution. The distribution of r.v. X will be P(Red) = 0.45, P(Y) = 0.1, and P(Green)= 0.45. The r.v. Y is dependent of the results of X, but I can't seem to figure out how to calculate the joint distribution.

You want to find $P(X = x, Y = y)$, where $x,y \in \{R, A, G\}$. (I'm using "$A$" for "amber" so as to not confuse "$Y$" for "yellow" or the random variable.) We can use Bayes' theorem to say $$P(X = x, Y = y) = P(Y = y \mid X = x)P(X = x).$$
Now, you know what the distribution of $X$ is. So now you only need to calculate the distribution of $Y$ given $X$. For example, suppose that $X = R$. You then know that $Y = R$ with probability $0.95$, $Y = A$ with probability $0.02$ and $Y = G$ with probability $0.03$. We can write this as follows: \begin{align*} P(Y = R \mid X = R) &= 0.95; \\ P(Y = A \mid X = R) &= 0.02; \\ P(Y = G \mid X = R) &= 0.03. \end{align*}
Hopefully this is enough so that you can now complete the cases when $X = A$ or $X = G$.