# 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)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://julienbeaulieu.gitbook.io/wiki/sciences/math/probability/conditional-probability.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
