Applications

EspaƱol


Modular Arithmetic: Family Vacation Trick (Interview)


There exists 4 families: the Diamonds, the Hearts, the Clubs, and the Clovers. They are all staying at the Heart Ace Hotel. But what happens when the families start to fight? They all just want to be with their friends. How can they break it up to make the 4 room arrangement work? Follow the steps below!

1: The Families
2: The Families get in their Rooms
3: The Families get Together
4: The Families Break (3 times)
5: The Families are resorted
6: The Families get their new Rooms!

How did the familes get resorted? See explanations below!


The image below shows the backside of the cards after step 3: The Families get Together. One can see that the order in their "stack" has has remained. Note that each suit corresponds to a different mod. Namely, Kings are mod 1, Queens are mod 2, Jacks are mod 3, and 10s are mod 4.

During step 4: The Families Break (3 times), cards are broken at a given point and moved to the back of the deck. Notice that the card's position changes, but the mod of its suit does not. The King of Hearts was in position 1, and after the switch it is in position 12. However, before and after the switch, all Kings exist in the same mod!

This is because of modular arithmetic! Dealing with 16 cards, in a mod 4 system (the suits repeat every 4 cards), a card's mod depends more on its order than its "number" in line! In the first picture, the Queens are in positions 2, 6, 10, 14. After they are in positions 1, 5, 9, 13. Their position changes, but their mods are always the same, as shown below.

Thus, when the "families" are distributed in a counterclockwise direction, the mods always line up, or each family member gets to room with their friends!



Combinatorics: Poker


Poker is a game that, in its basic structure, involves players betting against each other to see who has the best hand. Bets are placed based on the confidence of a player to have a desirable hand. Desirable hands include full house, 3 of a kind, 4 of a kind, royal flush, or straight.

Let us say that you are trying to see find the probability of getting a 3 of a kind hand. Keep in mind that to find probability, one needs to divide the number of occurrances by the number of total outcomes (Brilliant).

Frequency of poker hands
Frequency of poker hands Explanation

A deck of cards has 52 cards, and a poker hand has 5 cards. Therefore, the total number of Combinations is 2,598,960

Frequency 3 of a kind
Frequency 3 of a kind Explanation
Select one rank for the 3 cards to be. Then, choose 3 of 4 suits to be the 3 of a kind cards. This accounts for the first 3 cards. After that, choose 2 remaining ranks of the remaining 12 for the last 2 (of the 5 in a hand). Finally, a suit will be chosen for each of those 2 cards.
Probability of 3 of a kind
Probability of 3 of a kind Explanation
There are 54,912 options for a 3 of a kind, and 2,598,960 options for a 5 of a kind. The product is the probability of a 3 of a kind: 88/4165