I have this exercise I have to solve.
There are 4 outcome values $x_1,x_2,x_3,x_4$ with probabilities:
$P(x_1)=\frac{1}{10}$, $P(x_2)=\frac{4}{10}$, $P(x_3)=\frac{3}{10}$ and $P(x_4)=\frac{2}{10}$
Define the 2 events $A=(x_1,x_2)$, i.e., either $x_1$ or $x_2$ occurred and $B=(x_2,x_3)$, i.e., either $x_2$ or $x_3$ occurred.
Compute the conditional probability $P(A|B)$.
I know that if there are only two events $A$ and $B$ then
$P(A|B)=\frac{P(B|A)P(A)}{P(B)}$
and an alternative formulation is
$P(E|F)= \frac{P(F|E)P(E)}{P(E)P(F|E)+P(\bar{E})P(F|\bar{E})}$
But do I have to use this formulation and if so how do I calculate $P(B|A)$?
This assumes that the four outcomes $x_1$, $x_2$, $x_3$ and $x_4$ are mutually exclusive.
You don't have to use the formulas for this question. $P(A|B)$ is saying what's the probability of $A$ given that $B$ has happened. In this context this means we have either got $x_2$ or $x_3$. Knowing this, what's the probability that we have got $x_1$ or $x_2$. Well the probability of having got $x_1$ is zero because we know we either got $x_2$ or $x_3$. And the probability of getting $x_2$ is $\frac{P(x_2)}{P(x_2) + P(x_3)} = \frac{\frac{4}{10}}{\frac{4}{10} + \frac{3}{10}} = \frac{4}{7}$.
This means that the probability of getting $A$ given $B$ is $\frac{4}{7}$.
If you did want to do this with a formula, the formula that would be easiest to use would be $$P(A|B) = \frac{P(A \cap B)}{P(B)}.$$ We know $P(B)=P(x_2)+P(x_3)$ and we know the only way to get $A$ and $B$ is by getting $x_2$ so $P(A \cap B) = P(x_2)$. So we can plug these into the formula and get the same answer $$P(A|B) = \frac{4}{7}.$$