0

How many solutions are there to the equation:

$x_1 + x_2 + x_3 + x_4 + x_5 + x_6 + x_7 + x_8 = 4000$

where:

$x_1, \dots, x_8 \in \mathbb{Z}, \quad x_1, \dots, x_8 \geq 0$

with the following conditions:

$x_2 \geq 200, \quad 300 \leq x_3 \leq 499, \quad x_4 \leq 100, \quad x_5 \geq 150, \quad 500 \leq x_7 \leq 799$

$x_2 + x_4 + x_6 + x_8 = 600, \quad \text{and} \quad x_2 x_8 \neq 4 x_4$

To solve this problem I am going to use both Inclusion-Exclusion and Stars and Bars just like in this answer: https://math.stackexchange.com/a/4951440/1350326

I set:

  • $y_2 = x_2 - 200 \implies 0 \leq y_2.$
  • $y_3 = x_3 - 300 \implies 0 \leq y_3 \leq 199.$
  • $y_4 = x_4 - 0 \implies 0 \leq y_4 \leq 100.$
  • $y_5 = x_5 - 150 \implies 0 \leq y_5.$
  • $y_7 = x_7 - 500 \implies 0 \leq y_7 \leq 299.$
  • For $~i \in \{1,6,8\}, ~$ set $~y_i = x_i.~$

Then, the constraints to be satisfied are

  • Constraint 1: $~y_1 + \cdots + y_8 = 4000 - 200 - 300 - 150 - 500 = 2850.$
  • Constraint 2: $~y_2 + y_4 + y_6 + y_8 = 600 - 200 = 400.$
  • Constraint 3: $~(y_2+200)y_8 \neq 4y4.$
  • Constraint 1: after substituting constraint 2, becomes: $~y_1 + y_3 + y_5 + y_7 = 2850 - 400 = 2450.$

My approach will be: [Number of solutions to Constraint 2]×[Number of solutions to Constraint 1] - [Number of solutions to Constraint 3].


$\underline{\text{Number of solutions to Constraint 2}}$

The number of solutions is $S - S_1$ where:

$S$ = upper bound constraint is ignored.

$S_1$ = where $y_4 \geq 101$.

$$\binom{403}{3} - \binom{302}{3}.$$


$\underline{\text{Number of solutions to Constraint 1}}$

Let :

  • $~S~$ denote the set of all solutions to the above problem, where the upper bound constraints on $~y_3~$ and $~y_7~$ are ignored.
  • $~S_1~$ denote the subset of $~S~$ where $~y_3 \geq 200.$
  • $~S_2~$ denote the subset of $~S~$ where $~y_7 \geq 300.$

Then, the desired computation is

$$| ~S ~| - | ~S_1~| - | ~S_2 ~| + | ~S_1 \cap S_2 ~|.$$

The computation is

$$\binom{2453}{3} - \binom{2253}{3} - \binom{2153}{3} + \binom{1953}{3}.$$

Now I have no idea how to proceed because there are too many triplets that violate constraint 3.

zaxunobi
  • 217

1 Answers1

0

Addendum added to respond to the comment-question of zaxunobi.


I reviewed and agree with all of the math given in the OP's (i.e. original poster's) presentation.

First I should clarify a few things.

  • The overall approach should be to let

    • A = the enumeration of all solutions that satisfy constraints 1 and 2.
    • B = the enumeration of all solutions that satisfy constraints 1 and 2, but violate constraint 3.
    • Have the final computation be A - B.
  • Constraint 2 only involves variables $~y_2, y_4, y_6, y_8~$ while constraint 1 (after its adjustment) only involves variables $~y_1, y_3, y_5, y_7.~$ Since there is absolutely no shared variables between constraints 1 and 2, the enumeration of all solutions that satisfy both constraints 1 and 2 is represented by the product of the number of solutions that satisfy constraint 1, and the number of solutions that satisfy constraint 2.

Therefore, the OP has (in effect) accurately shown that

