I am working on a grid system (for graphic layout) in which the columns increase in size. I want each column increased with the same factor and i want the smallest column to be a variable so I have some control of the width of the columns. A colleague of my actually thought of a solution (see image). Divide the columns into virtual columns. Every column gets a virtual base column. And then for every next column an additional extra virtual columns. To figure out how many extra virtual columns there need to be, he also came up with a function. It works as far we can see, but we have no clue about why this is the case. Can anyone explain?
2 Answers
I'm going to use slightly different terminology since I found the word "virtual" confusing in this question. I will call the columns labeled $1,2,3,4,5$ along the top of the figure variable-width columns (because they are not all the same physical width) and I will call the "base" columns and "extra" columns constant-width columns (because they all have the same physical width). In your example there are $5$ variable-width columns divided into $15$ constant-width columns: $5$ base columns and $10$ extra columns.
In general, if there are $N$ variable-width columns composed from $f(N)$ constant-width columns, then the total number of constant-width columns is $ 1 + 2 + 3 + \cdots + N, $ that is, one constant-width column in the first variable-width column, two constant-width columns in the second variable-width column, and so forth, all added together.
There is a well known formula for this sum: $$ 1 + 2 + 3 + \cdots + N = \frac{N(N+1)}{2}. $$ There are multiple ways to show that this is true, and they have been done in several previous questions and answers on this site, so I will not repeat them. See the question linked here, the one linked here, this one, this one, or this one.
Now clearly to get $B$, the number of base columns in $N$ variable-width columns, the formula is $B = N$. The "extra" columns are constant-width columns that are not base columns, so to get the number of extra columns, we can just subtract the number of base columns from the total number of constant-width columns: \begin{align} (\text{# extra columns}) &= (\text{# constant-width columns}) - (\text{# base columns}) \\ &= (1 + 2 + 3 + \cdots + N) - B \\ &= \left(\frac{N(N+1)}{2}\right) - B \\ &= \left(\frac{B(B+1)}{2}\right) - B \\ &= \frac{B^2 + B}{2} - \frac{2B}{2} \\ &= \frac{B^2 + B - 2B}{2} \\ &= \frac{B^2 - B}{2} \\ &= B \cdot \left(\frac{B - 1}{2}\right) \end{align} and that's why your formula works.
By the way, I wrote "variable width columns" when you wrote simply "columns" and "constant-width columns" when you wrote "virtual columns" because to me, "virtual" implies that you take the actual things that were already implemented and rearrange them to look like something else. Your "base" and "extra" columns seem to be pre-existing things that you are building your "columns" from, so it seems the base columns and extra columns are the actual columns of the underlying system and it is the larger columns you are making from them that are virtual. But whether or not we agree on that bit of semantics, the formulas remain the same.
-
Thanks a lot! Everything makes sense now. And I was afraid the question was already asked, but I had no idea about the terminology or name of this phenomenon. – Ruudt Sep 16 '16 at 15:49
-
Word problems often have three parts: (1) finding a pure mathematical problem that is applicable to the word problem; (2) solving the pure math problem; (3) applying the solution of the pure math to the word problem. For your word problem, part (2) had been done plenty of times, but I think parts (1) and (3) were new and were worth answering. (When someone asks a question that really is the same as one that was answered already, we're supposed to say "duplicate of ..." and not answer. I don't think that applied here.) – David K Sep 16 '16 at 17:40
Add up the E's in the first and last part, and the second and second-to-last, and so on, and you'll always get the last B minus 1. (If B is odd, the E's in the middle part will be half that.) From there, you'll get the formula you came up with.

- 1,719