Artificial intelligent assistant

An example for conditional expectation A factory has produced n robots, each of which is faulty with probability $\phi$. To each robot a test is applied which detects the faulty (if present) with probability $\delta$. Let X be the number of faulty robots, and Y the number detected as faulty. Assuming the usual indenpendence, determine the value of $\mathbb E(X|Y)$. Please explain me the result in detail or give me a good hint pls, since I am very new to this concept (of conditional expectation). Thanks!

Denote with $F$ the event that a robot is faulty, with $P(F)=\phi$ and with $T$ the event that it was tested faulty with $$P(T|F)=\delta$$ and $$P(T|F')=0$$ Thus according to the law of Total Probability the probability that a random robot is tested faulty is equal to $$P(T)=P(T|F)P(F)+P(T|F')P(F')=\delta\cdot\phi+0=\delta\cdot\phi$$ Now, if a robot was not tested faulty then the probability that it is nevertheless faulty is equal to $$P(F|T')=\frac{P(T'|F)P(F)}{P(T')}=\frac{(1-\delta)\phi}{1-\delta\phi}$$ Assume, now that $Y$ robots were found faulty, then $$E[X|Y]=Y+(n-Y)\cdot\frac{(1-\delta)\phi}{1-\delta\phi}=\frac{n\phi(1-\delta)+(1-\phi)Y}{1-δ\phi}$$ since according to the above calculations if there where $Y$ robots tested faulty, then these $Y$ are for sure faulty, and there is a$\frac{(1-\delta)\phi}{1-\delta\phi}$ probability that each of the remaining $n-Y$ robots that were not tested faulty, is actually faulty as well.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 35d5bfe319558496bf2feb3756fbe930