Conditional probability problem given binomial variables - joint probability and independence 
A test that verifies if mass-produced parts are up to standard is not completely reliable.


$C$ : the part is up to standard


$R$ : the part is classified as up to standard


We know :
$Pr(\bar{C})=20\%$
$Pr(\bar{R}|C)=13\%$
$Pr(R|\bar{C})=11\%$


In this problem, 43 parts are randomly chosen to be verified.


a) Calculate the probability that 8 parts are classified as not up to standard.

My answer : Let's start by finding $Pr(\bar{R})$
$Pr(C)=1-Pr(\bar{C})=0.8$
$Pr(R|C)=1-Pr(\bar{R}|C)=0.87$
$Pr(R)=Pr(R|\bar{C})Pr(\bar{C})+Pr(R|C)Pr(C)=0.718$
$Pr(\bar{R})=1-Pr(R)=0.282$
I found that $\bar{R}$ follows a binomial distribution of parameters $n=43$ and $p=Pr(\bar{R})=0.282$
So, $Pr(\bar{R}=8)=\left( \begin{array}{c} n \\ 8 \end{array} \right)p^{8}(1-p)^{n-8}=0.0534$

b) Knowing that 8 parts are classified as not up to standard by the test, what is the probability that there are exactly 12 parts that are not up to standard?

My answer : The formula I want to use is
$Pr(\bar{C}=12|\bar{R}=8)=\frac{Pr(\bar{C}=12 \bigcap \bar{R}=8)}{Pr(\bar{R}=8)}$
but I am aware it's not that simple. I need to start by determining whether the variables are independent or not. If $C$ and $R$ are independent, then $Pr(\bar{C}=12|\bar{R}=8)=Pr(\bar{C}=12)$.
To determine whether or not they are independent I need to find the joint distribution, but I'm stuck.
Can I somehow use $f_{Y|X=x}(y)=\frac{f(x,y)}{f_X(x)}$ ? And if so how would I find $f_{Y|X=x}(y)$ ?
Any help is appreciated
 A: One needs to be more precise about notation.  $R$ and $C$, as well as their complements, are events, not random variables.  Thus, we need additional notation.  Let $X$ represent the random number of parts that are in fact not up to standard; and $Y$ represent the random number of parts that are classified as not up to standard.  Then $$X \sim \operatorname{Binomial}(n = 43, p = \Pr[\bar C] = 0.2),$$ and $$Y \sim \operatorname{Binomial}(n = 43, p = \Pr[\bar R] = 0.282).$$  These are marginal distributions and are dependent.
The answer to the first part of your question is $$\Pr[Y = 8] \approx 0.0534247.$$
For the second part, we should employ Bayes' theorem:  $$\Pr[X = 12 \mid Y = 8] = \frac{\Pr[Y = 8 \mid X = 12]\Pr[X = 12]}{\Pr[Y = 8]}.$$  The denominator has already been calculated.  Also, it is straightforward that $$\Pr[X = 12] = \binom{43}{12}(0.2)^{12} (1 - 0.2)^{43 - 12} \approx 0.0622211.$$  The only quantity remaining is $\Pr[Y = 8 \mid X = 12]$.  We reason that there are $12$ truly not up to standard parts, and the number $Y_{\bar C}$ of these parts that are not classified up to standard is binomial with $n_{\bar C} = 12$ and $p_{\bar C} = \Pr[\bar R \mid \bar C] = 0.89$. Similarly, the number $Y_C$ of parts that are not classified up to standard given they are in fact up to standard, is binomial with $n_C = 43 - 12 = 31$ and $p_C = \Pr[\bar R \mid C] = 0.13$.  These two random variables are in fact independent.  Therefore,
$$\begin{align}
\Pr[Y = 8 \mid X = 12] 
&= \sum_{y=0}^8 \Pr[Y_{\bar C} = y]\Pr[Y_C = 8-y] \\
&= \sum_{y=0}^8 \binom{12}{y} (0.89)^y (1-0.89)^{12-y} \binom{31}{8-y} (0.13)^{8-y} (1-0.13)^{31-(8-y)} \\
&\approx 0.000860467.
\end{align}$$
Therefore, the desired probability is $$\Pr[X = 12 \mid Y = 8] \approx \frac{(0.000860467)(0.0622211)}{0.0534247} = 0.00100214.$$
