Parking cars and vans into car-, van, and car/van- parking spots

209 Views Asked by At

The problem is simply:

You have C cars and V vans, and parking spots of which X allows cars, Y allow vans, and Z allow either. How many ways could you park these vehicles? (Cars and vans are indistinguishable amongst themselves, parking spots are numbered.)

Is there a directly computable solution to this question (i.e. not involving sums or recursion)?


Work so far:

I have started by finding the correct count.

$\sum_{i=0}^X {X \choose i} {Z \choose X-i} {Y+Z-X+i \choose V}$

This puts some (i) cars in the car spots and the remainder in shared spots, for varying amounts of i and adds up for each choice of i. When i is specified, this is a directly computable combinatorics problem.

2

There are 2 best solutions below

2
On

Assuming X intersection with Y is Z. X+Y-Z is the total number of potential spaces. If labellings of the parking spaces can be rearranged between types of vehicle allowed then (X+Y-Z)nCr(X-Z) is the potential car only spot numberings similarly for (Y-Z) but slightly less spaces to choose from so is (X+Y-Z-(X-Z))C(Y-Z) or (Y)nCr(Y-Z) and the remainder are forced to be in Z. So multiplying together our parking preset types have (X+Y-Z)nCr(X-Z) * (Y)nCr(Y-Z) choices. In X-Z each spot will develop 2 choices either a car or be empty so in total 2^(X-Z). Similarly for Y-Z spaces having 2^(Y-Z) potential van arrangements and in Z we have 3 options so is 3^Z. Since all intersections between the sets of spaces we have handled are empty sets the product of these is the number of potential car park states so together is,

(X+Y-Z)nCr(X-Z) * (Y)nCr(Y-Z) * 2^(X+Y-2*Z) * 3^Z

Unless Z was an independent category from X and Y in which case replace X-Z with X, Y-Z for Y, X+Y-Z for X+Y+Z and respective totals in the above.

2
On

Expand the polynomial $(1+s)^X(1+t)^Y(1+s+t)^Z.$ Then look for the coefficient of $s^Ct^V$, which will give the number of ways to park $C$ cars and $V$ vans in the given devoted/either-or parking spaces. Admittedly this is not really a "closed form" solution, unless one knows how to extract the coefficient from the expansion.

I tried it for 2 each of car only, van only, and "either". For example there was $14$ as the coefficient of $st$ which would mean $14$ ways to park one car and one van in these six slots. To check manually, the car can go in a "car only" in two ways, after which there remain four positions for the van [so far 2*4=8], and on the other hand the car can go in one of the "either" spaces in two ways, this time leaving only three spots for the van, so this gives another 2*3=6. Altogether 8+6=14 which checks with the polynomial coefficient.

I'd be interested if the OP (or anyone) could work out some other cases to see if this polynomial expansion method is giving the right results, but it looks OK to me at this point. Again it would be of interest if a "closed form" could be obtained.