# Probability of inequality, Markov inequality application

A bit of context: working on a problem about channel coding. Through a channel we are sending a random variable $X_n$, a code, and at the other side we see $Y$ (both discrete). Then we perform an estimation of ML to decide which $X_n$ was sent, but we can make a mistake and detect $X_{n'}$ instead.

Anyway, conditioning to $X$ and $Y$, the probability of an error is

$$P \left( p(Y|X_{n'})>p(Y|X_n)|X_n,Y \right)$$

To this I want to apply Markov's inequality

$$\frac{E(A)}{t} \geq P(A>t)$$

But I'm not sure on how should I treat the conditionals. Any help would be appreciated.

Is $p(Y|X_{n'})$ the conditional probability of $Y$ given $X_{n'}$? Then, $p(Y|X_{n'})$ is a non-negative random variable (more precisely, a non-negative measurable function with respect to the sigma-algebra generated by $X_{n'}$). So, if $p(Y|X_n)>0$, we have $$P \left( p(Y|X_{n'})>p(Y|X_n)\bigg|X_n,Y \right){}\leq{}\dfrac{\mathbb{E}\left[p(Y|X_{n'})\bigg|X_n,Y\right]}{p(Y|X_n)}\,.$$
To elaborate a little on ki3i's answer (+1): if you are given $X_n,Y$, then $p(Y|X_n)=t$ is some constant, and (conditioned on the same) $p(Y | X_{n'})=g(X_{n'})=Z$ is a random variable (function of $X_{n'}$)
Then the probability given is just $P(Z>t) \le \frac{E(Z)}{t}$ Replacing $Z$ by $p(Y | X_{n'}) \mid Y,X_n)$ and $t$ you get the other answer. You can simplify it a little by noting that, in the communication model, the conditioning on $X_n$ in the numerator can be removed.