Improvised Question: Combination of selection of pens

This is a improvised version of the question here.

Supposing there are four brands of pens, W, X, Y, Z. You want to choose $10$ pens made up of any combination of the brands, but limited to a maximum of $5$ pens from each brand. How many possible combinations are there? Assume it would be acceptable not to choose a pen from any one or more brands, and that pens from any one brand are indistinguishable from each other.

Solutions Collecting From Web of "Improvised Question: Combination of selection of pens"

In the link you gave, it was established that using stars and bars, unrestricted ways of selecting the pens is ${13\choose3}$

Now to take care of the restriction, pre-select 6 pens from any one type (which will make the selection inappropriate) and subtract, thus

$${13\choose3} – {4\choose1}{7\choose3}$$

The answer should be the number of cells in the octahedral intersection of the hyperplane $w+x+y+z = 10$ with the hypercube $0 \leq w, x, y, z \leq 5$, which is the $11$th tetrahedral number, less four times the $5$th tetrahedral number, or $286-4\cdot35 = 146$.

ETA: To be a bit less cryptic, let us proceed by analogy. Suppose there are only two brands of pens. The ways that we can buy ten pens with no more than five of any brand is the intersection of the line $x+y = 10$ with the square $0 \leq x, y \leq 5$. This is just the single cell $(5, 5)$, so perhaps this is not a very illuminating example.

Let us thus proceed to three brands. Now our solution is the intersection of the plane $x+y+z = 10$ with the cube $0 \leq x, y, z \leq 5$. In fact, we only need the simplex $x+y+z = 10$ restricted to the non-negative octant; this is a triangle (equilateral). However, this simplex is “clipped” by the constraint imposed by the cube; this clipping removes three subtriangles from each of the corners of the simplex, so the answer is the $11$th triangular number, less three times the $5$th triangular number, or $66-3\cdot15 = 21$.

Observe that we could, by analogy, have solved the two-brand version by subtracting twice the $5$th “linear” number from the $11$th “linear number,” or $11-2\cdot5 = 1$. So this turned out to be a kind of illuminating example, after all (in retrospect).

You’re ahead of me by now, I’m sure; the solution for the four-brand version is the intersection of the simplex $w+x+y+z = 10$ (restricted to non-negative $w, x, y, z$) with the hypercube $0 \leq w, x, y, z \leq 10$. This simplex is a tetrahedron, but it is again clipped by the constraint imposed by the hypercube. This clipping removes four subtetrahedra from the corners of the simplex, so the answer is the $11$th tetrahedral number, less four times the $5$th tetrahedral number, as explained above.

I note, by way of epilogue, that the foregoing is merely a visualization of the analytical solution provided by true blue anil. The answers are fundamentally identical.