Let \(A_{1}\) and \(A_{2}\) be probabilistic algorithms. Let \(B\) be any
probabilistic algorithm that always outputs 0 or \(1 .\) For \(i=1,2,\) let
\(A_{i}^{\prime}\) be the algorithm that on input \(x\) computes and outputs
\(B\left(A_{i}(x)\right) .\) Fix an input \(x,\) and let \(Y_{1}\) and \(Y_{2}\) be
random variables representing the outputs of \(A_{1}\) and \(A_{2},\)
respectively, on input \(x,\) and let \(Y_{1}^{\prime}\) and \(Y_{2}^{\prime}\) be
random variables representing the outputs of \(A_{1}^{\prime}\) and
\(A_{2}^{\prime}\), respectively, on input \(x .\) Assume that the images of
\(Y_{1}\) and \(Y_{2}\) are finite, and let \(\delta:=\Delta\left[Y_{1} ;
Y_{2}\right]\) be their statistical distance. Show that
\(\left|\mathrm{P}\left[Y_{1}^{\prime}=1\right]-\mathrm{P}\left[Y_{2}^{\prime}=1\right]\right|
\leq \delta\).