Skip to content

Moe’s Homepage

Knows how to provide Solution

Menu
  • Home
  • About
    • About Me
Menu

Face The challenges Heads On

Posted on September 19, 2024September 21, 2024 by mabouali

Table of Contents

Toggle
  • Introduction
  • Computing The Chance Of Winning
    • Analytic or closed form method
    • Chance of winning the set if you choose to play team A first
    • Chance of winning the set if you choose to play team B first
    • So which one has more chance?
  • Could I answer this question differently?
  • How else can I answer this question?

Introduction

In one of the job interviews, I was asked to answer a puzzling question. The question was simple; but yet intriguing and tricky.

Here is the question: You are going to play two teams for three rounds in total. You can not play one team twice in a row. You need to alternate. and in order to win the whole set, you need to win two consequent rounds. Not two rounds out of three rounds; but two consequent rounds. The two teams are not at the same level, and based on previous statistics, you know that you have better chance to win over one team compared to the other. Which team do you play first? The one that you have better chance to win? or the one that you have less chance to win?

Now, before we answer the question, let’s dig in a bit more. Let’s call these two teams: Team A and Team B. You need to play 3 rounds and you cannot play the same team twice in the row. So your only options are:

  • Option 1: Team A, Team B, and Team A again (ABA), or
  • Option 2: Team B, Team A, and Team B again (BAB).

Now let’s say P_A is the probability that you win a game over team A and P_B is the probability that you win over team B. Let’s also assume P_A > P_B, which means you have smaller chance of winning over team B, it is harder for you to win over team B, and/or it is easier to win a game against team A.

So, which team do you choose to play first? Team A or Team B? If you start your rounds with Team A (i.e. Option 1) which you have more chance of wining or it is easier to win over and you will play that team twice. But if you choose Option 2, i.e. start playing with the team that you have less chance to win or it is harder for you to win, you have to play that team twice?

So which one do you choose? do you postpone playing with the stronger team and prefer to start with the easier task? Do you mistake the easy start as a seemingly easy path? Or do you face your challenge heads on?!

Well, you might have guessed, already. In this example, you have a better chance of winning the game, if you start with the stronger team that you have less chance to win over, even though, you end up playing that team twice.

Let’s compute the chances of winning for these two options. We are going to explain two methods (well, three methods, actually, but you can argue if the one of the methods is correct way or not).

Computing The Chance Of Winning

Analytic or closed form method

As mentioned, the game consist of three rounds, and you have to win two games consequently to win the whole game. Not 2 games out of 3, but 2 games consequently. So, the following are the cases that you will win the game:

ScenariosRound 1Round 2Round 3
1winwinloose
2loosewinwin
3winwinwin
Scenarios that you will win the entire set

Chance of winning the set if you choose to play team A first

Now let’s assume you start with Team A. Then the sequence of plays would be

Team A –> Team B –> Team A

In this case, your chance of winning if scenario 1 happens is, P_A P_B (1-P_A), recall that P_A was the chance winning a game against team A and P_B was the chance or probability winning a game against Team B.

Like wise you can compute the possibility of winning the set in each option as follows:

scenariosWinning Probability
1 (win-win-loose)P_A P_B (1-P_A)
2 (loose-win-win)(1-P_A) P_B  P_A
3 (win-win-win)P_A P_B P_A

And your total chance would be the sum of these probabilities:

    \[\begin{matrix} P_{ABA} &=& P_A P_B (1-P_A) + (1-P_A) P_B  P_A + P_A P_B P_A \\ &=& P_A P_B \left ( 1 - P_A + 1 - P_A + P_A \right ) \\ &=& P_A P_B \left ( 2 - P_A \right ) \end{matrix}\]

Chance of winning the set if you choose to play team B first

Now let’s assume you start with Team B. Then the sequence of plays would be

Team B –> Team A –> Team B

Scenario Winning Probability
1 (win-win-loose)P_B P_A (1-P_B)
2 (loose-win-win)(1-P_B) P_A P_B
3 (win-win-win)P_B P_A P_B

And your total chance would be the sum of these probabilities:

    \[\begin{matrix} P_{BAB} &=& P_B P_A (1-P_B) + (1-P_B) P_A P_B + P_B P_A P_B \\ &=& P_A P_B \left ( 1 - P_B + 1 - P_B + P_B \right ) \\ &=& P_A P_B \left ( 2 - P_B \right ) \end{matrix}\]

So which one has more chance?

Let’s subtract P_{ABA} from P_{BAB}, then we have:

    \[\begin{matrix} P_{BAB} - P_{ABA} &=& P_A P_B \left ( 2 - P_B \right ) -  P_A P_B \left ( 2 - P_A \right )\\ &=& P_A P_B \left ( 2 - P_B -2 + P_A \right ) \\ &=& P_A P_B \left ( P_A - P_B \right ) \end{matrix}\]

Now we know that P_A>0, P_B>0, and P_A>P_B, therefore, \left ( P_A -P_B \right ) > 0. This means that P_{BAB} - P_{ABA} > 0, which means P_{BAB} > P_{ABA}.

There you have your answer! if you want higher chance of winning the whole game, you better start with the team that you have less chance of winning over, even though you end up playing with that team twice. Face the challenge!

Could I answer this question differently?

Yes, of course. One way of guessing the solution without going into all these details is to understand what are the winning conditions. The winning condition is to win two games in a row. Not two games out of three; but two games in a row. So, whatever you do, you should not loose the second game or the game in the middle. Because if you loose that one, doesn’t matter what you do before or after (win or loose), you are not going to have two wins in a row any more. Hence, you want to maximize your chance of winning of the second/middle game, which means you want to play team A in the middle which you have a better chance of winning over.

This is another way to reason, why you should start with the stronger team, rather than with the easier team.

How else can I answer this question?

If you don’t have time for the first method or you are too tired of coming up with the reasoning of the second method, there is another method that you can answer this question: Using Monte Carlo Simulation.

Here how you do it:

  1. You can randomly generate two probability between 0 and 1.
  2. Assign the higher number as P_A and the lower number as P_B.
  3. Now generate couple of thousands of games (the more the better) assuming A-B-A order and see how many of them do you win.
  4. Now Generate couple of thousands of games (the more the better) assuming B-A-B order and see how many of them do you win.
  5. Check which one was better: ABA or BAB.
  6. repeat Step 1 to 5 for couple of thousands of times (the more the better).

If you repeat the above procedure over and over, gradually you can see that overall B-A-B has higher chance of winning than A-B-A.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search Posts

Latest Posts

  • Face The challenges Heads On
  • Miranda Warning On Social Media In The Age of AI
  • Bus-Factor
  • It works! sometimes!
  • To comment, or not to comment, that shouldn’t be even a question!

Categories

  • Fundamentals
  • Linear Algebra
  • Mathematics
  • Memories
  • opinion
  • Piecewise-Linear
  • Programming
  • Python
  • SQL
  • Stories
  • Uncategorized

Archive

  • September 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
© 2025 Moe’s Homepage | Powered by Minimalist Blog WordPress Theme