# $(-1)^t$ in Difference Calculus

I'm interested in finding sums of the form

$\sum_i{\sum_j{(-1)^{N-i+j}} }$

where $N$ can be supposed to be constant.

I'm using the difference calculus to help solve these sums efficiently. I believe that I can simulate this sum as

$\sum_i{\sum_j{cos(\pi(N-i+j))}}$

I'm attempting to simulate the sum, since I'm having trouble directly evaluating it any other way. I'm wondering if there are alternatives that may be easier to work with. So my question is basically what's the best way to evaluate or simulate this? Alternatives are welcome, just as any good method is!

*EDIT*

This is actually part of a larger formula. In other words, I'm working with something like

$\sum_a{f_1 \sum_b{f_2\sum_i{\sum_j{cos(\pi(N-i+j))}}}}$

So I'm especially interested in something that I can easily work with inside of a larger difference equation.

-
Differential Calculus? – Mateen Ulhaq Mar 14 '11 at 23:21
Do you have upper bounds on your sums? – Mike Spivey Mar 14 '11 at 23:24
what are the bounds on $i,j$? if youre doing this in some program, just run a double loop over $i,j$. – yoyo Mar 14 '11 at 23:24
This is difference calculus, the discrete analogue to differential calculus. $N$ is the upper bound on $i$ and $j$, and I do have an upper bound on the entire sum - say it's $M$. In this regard, the entire formula will stay an integer between 0 and $M$. – Matt Groff Mar 14 '11 at 23:36

For the general sum, Mathematica gives the closed-form expression
$$\sum_{i=a}^b \sum_{j=c}^d (-1)^{N-i+j} = \frac{(-1)^{N-a-b}}{4} \left( (-1)^a + (-1)^b \right) \left( (-1)^c + (-1)^d \right).$$

Or, if you prefer a simpler answer but in piecewise form, write $$\sum_{i=a}^b \sum_{j=c}^d (-1)^{N-i+j} = (-1)^N \left(\sum_{i=a}^b (-1)^i\right) \left(\sum_{j=c}^d (-1)^j\right),$$ which is

• $0$, if $b-a$ is odd or $d-c$ is odd,
• $-1$, if $b-a$ and $d-c$ are even, and $N+a+c$ is odd,
• $1$, if $b-a$ and $d-c$ are even, and $N+a+c$ is even.

For the sum $\sum_{i=1}^N \sum_{j=1}^N (-1)^{N-i+j}$, which appears to be what you want, this reduces to

$$\sum_{i=1}^N \sum_{j=1}^N (-1)^{N-i+j} = \frac{-((-1)^N - 1)^2}{4},$$ or, more succinctly,

• $0$, if $N$ is even,
• $-1$, if $N$ is odd.
-