> For the complete documentation index, see [llms.txt](https://julienbeaulieu.gitbook.io/wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://julienbeaulieu.gitbook.io/wiki/sciences/math/probability/conditional-probability.md).

# Conditional Probability

The outcome of one event depends on an earlier event.

For example, the probability of obtaining a positive test result is dependent on whether or not you have a particular condition. If you have a condition, it is more likely that a test result is positive. We can formulate conditional probabilities for any two events in the following way:

![](/files/-Lg3CU13cvlV_tIaA0_u)

Example

![](/files/-Lg35fEwuS4MWVwdpQR6)

We run a test to see if the person actually has cancer. In blue is the test and the conditionnal probability.&#x20;

So the test depends on something else: if the person has cancer or not. &#x20;

If this, we can write the truth table:&#x20;

![](/files/-Lg36pu-81uy1mI1ILww)

To calculate the first Prob for example = P(cancer) = 0.1 \* P(positive | Cancer) = 0.9 = 0.09.&#x20;

The sum of all of those P's = 1.&#x20;

To find the Prob of a result being positive = 0.09 + 0.18 = 0.27. In reality what we did was:&#x20;

![](/files/-Lg3891G4S24nkGmTf8v)

Ex: say we have a bag of coins with 1 fair coin and 1 non fair coin. We pick 1 at random (50-50 chances). What's the prob of picking a head?&#x20;

![](/files/-Lg39gtoq_T182IqdkdB)

Same question now we flip the coin twice.&#x20;

![](/files/-Lg3B6C_Cw2862OAm837)
