$2x_1 + 2x_2 + \cdots + 2x_6 + x_7 = N$

182 Views Asked by At

How do I find the number of integral solutions to the equation -

$$2x_1 + 2x_2 + \cdots + 2x_6 + x_7 = N$$

$$x_1,x_2,\ldots,x_7 \ge 1$$

I just thought that I should reduce this a bit more, so I replace $x_i$ with $(y_i+1)$, so we have:

$$y_1 + y_2 + \cdots + y_6 = \tfrac{1}{2}(N + 13 - y_7)$$

$$y_1,y_2,\ldots,y_7 \ge 0$$

I will be solving this as a programming problem by looping over $y_7$ from $[0, N+13]$. How do I find the number of solutions to this equation in each looping step?

3

There are 3 best solutions below

0
On BEST ANSWER

Note $x_7$ must be either odd or even depending on whether $N$ is odd or even. So if you just subtract $1$ from $N$ if necessary and assume $x_7 = 2y$ where $y \geq 0$, then you get that the number of solutions is the same as the number of solutions to $x_1 + \ldots + x_7 = N/2$ where $x_i \geq 1$ for $1 \leq i \leq 6$ and $x_7 \geq 0$. This can be solved with a single binomial coefficient (no big summation required), see the "stars and bars" construction for how to do it, basically you just add 1 to the target sum $N/2$ for each variable that is $\geq 0$ instead of $\geq 1$, and then if you have target sum $M$ and $k$ variables all $\geq 1$ then the number of solutions is ${M-1} \choose {k-1}$.

0
On

$$x_{7}=2k+1 , x_{7}=2k \\ partition - by - x_{7}\\2x_{1}+2x_{2}+2x_{3}+...+x_{7}=N\\(1) x_{7}=2k+1 , 2x_{1}+2x_{2}+2x_{3}+...+2k+1=N\\2x_{1}+2x_{2}+2x_{3}+...+2K=N-1\\if -(N-1) - was- even -divide - by -2\\x_{1}+x_{2}+x_{3}+...+K=\frac{N-1}{2}\\\binom{\frac{N-1}{2}-1}{7-1}\\ \\(2) x_{7}=2k , 2x_{1}+2x_{2}+2x_{3}+...+2k=N\\if\\N \\was\\even\\divide -by -2 \\x_{1}+x_{2}+x_{3}+...+K=\frac{N}{2}\\\binom{\frac{N}{2}-1}{7-1} $$

0
On

$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$ With $\ds{0 < a < 1}$:

\begin{align} &\color{#66f}{\large\sum_{x_{1} = 0}^{\infty}\ldots\sum_{x_{7} = 0}^{\infty} \delta_{2x_{1} + \cdots + 2x_{6} + x_{7},N}} =\sum_{x_{1} = 0}^{\infty}\ldots\sum_{x_{7} = 0}^{\infty} \oint_{\verts{z}\ =\ a} {1 \over z^{-2x_{1}\ -\ \cdots\ -\ 2x_{6}\ -\ x_{7}\ +\ N\ +\ 1}} \,{\dd z \over 2\pi\ic} \\[3mm]&=\oint_{\verts{z}\ =\ a}{1 \over z^{N + 1}} \pars{\sum_{x = 0}^{\infty}z^{2x}}^{6}\sum_{y = 0}^{\infty}z^{y} \,{\dd z \over 2\pi\ic} =\oint_{\verts{z}\ =\ a}{1 \over z^{N + 1}}\,{1 \over \pars{1 - z^{2}}^{6}}\, {1 \over 1 - z}\,{\dd z \over 2\pi\ic} \\[3mm]&=\oint_{\verts{z}\ =\ a}{1 \over z^{N + 1}} \sum_{n = 0}^{\infty}{-6 \choose n}\pars{-1}^{n}z^{2n} \sum_{k = 0}^{\infty}z^{k}\,{\dd z \over 2\pi\ic} \\[3mm]&=\sum_{n = 0}^{\infty}\sum_{k = 0}^{\infty}\pars{-1}^{n} {6 + n - 1 \choose n}\pars{-1}^{n}\oint_{\verts{z}\ =\ a} {1 \over z^{N - 2n - k+ 1}}\,{\dd z \over 2\pi\ic} \\[3mm]&=\sum_{n = 0}^{\infty}\sum_{k = 0}^{\infty} {n + 5 \choose n}\delta_{k,N - 2n} =\left.\sum_{n = 0}^{\infty}{n + 5 \choose 5}\right\vert_{\,N\ -\ 2n\ \geq\ 0} =\sum_{n = 0}^{\floor{N/2}}{n + 5 \choose 5} \\[3mm]&=\sum_{n = 0}^{\floor{N/2}}\oint_{\verts{z}\ =\ 1} {\pars{1 + z}^{n + 5} \over z^{6}}\,{\dd z \over 2\pi\ic} =\oint_{\verts{z}\ =\ 1} {\pars{1 + z}^{5} \over z^{6}}\sum_{n = 0}^{\floor{N/2}}\pars{1 + z}^{n} \,{\dd z \over 2\pi\ic} \\[3mm]&=\oint_{\verts{z}\ =\ 1}{\pars{1 + z}^{5} \over z^{6}} {\pars{1 + z}^{\floor{N/2} + 1} - 1 \over \pars{1 + z} - 1}\,{\dd z \over 2\pi\ic} \\[3mm]&=\oint_{\verts{z}\ =\ 1}{\pars{1 + z}^{\floor{N/2} + 6} - 1 \over z^{7}} \,{\dd z \over 2\pi\ic} -\oint_{\verts{z}\ =\ 1}{\pars{1 + z}^{5} \over z^{7}} \,{\dd z \over 2\pi\ic} =\color{#00f}{\large{\floor{N/2} + 6 \choose 6}} - {5 \choose 6} \\[3mm]&=\color{#00f}{{\pars{\floor{N/2} + 6}\pars{\floor{N/2} + 5} \pars{\floor{N/2} + 4}\pars{\floor{N/2} + 3}\pars{\floor{N/2} + 2} \pars{\floor{N/2} + 1} \over 720}} \end{align}