Trying to find math inside everything else

Archive for October, 2025

Discrete Math & Democracy, Weeks 5-6

This time I did purposefully combine two weeks – we had 3 days of no class between them, with the PSAT, a PD day, and a holiday.

We started week 5 with another quiz – they asked for this one to be on paper instead of on the computer, and who was I to go against the will of the people? So below is the quiz I gave:

At this point we wanted to finish off our chart of Methods vs Criteria (except for IIA).

We were able to explain the whether most of the methods passed or failed Condorcet and Anti-Condorcet logically or with a counterexample, but the proof that the Borda Count passes Anti-Condorcet is a little more subtle, and a little more algebraic, so I broke that out into a worksheet.

This led to a good combinatorics connection for me. The standard way to calculate the Borda Count is to assign points based on how many candidates you beat, so if you look at it from the point of view of a ballot, in an election of 5 candidates, e.g., a single ballot gives out 4 + 3 + 2 +1 + 0 = 10 points. But another way to view the Borda Count is that you earn a point from a candidate (as opposed to from the voter/ballot) every time you beat them in a 1v1 match. Well, with 5 candidates, how many possible 1v1 matches are there? 5C2 = 10. Oh wait, that’s the same as before! And shows why the C2 column of the Arithmetic Triangle (sometimes known as Pascal’s) is the Triangle Numbers.

Speaking of combinatorics, the next part was fun. First, we considered how many different ways there are to seed an 8 person tournament. There’s lots of ways to represent this number – my first conception of it involved double factorials!! (Sam was shocked I had found a natural use for double factorials.) Thought the final conception was came up with (n! / 2^k, where k is the number of symmetries in the bracket) was easier to calculate and made more sense.

But the real fun part was thinking, well, if there’s 315 different ways to seed the bracket, is there a way to seed it such that every person can win? So I challenged them to seed the tournament so that A wins, and then so that C wins. (Some candidates couldn’t win, like B and D, because they had fewer wins than the number of matches in the tournament. A and C were possible but harder because they had few paths to victory.)

After this I introduced the concept of a Condorcet method, which tournaments are, despite their manipulability flaw. So I expanded our chart to include the methods we’d be doing soon: Copeland’s, Minimax, Nanson, and Ranked Pairs.

Finally, we had another quiz:

Streak Bonus in the Pokémon TCG

Here’s a fun problem I worked on recently – fun enough that I nerdsniped two of my coworkers about it. Here’s the problem:


In the Pokémon TCG Pocket app, I would earn 10 points for winning a match and lose 7 points when losing a match. However, you also get a win streak bonus – the second win in a row gets a bonus of 3 points, the third gets 6, the fourth 9, and the fifth (and all subsequent) gets 12. Assuming I have a win rate of 50% (which I did at the time), what’s my expected value for playing n games? (How many games would I expect to play to earn x points?)

Below is a journey through my thought process – you can jump to the end if you just want the answer.


I started by writing out the different possibilities of runs of wins and losses for 1 game, 2 games, 3, etc. Thinking that if I listed them by hand I might miss some, I realized that I could use CONCATENATE in a spreadsheet to work recursively – take all the runs from (n-1) games and append a W at the end, then repeat the process with an L. So I did that here:

https://docs.google.com/spreadsheets/d/1izBy3wN-sVFV8SxExDxGC9rNVebEA5C7iPydU_kmP1Y/edit?gid=748567562#gid=748567562

(There’s 3 tiers, each with its own sheet – Master Ball Tier, where you lose 10 points on a loss, Ultra Ball with 7 [the tier I’m in], and Great Ball with 5. It makes sense to work through the problem in Master Ball, so you can just focus on the streak, and then adjust afterwards.)

Notably because I had some errors in my data, my calculated EVs and EV/game didn’t seem like nice numbers, so my first instinct was to turn to statistics. I did a log regression for the EV/game numbers and then used that to calculate when I would hit the number of points I needed (340). [You can just change which function it is to change tiers.]

