$$P(AlB)=P(A)P(B\mid A)/[P(A)P(B \mid A)+P(A^c)P(B \mid A^c)] $$
$$P(A \mid B) = [P(B \mid A)P(A)]/P(B)$$
1) Are these two equations so called bayes formula??
2) how do you distinguish whether to use the first one or the second one?
3) If i assume A and B are independent, and let P(A)=0.2, P(B)=0.3 i get 0.2 using both equations. but what if A and B are dependent? how would you calculate conditional probabilities such as $$P(B \mid A)$$
The second equation is Bayes' theorem. I prefer to think of the theorem as written in the form $$\Pr[A \mid B]\Pr[B] = \Pr[A \cap B] = \Pr[B \mid A]\Pr[A],$$ because it is symmetric and easy to remember.
The first equation is simply the law of total probability applied to the denominator (the marginal distribution) of Bayes' theorem; i.e., for an even $A$ and its complement $\bar A$, $$\Pr[B] = \Pr[B \mid A]\Pr[A] + \Pr[B \mid \bar A]\Pr[\bar A].$$ These are two different concepts.