$$A = \left[ ~\binom{403}{3} - \binom{302}{3} ~\right] \\ \times \left[ ~\binom{2453}{3} - \binom{2253}{3} - \binom{2153}{3} + \binom{1953}{3}~\right]. \tag1 $$

Therefore, the problem reduces to computing $~B.$


How can constraint 3 be violated?
That is, how can $~(y_2 + 200) \times y_8 = 4y_4,~$
where

  • $0 \leq y_2.$

  • $0 \leq y_4 \leq 100.$

  • $0 \leq y_8.$

Note:
Thanks to zaxunobi for pointing out an analytical mistake that I made. I have revamped my answer to correct my mistake. The following table indicates all of the possible ordered triplets $~(y_2, y_4, y_8),~$ that satisfy the above bullet points, allow a solution to constraint 2, but still violate constraint 3.

\begin{array}{| r | r | r | l |} \hline y_2 & y_4 & y_8 & \text{Note} \\ \hline k & 0 & 0 & ~k \in \{0,1,2,\cdots,400\} \\ \hline 4k & 50 + k & 1 & ~k \in \{0,1,2,\cdots,50\} \\ \hline 0 & 100 & 2 & \\ \hline \end{array}

So, there are $~401 + 51 + 1 = 453~$ distinct ordered triples $~(y_2,y_4,y_8)~$ that satisfy the bullet points above and still violate constraint 3.

Note that each of the $~453~$ separate violations specifies specific values for each of $~y_2, ~y_4, ~$ and $~y_8.~$ Therefore, for each of these separate violations, there is exactly one solution to constraint 2. This solution is generated by setting

$$y_6 = 400 - y_2 - y_4 - y_8.$$

Further, since the (adjusted) version of constraint 1 is not affected by the values of any of $~y_2, ~y_4, ~y_8,~$ for each of the $~453~$ constraint 3 violations, the number of solutions to constraint 1 will remain fixed at

$$\left[ ~\binom{2453}{3} - \binom{2253}{3} - \binom{2153}{3} + \binom{1953}{3}~\right].$$

Therefore, the total number of ways of violating constraint 3 and still satisfying constraint 1 and constraint 2 is

$$B = 453 \times 1 \times \left[ ~\binom{2453}{3} - \binom{2253}{3} - \binom{2153}{3} + \binom{1953}{3}~\right].$$




$\underline{\text{Addendum}}$

Response to the comment-question of zaxunobi.

Could you explain how you were to obtain that table? Because only the triplet $~(y_2,y_4,y_8) = (0,100,2)~$ is clear to me.

The violation constraint is

$$y_8 \times (y_2 + 200) = 4y_4. \tag2 $$

Further, the only violations that are pertinent are those that still satisfy all of the following constraints:

  • $y_2 + y_4 + y_6 + y_8 = 400.$

  • $y_4 \leq 100.$

Therefore :

  • $4y_4~$ must be some element in $\{ ~0, ~4, ~8, ~\cdots, ~400 ~\}.$

  • $~y_8~$ can not be $~\geq 3,~$
    or else $~y_8 \times (y_2 + 200) > 400.$

  • If $~y_8 = 2,~$ the minimum value of $~y_8 \times (y_2 + 200)~$ is $~400,~$ which is only achieved when $~y_2 = 0.~$
    In this situation, the violation in (2) above only occurs when $~y_4 = 400.$

The remainder of this Addendum will explore the two separate situations of $~y_8 = 1~$ and $~y_8 = 0.$


Suppose that $~y_8 = 1.~$ Then, the violation in (2) above becomes
$1 \times (y_2 + 200) = 4y_4.~$

This implies that $~(y_2 + 200)~$ must be some element in $\{ ~0, ~4, ~8, ~\cdots, ~400 ~\}.$

Since the minimum value of $~(y_2 + 200)~$ is $~200,~$
this implies that $~(y_2 + 200)~$ must be some element in $\{ ~200, ~204, ~208, ~\cdots, ~400 ~\}.$

This implies that $~y_2~$ must be some element in $\{ ~0, ~4, ~8, ~\cdots, ~200 ~\}.$