https://www.desmos.com/calculator/tspirmvama

This felt unsatisfactory and I wondered if my logic was sound, so I roped in the inimitable Sam Shah and talked him through the problem. He voiced his belief that there would be an explicit solution, so that turned me back to my table. As I walked him through it, we found the errors I had, which made things look nicer, so on the right track.

What really matters as you go through each game in the run, once you get past 5 games, is just the final five games. As you go through each game, we’ll notice that there’s a doubling happening. For example, after 2 games there’s 1 way to end in 2 wins, 1 way to end in 1 win, and 2 ways to end in a loss. After 3 games, there’s 1 way to end in 3 wins, 1 way to end in 2 wins, 2 ways to end in 1 win, and 4 ways to end in a loss. Once you get past 5 games, you no longer need to be introducing new sequences to look for, so then they start combining, as below:

For every game that represents a run that ends in 5 wins, I need to add 22 points. For every game that represents a run that ends in 4 wins, I need to add 19 points. And so on. And the total number of possible runs is 2^n, so to get the expected value of a single game, I would need this expression (for Ultra Ball tier):

Then I just need to add that value for every game past 5 onto the value I already calculated for 5 games, and voila!

But wait, you may have noticed that that expression could be reduced. In fact, once you reduce it, it no longer depends on the variable n – it’s constant!


So basically we have linear function with this value as the slope (and a domain of more than 5 games). So I made this graph to represent the three tiers – just input for y how many points you’ll need and the x-value for each intersection will tell you how many games you expect to play for each tier.

https://www.desmos.com/calculator/jdrc6qzrsh

Extension questions: What if I didn’t have a 50% win rate? How low could my win rate go and still have a positive expected value? I leave those as an exercise to the reader.

Discrete Math & Democracy, Weeks 3-4

I totally purposefully combined these two weeks because they were short due to holidays, and not because I forgot about week 3. Yep.

First was our first quiz on what we covered in the first 7 days. (My quizzes are always slightly lagging, in all of my classes.) It was…longer than I anticipated. I think my usual metric for how long students need for work doesn’t apply to this class, because it’s so new to them. It was also testing some spreadsheet commands they needed to learn, so I made it an online quiz. I did it by sharing it through Google Classroom, highlighting cells they needed to fill in, and having them turn off their Wi-Fi once they opened the quiz. See below:

https://docs.google.com/spreadsheets/d/1qyLIkmBhQqvS-Zk4VsEivnQuTDUsYn_-BPJbXpW5iFw/edit?usp=sharing

We started off my returning to some of the criteria we looked at for two-candidate systems, now applied to the multi-candidate systems. We started filling out the chart in the first slide below.

We worked through counterexamples for why IRV/et al fails monotonicity, and why Borda and Survivor fail majority. I also discovered this website that both calculates winners and has a bunch of example elections, which has been very handy: https://rob-legrand.github.io/ranked-ballot-voting-calculator/

We also read this argument about why IRV failing monotonicity doesn’t matter: https://archive3.fairvote.org/reforms/instant-runoff-voting/irv-and-the-status-quo/how-instant-runoff-voting-compares-to-alternative-reforms/monotonicity-and-instant-runoff-voting/

Then we got to Condorcet, which took the bulk of our time. We learned how to make pairwise comparison matrices both by hand and using spreadsheets, which we see in the Pairwise Matrices tab of my example spreadsheet: https://docs.google.com/spreadsheets/d/11XoeRwnayoBUOO6psc2n4fGoKtOrDIDmWzkNwLCMKGE/edit?usp=sharing

This took the bulk of the time, and also I realized I needed to give more practice so we did more for the RCV election systems and the matrices.

The last thing we covered was using the pairwise matrix to find the Condorcet winner, loser, and also to resolve the results of a tournament/pairwise agenda election. We hinted at the idea that the person who sets the agenda/seeds the tournament has a lot of power to determine the winner, but that’s an idea we’ll dig into more this week.