Socks, revisited
Some time ago, I tackled a sock puzzle:
How do you solve this?
— Chris (@spottytable) February 2, 2021
Drawer with number of red socks and blue socks. Take out 2 socks.
P(Red, Red) = 1/2
P(Blue, Blue) = 1/12
How many socks are in the drawer?
I've seen the answer but don't know how to get it@EmporiumMaths @DrFrostMaths @PixiMaths @mathsjem
I’m happy with my original solutions, but wanted to explore another way of doing it. It’s going to end up in a generalised Pell’s equation, so we’re looking at another example of great depth coming from a relatively simple puzzle.
As a reminder, the equations we need to solve are:
Those can be easily rearranged into:
To make square-completing easier, I’m going to multiply the first two equations by 4:
… or …
I’m going to play with the first one:
And that’s a version of Pell’s equation – its solutions for
So, what are those? The doubly-odd convergents are
Can we do something similar with the other? Well, no. It doesn’t work for me, for reasons I don’t fully understand. However, if I eliminate
That’s a little trickier, but it does fall to the general method:
- find a solution
to the equation ( and works) - find the convergents
of , which solve the equation with “1” on the right - Then let
and be such that - Then
and satisfy the original equation.
What’s the continued fraction of ?
Well,
But no, no, we want 1 on the top!
… and we can replace that
So, what are the convergents to
They’re
Those lead to possible
So,
I’m not saying this is how you should approach the puzzle. I’m saying that the Pell’s equation is really neat, continued fractions are really neat, and combining them together to solve an already nice puzzle is about as tidy as I’m likely to find anywhere today.