Station $X$ begin to transmit a message in $[0,20]$ with uniform distribution, and $Y$ also want to transmit a message in $[6,14]$ with uniform distribution. Assume that transmission takes $2$ seconds. We define "collision" if while $B$ transmits a message, $A$ starts to transmit, or if while $A$ transmits, $B$ start to transmits.
I need to compute the probability of "collision". So, for example, let's say $B$ start to transmit in $10$. So, if $A$ transmits in $[10-2,10+2]$ a collision will occur. I defined two events:
$A$ = "X will send in $[8,12]$"
$B$ = "X send in $[0,20]$"
I'm trying to use Bayes theorem but i'm must be missing something in my understanding, because i get : $$P(A|B)=\frac{P\left(A\bigcap B\right)}{P\left(B\right)}=\frac{\left(\frac{1}{4}\right)}{\left(\frac{1}{20}\right)}=5$$
What is my mistake?
Your mistake is using Bayes' Rule. Don't.
$$\begin{align} \Pr(\lvert X-Y\rvert\leq 2) ~=~& \Pr(Y-2\leq X\leq Y+2) \\[1ex] = ~& \dfrac{1}{5} \end{align}$$
Because whatever the value of $Y$ is in $[6;14]$, the probability that $X$ will lie within the four second interval near that value is: $4/20$.