Mathematical Examples (with Solutions)#

Question 1: Law of Total Probability and Conditional Probability#

A company runs an email campaign to two groups of users:

  • 70% of users are existing customers

  • 30% of users are new users

The probability that a user opens the email is:

  • 40% for existing customers

  • 10% for new users

(a) What is the overall probability that a randomly selected user opens the email?
(b) If a user opened the email, what is the probability that the user was an existing customer?


Solution#

Let:

  • \(E\) = existing customer

  • \(N\) = new user

  • \(O\) = email is opened

Given:

  • \(P(E) = 0.7\), \(P(N) = 0.3\)

  • \(P(O \mid E) = 0.4\)

  • \(P(O \mid N) = 0.1\)

(a) Law of Total Probability#

\(P(O) = P(O \mid E)P(E) + P(O \mid N)P(N)\)

\(P(O) = (0.4)(0.7) + (0.1)(0.3) = 0.28 + 0.03 = 0.31\)

Answer: The probability a user opens the email is 31%.


(b) Conditional Probability#

\(P(E \mid O) = \dfrac{P(O \mid E)P(E)}{P(O)}\)

\(P(E \mid O) = \dfrac{0.4 \times 0.7}{0.31} \approx 0.903\)

Answer: About 90.3% of opened emails come from existing customers.


Question 2: Expected Value with Negative Cost (Profit/Loss)#

A company launches an online ad with the following outcomes:

  • With probability 0.2, the user clicks and the company earns +$5

  • With probability 0.8, the user does not click and the company loses −$1 (ad cost)

Let \(X\) be the profit from showing one ad.

(a) Compute the expected value of \(X\).
(b) Interpret the result.


Solution#

Possible outcomes:

  • \(X = 5\) with probability 0.2

  • \(X = -1\) with probability 0.8

Expected value:

\(\mathbb{E}[X] = (5)(0.2) + (-1)(0.8)\)
\(\mathbb{E}[X] = 1 - 0.8 = 0.2\)

Answer (a): The expected profit per ad is $0.20.

Answer (b):
Even though most users do not click, the campaign is profitable on average over many impressions.

This is why expected value is critical for decision-making in data science and business.


Question 3: Expected Value + Binomial Interpretation#

Each user independently clicks an ad with probability \(p = 0.05\).
The ad is shown to 200 users.

(a) What distribution models the number of clicks?
(b) What is the expected number of clicks?


Solution#

Each user click is a Bernoulli trial. The total number of clicks is the sum of many Bernoulli trials.

\(X \sim \text{Binomial}(n = 200, p = 0.05)\)

Expected value:

\(\mathbb{E}[X] = np = 200 \times 0.05 = 10\)

Answer: On average, we expect 10 clicks per campaign.

Practice Problems (No Solutions, Try Yourself)#

Problem 1: Law of Total Probability#

A video platform categorizes users into two groups:

  • 65% of users are subscribers

  • 35% of users are non-subscribers

The probability that a user watches a recommended video is:

  • 50% for subscribers

  • 20% for non-subscribers

(a) What is the overall probability that a randomly selected user watches the video?
(b) Which law of probability is used to compute this value?


Problem 2: Conditional Probability#

Using the same setting as Problem 1:

(a) If a user watched the video, what is the probability that the user was a subscriber?
(b) Explain in words what this probability represents.


Problem 3: Expected Value with Costs#

A delivery service faces the following outcomes per order:

  • With probability 0.9, the order is delivered on time with $0 cost

  • With probability 0.1, the order is late and incurs a −$20 penalty

Let \(X\) be the cost per order.

(a) Write down the possible values of \(X\) and their probabilities.
(b) Compute the expected cost per order.
(c) Interpret the expected value in practical terms.


Problem 4: Distribution Choice#

For each scenario below, identify an appropriate distribution and briefly justify your choice:

  1. Number of emails received per hour

  2. Whether a user clicks on an ad

  3. Average error across many model predictions

  4. Number of insurance claims made by a customer in a month with many zero-claim customers