# How to indicate a condition in sum?

I want to sum over all the possible combinations of two numbers that give the same result under a certain formula. Specifically, in this case, sum over all the possible combinations of non-negative integers $$i,j\in\mathbb{N}_0$$ that together with some constant natural number $$n\in\mathbb{N}$$ give the same value for the formula $$k=n\left(i+j\right)+j$$.

I tried the following notation:

$$\sum_{k=n\left(i+j\right)+j}2^k$$ But, it seems somewhat ambiguous and unclear, it's not explicit how many and what variables the sum goes over and which are fixed. How do I indicate exactly and clearly my intentions? Maybe something like:

$${\sum_{i=0}^{\infty}\sum_{j=0}^{\infty}}_{s.t\ n\left(i+j\right)+j=k}2^k$$

• I sometimes write $\sum_{k \in I} \text{blah}$ and then describe the index set $I$ explicitly. – copper.hat Jan 30 at 19:45
• Your link just points to this same question. – RobPratt Jan 30 at 21:31
• @RobPratt, sorry, my bad. This is related to my question math.stackexchange.com/questions/3526286/… – SIMEL Jan 30 at 21:35
• Is $k$ a fix number or not? If it is, then $2^k$ is also a constant and it could be taken out of the summation. If it is not, why is not your sum infinite? – J.-E. Pin Jan 31 at 8:17
• @J.-E.Pin, yes, it's a fixed number and it can be taken out of the sum and put $1$ inside. – SIMEL Jan 31 at 8:26

" I want to sum (what ?) over all the possible combinations of two numbers .."

the what shall be a function $$f \, : \, \mathbb {Z}^2 \to \mathbb X$$ so you write $$S(C) = \sum\limits_{(i,j)\, \in \,C} {f(i,j)}$$ where $$C$$ is a domain in the plane $$i,j$$ defined by certain conditions.

In the example you give, $$C = \left\{ {(i,j):\left\{ \matrix{ 0 \le i,j \hfill \cr n\left( {i + j} \right) + j = k \hfill \cr} \right.} \right\}$$ where $$n$$ and $$k$$ are considered as given constants (or parameters), and do not vary while taking the sum.

So by writing $$S(C) = \sum\limits_{(i,j)\, \in \,C} {2^{\,k} }$$ you are actually telling $$S(C) = \sum\limits_{(i,j)\, \in \,C} {2^{\,k} } = \sum\limits_{(i,j)\, \in \,C} {2^{\,k} \cdot 1} = 2^{\,k} \sum\limits_{(i,j)\,} {{\bf 1}_{\left\{ {(i,j)\, \in \,C} \right\}} } = 2^{\,k} \left| C \right|$$ i.e., that $$f(i,j)=1$$, so that when summed over $$C$$ i it is equivalent to summing the corresponding indicator function over the whole plane, and finally to give the size of $$C$$, which is the number of non-negative solutions to the diophantine equation $$n\left( {i + j} \right) + j = k$$.

Here's one option, using \substack: $$\sum_{\substack{i\ge 0,\ j\ge 0:\\n\left(i+j\right)+j=k}} 2^k$$

• The first option says something else entirely, the condition is nowhere to be found and gives a completely different answer (specifically $\infty$). The second one is still messy and not clear. – SIMEL Jan 30 at 20:42
• So $k$ is fixed? – RobPratt Jan 30 at 21:26
• Yes, I want to know the number of different combinations for a certain $k$ and $n$, for example, for $n=3$, for $k=1,2$ the number is $0$, for $k=4$ it's $1$, and for $k=12$ it's $2$ – SIMEL Jan 30 at 21:28
• OK, I updated my answer to remove the first option. – RobPratt Jan 30 at 21:30

Following your answer to my comment, I would suggest to write $$2^k \bigl|\bigl\{(i,j) \in {\Bbb N}^2 \mid ni + (n+1)j = k\bigr\}\bigr|$$