Our problem from 2/16/15 was
[…] you find yourself in the squat rack. Great, squat is one of your best exercises. In fact, in order to get a good workout, you need to add 5 plates to each side! Of course, you know from experience that you can’t just load each of the plates arbitrarily. In particular, if one side has ≥3 plates more than the other side, the bar will become too imbalanced and the weight will come crashing down (ignore the physics for now and just assume that this is true). How many unique ways are there to add plates to the bar so that each side has 5 plates and one side never has ≥3 plates more than the other side?
How about if we need to load up N plates? And what if the balance of bar in the rack is modified so that the bar will tip if one side as ≥m more plates than the other side?
Solution
Some of you may have recognized that this problem can be modeled by a Dyck path with some additional constraints applied.
![Chapter 21: Dyck Paths, Peaks, and Valleys - Fibonacci and Catalan Numbers: An Introduction [Book] Chapter 21: Dyck Paths, Peaks, and Valleys - Fibonacci and Catalan Numbers: An Introduction [Book]](https://substackcdn.com/image/fetch/$s_!POvB!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0b09a73f-9c42-4aaa-961d-7c93cd2ba864_623x386.gif)
Typically Dyck path can’t go below the x axis but that won’t bu sufficient for our situation. We need to apply the “no more that two additional plates on a particular side” constraint. But there’s two ways we can apply this and our choice depends on what we consider to be a unique barbell configuration. If choose not to distinguish between the right and left side (i.e. 1 plate on the left and 0 on the right is the same as 0 on the left and 1 on the right), then we can model this problem as a Dyck path with the constraints that the path never goes below the x-axis and never goes above the line y=2. If we do distinguish between the left and right side, then we can model this problem as a Dyck path with the constraints that the path never goes below y=-2 and never goes above the line y=2. I've chosen not to distinguish between the side.
At first glance, this problem seems like it could benefit from the reflection principal, which is a standard technique for handing lattice paths with constraints. However, we will note that we are dealing with two different constraints here which complicates this approach significantly. If we wanted to take this approach, we could attempt to model the problem by counting all the possible paths from (0,0) to (10,0) or (2N,0) and then subtracting the paths that violate the constraints. However, having the two constraints means we would need to account for the paths that violate both constraints, which I couldn't figure out how to do.
Instead of using the reflection principal, we can write a recursive relationship (think of the Dyck paths sort of like a Markov chain). The chain can be in three possible states: 0, 1, and 2. The state represents the difference between the number of plates on the left and right side. The chain starts in state 0 and ends in state 0 after 10 steps. With this, we just need to determine the relationship between the different states
We first note that if we are in state 0, we can only move to state 1. If we are in state 2, we can only move to state 1. If we are in state 1, we can move to state 0 or state 2. This gives us the following relationships:
Our initial conditions are:
We want to find s0(10). So let's try iterating this out and see if a pattern emerges
The following pattern seems to be emerging.
This can be verified with induction, which I will omit here but the details can be found here.
Substituting in t=2N=10 we get 16! And that’s our answer!
If anyone counted the situation where distinguish between the two sides, please comment with your solution. Also, if you’re interested in the generalized solution to the number of Dyck paths whose height is less than or equal to k, check out this post.
As always, please comment with any thoughts or feedback you had on this problem or if you approached it differently. Thanks for reading!
I worked for a while trying to solve the general case of N total plates where one side couldn't have m or more plates than the other. I got really close, I think, but I couldn't figure out one little point.
My method was to count the number of ways to fail at this (i.e., get to m more plates on one side than the other), and then subtract this from the total number of ways to put the plates on. Let R and L refer to adding plates on the right and left. We'll focus on failing on the right. I organized my counting by the number of R's required to fail.
Situation 1: We fail if we put m R plates in a row, with no L's:
To count the number of ways this can happen, there's only one way to put on the m R plates, and then we have to count the number of ways to order the remaining N-m plates, in which N/2 of them are Ls.
Number of ways = (N-m) choose (N/2)
Situation 2: m+1 R plates and 1 L plate:
Naively, we could just count how to order these m+2 plates, combined with ordering the remaining plates. But this would overcount the orderings from the previous situation: where we have m R's in a row at the beginning. So here, we want to focus only on orderings of the m+1 R's and 1 L such that the 1 L is placed in the first m slots. This way, we're only counting new orderings that fail. So our ordering will be:
- In the first m slots, 1 L and the rest R's. Number of ways = m
- In the next two slots, the remaining 2 R's (since we're focusing here on m+1 R's).
- In the remaining N-(m+2) slots, the remaining plates, which include (N/2)-1 L's.
Total number of ways = m * [(N-(m+2)) choose (N/2 - 1)]
Situation 3: We do m+2 R's and 2 L's, using the same method. But it gets trickier here. When we count how many ways to place the 2 L's among these first m+4 slots, we need to make sure not to overcount the situations above. We could think of it this way. We need the 2 L's in the first m+2 slots (which will prevent us from overcounting situation 2), AND at least 1 L in the first m slots (to prevent overcounting situation 1). And this is where I got hung up. I figured out a way to count this, but I couldn't turn it into something that was easily expressible for any N and m.
My method was the following. The first L could go in any of the first m slots, and the next L could go anywhere after this, up to m+2. To count this, let x1 be the position of the first L, and x2 be the position of the second L:
sum from x1 = 1 to m of (sum from x2 = x1+1 to m+2 of 1)
Notice that we're just counting 1, over and over, each time placing the L's in different places.
And then, to finish situation 3, we finish like we did with situation 2, by placing the remaining N-(m+4) plates, which include (N/2)-2 L's, counted as [N-(m+4) choose (N/2)-2].
This works for the subsequent situations too, but I can't write it succinctly. For example, situation 4 (with m+3 R's and 3 L's) would have the nested summation of:
sum from x1 = 1 to m of (sum from x2 = x1+1 to m+2 of (sum from x3 = x2+1 to m+4 of 1))
And then finish with [N-(m+6) choose (N/2)-3].