Question
A commuter takes one trip to work and one trip home. The probability of using Lyft to work is , where . If the commuter uses Lyft to work, the probability of also using it home is . Otherwise, the probability of using it home is .
Find:
- The unconditional probability of using Lyft home.
- The expected number of Lyft trips per day.
- The probability the commuter used Lyft to work given that they used it home.
For the third part, identify any value of for which the conditioning event has probability zero.
Hint 1
Split the home trip by whether the work trip used Lyft. The two cases do not overlap and cover every day.
Hint 2
For the expected count, add one indicator per trip. For the last part, divide the probability of both Lyft trips by the probability of a Lyft trip home.
How to Answer in the Interview
A phone-screen warm-up with three short asks. Each one tests a single rule: total probability, linearity of expectation, and Bayes' rule. The points go to naming the events, keeping the direction of conditioning straight, and catching the edge case.
Clarify first:
- "Is the
for the home trip conditional on a Lyft trip to work, or is it the overall chance of a Lyft trip home?" This post reads it as conditional, as the prompt states. Ifwere unconditional, part 1 would be given outright, and part 3 would need the joint probability of both trips, which the prompt would then not supply. - "Is
allowed?" It is, and part 3 is undefined there.
TIP
How I'd say it in the interview: "I split on the work trip. Lyft home has probability . Expected trips is , no independence needed. Then Bayes gives , defined only for ."
Then walk through:
- Define
andand read the given numbers as,and. - Get
by weighting each case. Most candidates lose points here by averagingandequally. - Add the two indicator expectations for the trip count.
- Divide the joint probability by
, then state thecase.
Solution
Let be the event "uses Lyft to work" and the event "uses Lyft home". The answers are , an expected Lyft trips per day, and
When , the first two answers are and the third is undefined, because the commuter never takes Lyft home.
Part 1: weight each case by how often it happens
The prompt gives the home probability only inside each case, so split every day by the work trip. The cases and are disjoint and cover every day, which lets their contributions add. That is the law of total probability:

Expanding, . The weights and are the case probabilities, not each. Check with : .
Part 2: add one indicator per trip
Write the daily count as , where an indicator is when its event happens and otherwise. An indicator's expectation is . Linearity of expectation adds means of any random variables, dependent or not, so
With , that is .
Part 3: reverse the conditioning
The prompt gives . Part 3 asks for , the share of Lyft-home days that also had a Lyft trip to work. By the definition of conditional probability, that is the joint probability over . The joint is the first path from Part 1, .

Cancelling one from gives . The cancellation needs , which is also exactly when . With , the result is . Seeing a Lyft trip home raises the chance of a Lyft trip to work from to .
WARNING
At , the simplified returns , but the original ratio is . Conditioning on an event of probability zero is undefined, so say so instead of reporting .
Code
An exact check with fractions: the case-by-case computation should match the three closed forms for several values of .
from fractions import Fraction
for p in (Fraction(1, 10), Fraction(1, 5), Fraction(3, 10)):
both = p * (2 * p)
home = both + (1 - p) * p
trips = p + home
work_given_home = both / home
match = (home == p + p**2 and trips == 2*p + p**2
and work_given_home == 2*p / (1 + p))
print(f"p={p}: P(H)={home}, E[T]={trips}, "
f"P(W|H)={work_given_home}, closed forms match: {match}")
Output:
p=1/10: P(H)=11/100, E[T]=21/100, P(W|H)=2/11, closed forms match: True
p=1/5: P(H)=6/25, E[T]=11/25, P(W|H)=1/3, closed forms match: True
p=3/10: P(H)=39/100, E[T]=69/100, P(W|H)=6/13, closed forms match: True
Additional Notes
Common mistakes
- Averaging the two home probabilities equally,
. It uses both given numbers but treats the two cases as equally frequent. Atit givesinstead of. - Reversing a conditional by swapping labels.
isat, while. - Multiplying the marginals for the joint probability. The trips are dependent, so
atis wrong. The joint is. - Assuming linearity of expectation needs independence. It does not.
What this question tests
The question tests the three basic rules of conditional probability and whether you apply them in the right direction. The interviewer looks for clearly named events and a stated edge case. Likely follow-ups:
- Exactly one Lyft trip:
, which isat. - Are the trips independent? No, because
whenever. - Expected Lyft trips over a five-day week:
by linearity, with no assumption about how days relate.
Patterns to reuse
- When a probability is only given inside cases, split on the event that defines the cases and weight each case by its own probability.
- Bayes' rule is a joint over a marginal, and the marginal usually comes from total probability over the same split.
- Turn any count into a sum of indicators before taking its expectation.