Therefore, when $~y_8 = 1,~$ there are exactly $~51~$ possible values for $~y_2~$ that cause the violation in (2) above, but still allow

$$y_2 + y_4 + y_6 + y_8 = 400 ~: ~y_4 \leq 100.$$

Note that when $~y_8 = 1,~$ that each of the $~51~$ possible values of $~y_2~$ determines the variable $~y_4.~$

For example, when $~y_8 = 1~$ and the violation in (2) above occurs, then:

  • If $~y_2 = 0,~$ then $~y_4~$ must $~= 50.$

  • If $~y_2 = 4,~$ then $~y_4~$ must $~= 51.$

  • If $~y_2 = 8,~$ then $~y_4~$ must $~= 52.$

  • $\cdots$

  • If $~y_2 = 200,~$ then $~y_4~$ must $~= 100.$


Suppose that $~y_8 = 0.~$ Then, the violation in (2) above becomes
$0 \times (y_2 + 200) = 4y_4.~$

This forces $~4y_4~$ to equal $~0,~$ which forces $~y_4~$ to equal $~0.~$

Further, this allows $~y_2~$ to be any value that still permits

$$y_2 + y_4 + y_6 + y_8 = 400.$$

In this scenario, with $~y_8~$ fixed at $~0,~$ and $~y_4~$ also fixed at $~0,~$ the above equation becomes

$$y_2 + y_6 = 400.$$

So, in this scenario, $~y_2~$ can be any value in $~\{ ~0, ~1, ~2, ~\cdots, ~400 ~\}.~$

Therefore, there are $~401~$ possible values for $~y_2.$

Then, for each such value of $~y_2,~$ you have $~y_6~$ set to $~(400 - y_2).~$

user2661923
  • 42,303
  • 3
  • 21
  • 46
  • 1
    I will read it carefully and let you know! Let me tell you in the meantime that there is also the triplet $(y_2,y_4,y_8) = (0,50,1)$ that would violate the constraint. Correct? – zaxunobi Sep 15 '24 at 07:57
  • @zaxunobi +1 : Very good catch. I have edited my answer accordingly. – user2661923 Sep 15 '24 at 10:47
  • Could you explain how you were to obtain that table? Because only the triplet (0,100,2) is clear to me. – zaxunobi Oct 24 '24 at 09:11
  • @zaxunobi See the Addendum that I have just added to the end of my answer. – user2661923 Oct 24 '24 at 13:10
  • Thanks, I will read it carefully and let you know! In the meantime, is there a way to deriva a formula when determining $y_2, y_4, y_8$? Loop through all possible values within the constraints is not an efficient approach, I think. It's clear why $y_8$ has to be lower than 3, otherwise we would have a value higher than 400 and we know for a fact that the sum of $y_2,y_4,y_6,y_8$ is 400. But let's say I wasn't a human and I was a machine, how would I start approaching the problem? Starting from 0 and stop when $y_8$ is bigger than 400? Is it clear what I am asking? – zaxunobi Oct 24 '24 at 15:31
  • @zaxunobi The analysis in my Addendum is as elegant as I can make it. – user2661923 Oct 24 '24 at 16:41
  • It's not clear what, in the final solution of B, represents that 1 right after "453 X". What was the point of calculating $y_6$ for constraint 2 by replacing $y2,y4,y8$ with the violations triplets? We already calculated A. Edit: oh, that 1 is probably the unique solution we get from replacing the violations triplets into constraint 2. – zaxunobi Oct 24 '24 at 17:32
  • @zaxunobi There are $~453~$ ways of simultaneously satisfying constraint-2 and violating constraint-3, with respect to the variables $~y_2,y_4,y_6,y_8.$ To compute $~B~$ you must then multiply $~453~$ by the number of satisfying solutions that involve the variables $~y_1, y_3, y_5, y_7.~$ Beyond that, your last comment is somewhat incomprehensible. Please study my answer more carefully. Then, taking your specific remaining questions (if any), one at a time, please strive to have your comment-questions be very clear about what you are confused about. – user2661923 Oct 24 '24 at 17:40