0

So I know that I can solve a questions like "$x+y+z = 100$, how many triples can you make?" using stars and bars. However, how do I attempt to solve these when there are upper bounds on the values of $x$, $y$, or $z$. For instance, say this is the question:

$$x+y+z = 5 \\ x\leq4,\ y\leq5,\ z\leq3$$

How many ordered triples can I make?

StubbornAtom
  • 17,052
  • 1
    Have you used generating functions before? – saulspatz May 29 '20 at 19:51
  • Yes, I think so. – Eric Aldrin May 29 '20 at 19:54
  • 1
    Then it's the coefficient of $x^5$ in $$(1+x+\cdots+x^4)(1+x+\cdots+x^5)(1+x+\cdots+x^3)$$ – saulspatz May 29 '20 at 19:57
  • Are you familiar with the Principle of Exclusion and Inclusion? – WaterDrop May 29 '20 at 19:59
  • 1
    A small problem like this is also easily solved with an inclusion-exclusion argument: start with the unrestricted solutions and subtract the ones that violate the upper bounds. – Brian M. Scott May 29 '20 at 19:59
  • https://math.stackexchange.com/questions/3673834/determine-how-many-integer-solutions-to-the-inequality-x-1x-2-x-5-lt-110/3674138#3674138 is a more complicated example, that is most easily done with generating functions. – saulspatz May 29 '20 at 20:04
  • @StashuKozlowski or Brian. Could you please explain how to easily do this with Principle of Exclusion/Inclusion? I know the principle, it just seems like there are a lot of cases? – Eric Aldrin May 29 '20 at 20:09
  • @James: There can be a lot of cases, but there aren’t always. For instance, in the example in your question the constraint on $y$ can be ignored, since no solution can violate it, and it’s also impossible for a solution to violate both of the other two constraints, so it’s really just a matter of three calculations: $\binom72$ unrestricted solutions, $1$ solution violating the constraint on $x$, and $\binom32$ solutions violating the constraint on $z$, i.e., essentially the non-negative solutions to $x+y+z=1$. – Brian M. Scott May 29 '20 at 20:34
  • @james: Here is a slightly less trivial example, and here is a general result embedded in the solution to another problem. – Brian M. Scott May 29 '20 at 20:40

0 Answers0