Number of permutations such that $a-b+c-d+e-f+g-h=0$ All possible permutations $\left\{a,b,c,d,e,f,g,h\right\}$
 of the set $A=\left\{1,2,3,4,5,6,7,8\right\}$ are formed.  How many of those permutations satisfy
$$a-b+c-d+e-f+g-h=0$$
My Try:
we have for example
$$(2-1)+(4-3)+(5-6)+(8-7)=0$$ and each of the number in brackets if we treat them as four letters, they can be arranged in $4!=24$ ways.Now in all these possible permutations if we multiply with negative sign we get a different permutation.
So total is $48$.
similarly for $$(2-3)+(4-1)+(5-6)+(8-7)=0$$ we get $48$ permutations.
but i feel this is an informal approach. Any clue for better approach?
 A: The first thing to notice is that the sum of all the numbers from $1$ through $8$ is $36$ so the numbers that are added must sum to $18$ as must the numbers that are subtracted.  We need to find the number of ways to divide the numbers into two sets of four such that each set adds to $18$.  The $8$ has to go in one set, so we look for ways to have three numbers sum to $10$.  They are $721,631,541,532$ so there are $4$ partitions of the set.  For each partition we have two ways to choose which set is added, $4!$ ways to choose the order of the added set, and $4!$ ways to choose the order of the subtracted set.  This gives a total of $4\cdot 2 \cdot 4! \cdot 4!=4608$
A: Ross Millikan's answer is nifty, but doesn't scale to larger instances. So let's rearrange:
$$a+c+e+g=b+d+f+h$$
Since $1 + 2 + \cdots + 8 = 36$ we know both sides must equal $18$. Let's solve one side first:
$$a+c+e+g=18$$
How many solutions are there of this? Well, we're looking for the number of distinct partitions of $18$ with $4$ parts, each part limited to $[1, 8]$. Generalizing, the number of distinct partitions of $n$ with $k$ parts, each part limited to $[1, R]$ is $p(n, k, R)$. The book generatingfunctionology formula 3.16.4 tells us
$$\sum_{n,k} p(n,k,R)x^ny^k = \prod_{r=1}^R\left(\sum_{k = 0}^1 y^kx^{kr}\right) = \prod_{r=1}^R\left( 1 + yx^{r}\right)$$
So we look for the coefficient of $x^{18}y^4$ in $\prod_{r=1}^8\left( 1 + yx^{r}\right)$, giving $8$.
Note that the left hand side determines the right hand side. So we just have to permute the both sides, giving $8 \cdot 4! \cdot 4! = 4608.$
Let's say that instead we had $16$ variables, with range $\{1, \dots, 52\}$. The sum is $1326 / 2 = 663$. This would mean the answer is $$8!^2 \cdot[x^{663}y^8]\prod_{r=1}^{52} ( 1 + yx^{r})$$
A: The total of the numbers is $36$.  Divide by $2  = 18$.
So you may have split the numbers in the following groups $= ({1,3,6,8}$ and ${2,4,5,7})$ or (${1,4,6,7}$ and ${2,3,5,8}$) or (${1,4,5,8}$  and ${2,3,6,7})$. 
Each group  could be permuted in $4!$ ways such that $a-b+c-d+e-f+g-h=0$ is true and each could pair could be swapped for add ad subtract and thus there are three pairs and hence 8 to give a total of $ 8\times24\times24 = 4608$
