This week the #puzzle is: Can You Design a Quadrangular Logo? #area #average #ArithmeticSequence
Inspired by Delta Airlines, you and a graphic designer colleague are crafting a new logo for Fiddler Airlines. Your colleague starts with an equilateral triangle with a side length of 1 unit. Next, you pick a random point inside the triangle, giving you four points: the three corners of the triangle and this fourth point inside. There are several (simple) quadrilaterals that can be drawn whose four vertices are these four points. Your colleague picks one of these quadrilaterals at random, with each having an equal probability. This quadrilateral will be the new logo.
On average, what can you expect the area of the quadrilateral to be?
And for extra credit:
While picking random points inside the equilateral triangle with side length 1, you and your colleague notice that some points are “special.” When one of these special points is connected with the triangle’s three vertices, it creates three smaller triangles whose areas form an arithmetic sequence.
After further investigation, you realize these special points all belong to a locus, the total length of which is L. What is this length L?
Mumble, mumble, equilateral = all 3 sides have the same length. Mumble, mumble, simple = no crossings or holes. So I guess this means I always get my quadrilateral by replacing 1 side of the triangle with a trip to the new internal point. I’m not sure it’s possible to create a non simple polygon this way. Let me mess around with this a bit. (Including some messing around on Desmos.)
So each row here has the same internal point, and then each quadrilateral represents a choice of which side of the triangle to replace.
Method 1: I guess I’m ready for some monte carlo now. Using a fun method for finding an internal point randomly. I can use 2 sides of the triangle as vectors, and an internal point will be 1 point + some part of each vector, where the 2 parts / fractions have a sum of 1 or less.
Number of loops.... 5 * : 3162523
Target deviation........: 0.0001000
Deviation so far........:
................result 1: 0.0000757
======================================
Final result F, 1.......: 0.2886861
+/- 0.0000757
Method 2: Meanwhile I’ve figured out how to do this another way.
The area of the triangle is:
This area is also the sum of the areas of the smaller 3 triangles inside, using the internal point:
When I’m choosing a quadrilateral, I’m also choosing 2 of the small triangles. So the resulting area will be a sum of the corresponding areas. I’m choosing between these areas:
Just looking at the case with this particular random internal point, what is the average area:
Assuming a random process chose the same internal point 3 times and then chose each possible quadrilateral 1 time each, the average area for just these 3 choices would be about 0.2887. And it doesn’t matter where the internal point is, this always holds.
Result confirmed! Area is 0.2887.
And for extra credit:
Mumble, mumble, arithmetic sequence = the distance between 2 neighboring elements in the sequence is constant. So we’re talking about a sequence like this:
Method 1: While my monte carlo is looking at random quadrilaterals, I will also peak at the areas and save good internal points. Then I will print out those points and transfer them to Desmos, to see what we’re talking about.
I’ve already guessed the point in the middle of the triangle will be a part of the goodness, as all 3 areas would be the same, k = 0.
Oh! The good points are on 3 lines going through the middle. The horizontal line goes from x = – 1/3 to x = 1/3 and has length 2/3. The 3 lines combined have length 2.
Method 2: After this enormous hint, let’s see if this can be proven in another way.
The 3 corners of the triangle are at:
The middle of the triangle is at:
Looking at the horizontal line, assume some other x.
The formula for the area of the big triangle:
The area of a subtriangle is obtained by replacing a point with the internal point.
Let me just repeat that:
WLOG, let’s assume:
And we already know:
Then it becomes:
And move them around a little.
See, this would fit with the arithmetic sequence, if .
Recently I’ve been reading the rules for the Paranoia role playing game. I heard about it, oh, 35 years ago? And for reasons, I’ve been reminded of it lately. So, let’s study the rules!
Quite early in the rule book, there’s a solitaire adventure. Of course I want to play, and then create a flowchart for it. You know me, right?
This week the #puzzle is: Can You Gerrymander Like a Dummy? #probabilities #voting
Fiddler Nation has an upcoming election between its two major political parties: the Suns and the Moons. You are drawing a new electoral map, and you have been tasked with gerrymandering on behalf of your party, the Moons. Fortunately, you know exactly how every citizen will vote in the election.
Fiddler Nation has seven districts, each with an equal population. For simplicity, assume that the Moons win any district in which they receive at least half of the vote.
What is the smallest total fraction of Fiddler Nation’s population needed to vote Moon such that it’s possible for the Moons to win a majority of the seven districts?
And for extra credit:
In the next election cycle you’re back at it, gerrymandering on behalf of the Moon party once more. This time, you can draw a map that results in any set of probabilities P1, P2, P3, P4, P5, P6, and P7 that you’ll win each of the corresponding districts—subject to the constraint that the average of the probabilities is 1/2. In other words, P1 + P2 + P3 + P4 + P5 + P6 + P7 = 7/2.
The bosses of the Moon party want to go big. More specifically, they want to maximize the party’s chances of winning at least five of the seven districts. However, you are concerned that such a greedy attempt at gerrymandering may backfire, a phenomenon that has become known as dummymandering. When you draw a map that maximizes your chances of winning at least five districts, the probability the Moon party blows it and winds up losing most of the districts is LA.
Your personal preference is to simply maximize the party’s chances of winning at least four of the seven districts—a simple majority of them. When you draw a map that maximizes these chances, the probability the Moon party loses most of the districts is LB.
One of the basic ideas of gerrymandering is, that you don’t waste votes in the districts, you don’t plan to win. Let’s use this idea.
Chance of actually losing, when going for a 5 district win is LA, Same for a 4 district win, LB.
Assumption for strategy: In order to maximize the chances of a 5 district win, give each of districts 1-5 the maximum probability pA, and district 6-7 0.
This will be compared to going for a 4 district win.
Computing.
Result: 0.4181.
Just for the fun of it, I also wrote a program to simulate these 2 scenarios. Result confirmed.
And then I came back. Originally I had an idea, that spreading the voters over more districts might be better. I try it out in my program. And what do you know! This works for the 5 district case.
What happens when the voters are spread out?
Let’s say the voters are evenly distributed.
What are the chances 5 of the districts will be won?
And 6?
And all 7?
And all together?
This is a lower chance of losing, much better! (ETA: And then I forgot to count “a 4 districts win isn’t the intended win, but it’s still a win”.)
And my program says:
Go for 5 wins, 5 districts with p = 0.700, 2 districts with p = 0
Wins: 0.170090
Go for 5 wins, 6 districts with p = 0.583, 1 districts with p = 0
Wins: 0.208540
Go for 5 wins, 7 districts with p = 0.500, 0 districts with p = 0
Wins: 0.227930
Go for 4 wins, 4 districts with p = 0.875, 3 districts with p = 0
Wins: 0.584810
Go for 4 wins, 5 districts with p = 0.700, 2 districts with p = 0
Wins: 0.529170
Go for 4 wins, 6 districts with p = 0.583, 1 districts with p = 0
Wins: 0.510270
Go for 4 wins, 7 districts with p = 0.500, 0 districts with p = 0
Wins: 0.499410
Difference: 0.356880
So, for 5 districts the best strategy is to spread the voters evenly. (And it’s still not a very good strategy.) For 4 districts concentrate the votes in 4 districts. (Gives 58% chance of winning instead of the fair and just 50%.) And the difference is: 0.3596.
This week the #puzzle is: How Fast Can You Surf? #trigonometry #maximum #differentiation
A surfer is riding along a crest of a sinusoidal wave given by the function y = 2·sin(x−t), where y is the height above sea level in meters, x is horizontal position in meters, and t is time in seconds. Based on this, the surfer knows that her speed—and the speed of the wave—is 1 meter per second.
But hold on—it appears that another wave is approaching from the opposite direction. This wave has half the amplitude but twice the speed: y = sin(x+2t).
The two waves, the forward and the backward, ”interfere,” meaning they combine. In other words, the height of the water at position x and time t is given by y = 2·sin(x−t) + sin(x+2t). Nevertheless, the surfer stays atop a crest of the combined wave.
As the wave moves along, what are the surfer’s slowest and fastest [horizontal] speeds, in meters per second?
And for extra credit:
The surfer rides the crest of the combined wave, y = 2·sin(x−t) + sin(x+2t), for a very long time.
What is her average [horizontal] speed, in meters per second?
Method 1: Code it up in Desmos, just to see what’s happening. Huh! The combined wave (purple) has a funny start and stop pattern, where horizontal movement seems to stop entirely, while the wave grows in size.
Method 2: Math. Everybody seems to agree, when = speed of wave (or in out case, speed of crest), = wave length and = wave frequency:
This can’t quite fit our situation, because the speed obviously varies, while the wave length and the wave frequency stay constant.
Let’s just look at a single moment.
When does this function have a max or min?
And this max/min is:
Yeah, actually a max. So at time 0, the crest (or one crest) is at .
Let’s try this with a more general time instead.
Chain rule:
Looking for a max/min:
Identities:
I try out this function in Desmos. It actually follows the minimum, but the math is the same.
So far so good! A visual inspection shows these values for the speed of the crest.
Doing a test where I look at how much the crest moves over a short amount of time, , 0 is confirmed. And the max value seems to be 4!
Method 3: Write a program. This simply supplies Desmos with data to show the path of the crest and a curve for the speed of the crest. As it uses the same math, it spits out the same results.
Result: .
And for extra credit:
This is suspiciously easy.
Average speed = total distance / total time. From reading Desmos again, measuring between 2 maxima:
Method 2: Every time fish 1 goes by at speed 1, fish 2 goes by at speed 2 twice. The average of 1, 2 and 2 is 5/3 or 1.67.
Result: 1.67.
And for extra credit:
Method 1:
Result 1................: 1.2533140 Result 1................: 1.2533792 Result 1................: 1.2532510 Result 1................: 1.2533647 Result 1................: 1.2532415 ====================================== Number of loops.... 5 * : 100980391 Target deviation........: 0.0001000 Deviation so far........: ................result 1: 0.0000632 ====================================== Final result 1..........: 1.2533101 +/- 0.0000632
I ask every episode: Why do I love trek? Most episodes demonstrate some of the reasons.
Number / Name
Why I liked it
401 / 4:1 “Kobayashi Maru”
Trying to save everybody. Bad thing? Accept the non-perfect solution?
402 / 4:2 “Anomaly”
Visual of zero gravity. Remember to say “Well done”. Admit your trauma.
403 / 4:3 “Choose to Live”
A “soul” getting a new body.
404 / 4:4 “All Is Possible”
Therapy. Leader + teacher. Topic: Working together. Negotiation, mediation. When a career change is the right thing.
405 / 4:5 “The Examples”
In mortal danger, everybody should be rescued. The therapist might need therapy too. Survivor’s guilt. The right to choose suicide.
406 / 4:6 “Stormy Weather”
Helping a new AI deal with feelings.
407 / 4:7 “…But to Connect”
Trying to figure out the exact nature of an AI. Trust. Communication.
408 / 4:8 “All In”
A poker game.
409 / 4:9 “Rubicon”
Handling that personal ties to “the enemy” = disqualification. “Resting” the mind before a difficult mission.
410 / 4:10 “The Galactic Barrier”
Discussing parenting with your child.
411 / 4:11 “Rosetta”
Decryption! Communication! Balanced response, not just criticism. A headler in need of healing.
412 / 4:12 “Species Ten-C”
Learning a new language. Math!
413 / 4:13 “Coming Home”
Reasons matter.
It makes sense to me, that a species might not look like a human, and that a translator might be needed. Unfortunately this broke “show, don’t tell” big time, and every aspect of the threat felt very abstract. (And “the enemy blew up my planet” is a cliche by now, yes?)
This week the #puzzle is: Can You Frame the Triangle? #trigonometry #triangle #circumscribe #montecarlo #coding #minimum #average
Congratulations—you just won your school’s tabletop football championship! You flicked your lucky paper football to victory countless times, and would now like to frame it for posterity.
The football is an equilateral triangle with a side length of 1 inch. What is the side length of the smallest square frame that will contain the football?
And for extra credit:
To add a little excitement to the framing process, your new plan is to spin the triangular football by a random angle, and then frame it with a square that is not rotated. That is, the square consists of two perfectly horizontal sides and two perfectly vertical sides.
On average, what can you expect the side length of the smallest resulting square frame to be?
Checking… Yeah, this is a triangle, where all 3 sides have the same length.
My sense is, that this square will have side length 1 inch. But let me just check. Oh, that’s not right. Messing around with Desmos gives me something like 0.966. This is achieved, when 1 side of the triangle has exactly a 45 deg angle on the horizontal and vertical axes. This was actually fun. To go from an angle to a triangle, to a circumscribed rectangle, to a circumscribed square. Visit Desmos to see an animation!
So that’s method 1. Method 2 is monte carlo (where it’s kind of overkill to have a variance check, I’m looking for a minimum). Result confirmed.
0.966 inches.
And for extra credit:
The easiest is to let the monte carlo register a lot of squares and take the average. (It was already registering a lot of them and taking the minimum.)
====================================== Number of loops.... 5 * : 32010 Target deviation........: 0.0001000 Deviation so far........: ................result 1: 0.0000029 ................result 2: 0.0000886 ====================================== Final result 1..........: 0.9659279 +/- 0.0000029 Final result 2..........: 0.9886172 +/- 0.0000886
0.989 inches. This makes sense, as being between the minimum and 1.
This week the #puzzle is: Can You Swap the Cups? #average #ExpectedValue #montecarlo #coding
My friend has three cups, labeled “A,” “B,” and “C” in a row. She randomly picks two different cups and swaps their positions. Then she does this again and again, picking a random pair each time, until all three cups are back in their original order. For example, here is one such sequence of swaps:
– A, B, C (original) – C, B, A (first and third were swapped) – B, C, A (first and second were swapped) – B, A, C (second and third were swapped) – A, B, C (first and second were swapped)
In this example, the cups returned to their original order after four swaps.
On average, how many swaps would you expect until the cups return to their original order?
And for extra credit:
In total, there are six possible orders of the cups. Without any swaps, one of those orders (A, B, C) has already been achieved.
On average, how many swaps would you expect until the remaining five orders (and thus, all six) are also achieved?
I didn’t read the instructions correctly. I thought the 1st quiz had 4 questions, not 3.
I did notice other answers using strategies involving “if the 1st correct answer was A, there’s a slightly better chance the 3rd answer is A”, but I didn’t understand why this could be until the official answer was out.
Method 1: Ye olde monte carlo. This time I play around with variance and deviation calculations, so that the program will keep going, until I get the number of decimals, I want.
====================================== Number of loops.... 3 * : 102970102 Target deviation........: 0.0010000 Deviations so far, res 1: 0.0003204 ====================================== Final result 1..........: 5.9999515 +/- 0.0003204
Result: 6.00. Maybe simply 6?
Method 2: Look closely at what’s going on. This is a diagram of all states and all changes between states.
And that’s a little… Wait, that can actually be shown in a better way.
“abc” is the beginning state. Each line represents 1 swap. How many steps does it take to get from a state back to the beginning state?
If we’re already in the beginning state, 0 steps.
Here I’ve called “a state on the left that isn’t the beginning state” “left”. 1/3 of the time, take 1 step and get back to the beginning state. 2/3 of the time, take 1 step and reach a left state. And actually, let’s call all the states on the right “right”.
In a left state, I have to take 1 step to get to a right state. Let’s solve this.
There’s always a 1st step, away from the beginning state. And then it will take 5 further steps/swaps to get back. That’s 6. Result confirmed.
And for extra credit:
Same program, I just use the data slightly differently.
====================================== Number of loops.........: 102970102 Target deviation........: 0.0010000 Deviations so far, res 2: 0.0005949 ====================================== Final result 2..........: 12.2144230 +/- 0.0005949
Result: 12.21 – 12.22.
Method 2. Let me see. First some new notation.
How many steps left on average, when there’s x already visited states on “my” side (WLOG the left side) of the diagram and y on the other?
If both sides are already full, there are 0 steps left.
This is the same situation as the fiddler. Being in one of the lower states on the left side and aiming for (WLOG) the top state of the left.
This was the intermediate situation above, taking 1 step away from the coveted state.
Let’s just summarize.
0
5
n/a
6
n/a
n/a
n/a
n/a
n/a
Some of these situations are impossible. Typically, I can’t have visited 2-3 states on one side of the diagram and 0 on the other. Also, x can’t be 0, because I am in a state, that is therefore visited.
Right!
Let’s solve this.
And:
And:
Let’s summarize again.
0
5
8
n/a
6
8
n/a
9
n/a
n/a
n/a
n/a
Solving.
And:
And summarizing:
0
5
8
n/a
6
8
n/a
9
n/a
n/a
n/a
n/a
Almost there!
Solving:
0
5
8
n/a
6
8
n/a
9
n/a
n/a
n/a
n/a
Whew! Only one more.
Solving:
This was the number, we were looking for. And it confirms the previous result.