(d)
$A\$and $B$ will agree in a certain statement if both speak truth or both tell a lie. We define following events
$E_{1} = A\ and\ B$ both speak truth $\Rightarrow P\left( E_{1} \right) = xy$
$E_{2} = A\ and\ B$ both tell a lie $\Rightarrow P\left( E_{2} \right) = (1 - x)(1 - y)$
$E = A$ and $B$ agree in a certain statement
Clearly, $P\left( E \middle| E_{1} \right) = 1\ and\ P\left( E \middle| E_{2} \right) = 1$
The required probability is $P(E_{1}|E)$
Using Bayes’ theorem
$P\left( E_{1} \middle| E \right) = \frac{P\left( E_{1} \right)P(E|E_{1})}{P\left( E_{1} \right)P\left( E \middle| E_{1} \right) + P\left( E_{2} \right)P(E|E_{2})}$
$= \frac{xy.1}{xy.1 + (1 - x)(1 - y).1} = \frac{xy}{1 - x - y + 2xy}$