1
$\begingroup$

Suppose Prof. X goes to a road side tea-coffee shop everyday at 5pm just after his office. After reaching there he tosses a coin, and places his order tea or coffee. The shop owner Y has been observing this for one month. By watching some movies he has learnt a bit of probability. Y wants to predict what the professor will order everyday.

I have 3 questions which I need to solve:

(i) Please build a mathematical model for Y. Precisely describe and justify.

(ii) Derive a solution for that model if required, and then

(iii) write an algorithm how Y can predict what X will order.

$\endgroup$
2
  • 2
    $\begingroup$ This looks like an exam question, not a Q&A. Please provide some details about what have you tried to solve this problem, and limit it to one problem, rather than laying out three bullet points $\endgroup$ May 29 at 14:51
  • 1
    $\begingroup$ @StefanPopov my thinking is The coin tosses are completely at random... right? If so, we can't really predict the next outcomes. The professor's previous orders don't affect what he'll order next at all. But the interviewer doesn't satisfy by my answer. So please help me how to approach this question. $\endgroup$
    – S. M.
    May 29 at 16:05

1 Answer 1

2
+50
$\begingroup$

I think this is a problem that may be solved using distribution functions.

I. The mathematical model for Y is a Bernoulli distribution. The Bernoulli distribution is a probability distribution that describes the outcome of a single trial of an experiment with two possible outcomes, such as a coin flip. In this case, the two possible outcomes are that the professor will order tea or coffee. The probability of the professor ordering tea is denoted by p, and the probability of the professor ordering coffee is denoted by 1-p.

The shop owner Y has been observing the professor for one month, and he has observed that the professor orders tea 60% of the time and coffee 40% of the time. This means that p = 0.6 and 1-p = 0.4.

II. The following formula gives the solution for the Bernoulli distribution:

P(X = x) = p^x (1-p)^(1-x)

Where x is the number of successes (in this case, the number of times the professor orders tea) and n is the total number of trials (in this case, the number of days that the shop owner has been observing the professor).

We want to find the probability that the professor orders tea on any given day. The number of successes is x = 1, and the total number of trials is n = 30 (the number of days a month). Plugging these values into the formula, we get:

P(X = 1) = 0.6^1 (1-0.6)^(30-1) = 0.6^1 (0.4)^(29)

This means that the probability that the professor orders tea on any given day is 0.6^1 (0.4)^(29) = 0.377.

III. The algorithm for Y to predict what the professor will order is as may be:

  1. Generate a random number between 0 and 1. If the random number is less than p, then predict that the professor will order tea. Otherwise, predict that the professor will order coffee. For example, if the random number is 0.5, then Y would predict that the professor will order tea, because 0.5 is less than p = 0.6.

The accuracy of this algorithm will depend on the value of p. If p is close to 0 or 1, then the algorithm will be very accurate. However, if p is close to 0.5, then the algorithm will not be as accurate.

In this case, p = 0.6, so the algorithm is expected to be about 60% accurate. This means that for every 100 days that the shop owner uses the algorithm, he will predict the professor's order correctly 60 times.

Hope it helps!

$\endgroup$
5
  • 1
    $\begingroup$ "if p is close to 0.5, then the algorithm will not be as accurate "-- because both tea and coffee have same probability. Am I correct? $\endgroup$
    – S. M.
    May 29 at 17:02
  • 2
    $\begingroup$ Yes, there are more uncertainty as the prediction is closer to .5 $\endgroup$
    – Multivac
    May 29 at 17:10
  • 2
    $\begingroup$ You may get the solution more complex, for example, if you need to estimate the probability of asking n times for a tea (Binomial) or n consecutive teas (Geometric). But for the case you mentioned it is well enough $\endgroup$
    – Multivac
    May 29 at 17:12
  • $\begingroup$ Let me take a look, CV is not my field of experience, let me check it $\endgroup$
    – Multivac
    May 30 at 22:29
  • $\begingroup$ please use it with care, I still do not tested it properly $\endgroup$
    – Multivac
    Jun 1 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.