Data Science

Joint & Conditional Probability Explained with Examples

In this post, you will learn about joint and conditional probability differences and examples. When starting with Bayesian analytics, it is very important to have a good understanding around probability concepts. And, the probability concepts such as joint and conditional probability is fundamental to probability and key to Bayesian modeling in machine learning. As a data scientist, you must get a good understanding of probability related concepts.

Joint & Conditional Probability Concepts

In this section, you will learn about basic concepts in relation to Joint and conditional probability.

Probability of an event can be quantified as a function of uncertainty of whether that event will occur or not. Let’s say an event A is whether rolling a die will result in 2. You may want to know about the uncertainty related to whether event A will occur or not. This can also be stated as what is the probability that the event A will occur. Mathematically, probability of whether event A will occur or not can be denoted as P(A).

When we talk about two events, then the concept of joint and conditional probability comes into picture. Taking the rolling die as example, let’s consider another event B such as whether rolling a die will result in one of the event numbers such as 2, 4 or 6. The probability of an event B occurring can be denoted as P(B).

What is Conditional Probability?

Conditional probability is probability of an event given that another event has occurred. Going by the example sighted above, conditional probability in terms of event A and B can be defined as probability of event A (rolling a die results in 2) given event B (rolling the die result in even number 2, 4 or 6) has occurred. Mathematically, it can be written as P(A | B).

What is Joint Probability?

Joint probability of two events A and B is termed as the product rule of probability and can be represented mathematically as the following:

P(A, B) = P(A | B) * P(B)

The above can be read as the following:

Joint probability P(A, B) of event A and B is the product of probability of event A given event B occurred and the probability of event B. Going by the rolling die example, joint probability of event A (rolling die results in 2) and event B (rolling die results in an even number) is product of probability of event A (rolling die results in 2) given event B (rolling die resulted in even number) and probability event B (rolling die resulted in the even no.)

5 Examples of Joint & Conditional Probability

Here are some examples of joint and conditional probability:

  • Probability P(A, B) that the floor is wet (event A) and rainfall occured (event B) is the product of probability of floor being wet given rainfall happened P(A|B), and, probability that rainfall happened P(B)
  • Probability P(A, B) that a person is suffering from cancer (event A) and the person smokes (event B) is the product of probability that person suffers from cancer given person smokes P(A|B), and, probability that the person smokes P(B)
  • Probability P(A, B)that the company is successful (event A) and the company makes great products (event B) is the product of probability that the company is successful given the company builds great products P(A|B), and, probability that the company builds great product P(B).
  • Probability P(A, B) that the team wins the game (event A) and the team practices well (event B) is the product of the probability that the team wins given team practices well P(A|B), and, probability that the team practices well P(B)
  • Probability P(A, B) that the person gets the software job (event A) and the person is an engineer (event B) is the product of the probability that the person gets a job given he/she is an engineer P(A|B), and, the probability that the person is an engineer P(B)

Ajitesh Kumar

I have been recently working in the area of Data analytics including Data Science and Machine Learning / Deep Learning. I am also passionate about different technologies including programming languages such as Java/JEE, Javascript, Python, R, Julia, etc, and technologies such as Blockchain, mobile computing, cloud-native technologies, application security, cloud computing platforms, big data, etc. I would love to connect with you on Linkedin. Check out my latest book titled as First Principles Thinking: Building winning products using first principles thinking.

Recent Posts

Retrieval Augmented Generation (RAG) & LLM: Examples

Last updated: 25th Jan, 2025 Have you ever wondered how to seamlessly integrate the vast…

4 weeks ago

How to Setup MEAN App with LangChain.js

Hey there! As I venture into building agentic MEAN apps with LangChain.js, I wanted to…

1 month ago

Build AI Chatbots for SAAS Using LLMs, RAG, Multi-Agent Frameworks

Software-as-a-Service (SaaS) providers have long relied on traditional chatbot solutions like AWS Lex and Google…

1 month ago

Creating a RAG Application Using LangGraph: Example Code

Retrieval-Augmented Generation (RAG) is an innovative generative AI method that combines retrieval-based search with large…

1 month ago

Building a RAG Application with LangChain: Example Code

The combination of Retrieval-Augmented Generation (RAG) and powerful language models enables the development of sophisticated…

1 month ago

Building an OpenAI Chatbot with LangChain

Have you ever wondered how to use OpenAI APIs to create custom chatbots? With advancements…

1 month ago