To find the probability that Harvey picks a valid order for his socks and boots, we want to count the number of valid orders for his socks and boots, and then divide that by the total number of ways Harvey might order his socks and boots.

Let’s start with the total number of orderings, since that’s the simpler part of this puzzle. Harvey has 16 pieces of footwear to choose from (8 socks plus 8 boots), so he has 16 choices for the first piece of footwear he puts on; after that, he has 15 choices for his second piece of footwear, and then 14 choices for his third, and so on, for a total of

ways. (If you’ve read about factorials, this logic will look familiar to you.)

Now here’s where things get really interesting: we want to count the number of valid orderings. To do this, we ask ourselves a question: How do we construct a valid ordering?

One way is to fill in the socks and boots sequentially. Pick a sock to be first; then we can pick either the corresponding boot or another sock; then, if we have socked-and-not-booted feet left, we can pick corresponding boots or introduce another sock; and so on, never picking a boot for which we haven’t yet picked the corresponding sock. But all these dependencies between pieces of footwear make it hard to turn this into math.

Another way to construct a valid ordering is to make 16 empty bins:

__ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __

And then drop each sock-boot pair into a pair of empty bins, one pair at a time. Here’s the key: whenever we pick a pair of empty bins to put our sock-boot pair in, *we know what order the sock and boot must go in*. Specifically, once we pick a pair of bins, we automatically put the sock in the leftmost of the two bins. That way, we know every sock comes before its corresponding boot, just based on the way we’ve constructed our orderings.

As an example, suppose we want to place and , and we decide the empty bins we’ll use are the 3^{rd} and 8^{th}; since has to go before , we end up with:

__ __ __ __ __ __ __ __ __ __ __ __ __ __

Now we want to place and , and we decide the empty bins we’ll use are the 14^{th} and 16^{th}. This gives us:

__ __ __ __ __ __ __ __ __ __ __ __

And so on. Eventually, we use the last of the empty bins with the last sock-boot pair ( and ), and we’re done.

The nice thing about this approach is that we get rid of the complicated if-then situations from our first strategy. At every step, we just need to pick 2 bins out of however many bins remain. How do we say this in math?

When we pick 2 bins for the pair, we have all 16 bins empty, so we have ways to pick our first pair of bins. (If you’re not familiar with this notation, check out the page on choosing.) Then when we pick 2 bins for the pair, we have 14 empty bins left to choose from (we don’t know which ones, but all we need to know is that there are 14 of them), so that makes ways. Then there are 12 bins left for the pair, so there are ways to pick the third pair. And so on: the total number of valid orderings is

To simplify this, we rewrite it as

(Think back to the definition of choosing to convince yourself that this works!)

Our expression, then, just simplifies down to

valid ways for Harvey to put on his socks and boots.

Whew. Time to put it all together: the probably that Harvey picks a valid ordering by random chance is

That’s a pretty slim chance! Harvey will probably need to use his spider-brain and fix some sock-boot mistakes.