TITLE: Integrate $\frac{R}{4 \pi^2}\int_{-\pi}^{\pi}\int_{-\pi}^{\pi} \frac{1-\cos(mx+ny)}{2-(\cos x + \cos y)} dx dy $
QUESTION [17 upvotes]: As in the title: let $m,n\in\mathbb{Z}$. Integrate:
$$ \frac{R}{4 \pi^2}\int_{-\pi}^{\pi}\int_{-\pi}^{\pi} \frac{1-\cos(mx+ny)}{2-(\cos x + \cos y)} dx dy $$ 
For me, it's quite a difficult problem. Any hints? 
$R$ is a constant.

REPLY [8 votes]: Complete Closed form Solution
Defining: 
$$A(m,n) \equiv \frac{1}{4 \pi^2}\int_{-\pi}^{\pi}\int_{-\pi}^{\pi} \frac{1-\cos(mx+ny)}{2-(\cos x + \cos y)} dx dy$$
and assuming that because of symmetry we may assume that $m \ge n \ge 0 $ I claim that the solution is:
$$\begin{align}A(m,n) &= \\ & (-1)^{n}\frac{1}{2} p_{(m-n-1)}\left(\frac{m+n}{2}\right)\tag{1a} \\ &+ \sum_{k=0}^{\left\lfloor \frac{(m+n-2)}{2} \right\rfloor}\frac{2\cos(\frac{\pi}{2}((m+n-2)- 2(k+\frac{m - n}{2})))}{\pi(2k+1)} p_{(m+n-2-2k)}(\frac{m - n}{2})\tag{1b}  \\ &+ \sum_{k=0}^{\left\lfloor \frac{(m-n-2)}{2} \right\rfloor}\frac{2\cos(\frac{\pi}{2}((m-n-2)- 2(k+\frac{m + n}{2})))}{\pi(2k+1)} p_{(m-n-2-2k)}(\frac{m + n}{2})\tag{1c}  \end{align}$$
In which $p_N(x)$ is an $N^{\text{th}}$ order polynomial, which can be written in recursive form as a weighted sum of the integrals of lower order polynomials:
$$p_N(x) = \cos(N\frac{\pi}{2}) +  4\sum_{j=1}^{\left\lceil \frac{N}{2} \right\rceil}\frac{\int p_{(N+1-2j)}(x)  dx}{2j-1} $$
The 'closed form' of this polynomial is given by: 
$$p_N(x) = \sum _{j=0}^{\left\lfloor \frac{N}{2} \right\rfloor} \frac{(4(x))^{(N-2j)}}{(N-2j)!}  (-1)^j\sum_{k_1=0}^{j}\sum_{k_2=0}^{(j-k_1)} \cdots \sum_{k_{(N-2j)}=0}^{(j-\sum_{k\in\{k_1,\ldots k_{(N-2j)-1}\}}k)} \prod_{k\in\{k_1,\ldots k_{N-2j}\}}\frac{(-1)^k}{(2k+1)} $$

Argumentation
As argued in my other answer, the Laplacian of $A(m,n)$ given by:
$$ \begin{align} \mathbf{D}^2_{mn} \otimes A(m,n) &=\begin{bmatrix}0 & \frac 1 2 & 0\\ \frac 1 2 & -2 & \frac 1 2\\0 & \frac 1 2 & 0\end{bmatrix} \otimes A(m,n) \\ & = \delta(0,0) \end{align}$$
is zero everywhere, except at $(m,n) = (0,0)$ where it is 1. 
Together with the following, trivial subset of solutions:
$$ A(m,n) = {\begin{cases}
0 & \text {if $(m,n)=(0,0)$} \\
0.5 & \text {if $ m^2+n^2 = 1$} \\
\sum_{k=1}^m  \frac {2} {\pi(2 k - 1)} & \text {if $ m=n$} \\ \end{cases}} $$
as already derived in Sangchul Lee's answer, this completely defines the whole set of solutions $A(m,n)$, which is argued below. Therefore, if we have a general solution that (1) yields the subset of trivial solutions, and (2) has a discrete Laplacian which is $\delta(0,0)$, then we have our solution.

Proof that (1a,b,c) yields the subset of trivial solutions.
$$\begin{align}A(0,0) &= (-1)^{0}\frac{1}{2} p_{(-1)}\left(\frac{0}{2}\right) + \sum_{k=0}^{-1}\text{etcetera} + \sum_{k=0}^{-1}\text{etcetera}\\
& = 0  \end{align}$$
$$\begin{align}A(1,0) &= \frac{1}{2} p_{0}\left(\frac{1}{2}\right) +  \sum_{k=0}^{-1}\text{etcetera} + \sum_{k=0}^{-1}\text{etcetera}\\
& = \frac 1 2 \cos(0)\\ & = \frac 1 2 \end{align}$$
$$\begin{align}A(m,m) &= (-1)^{m}\frac{1}{2} p_{(-1)}(m) \\ &+ \sum_{k=0}^{m-1}\frac{2\cos(\frac{\pi}{2}((2m-2)- 2(k)))}{\pi(2k+1)} p_{(2m-2-2k)}(0)  \\ &+ \sum_{k=0}^{-1}\text{etcetera} \\ \\&= 0 + \sum_{k=0}^{m-1}\frac{2\cos((m-1-k)\pi)}{\pi(2k+1)} p_{2(m-1-k)}(0) + 0 \\ &=\sum_{k=0}^{m-1}\frac{2\cos((m-1-k)\pi)}{\pi(2k+1)}  \cos(2(m-1-k)\frac{\pi}{2}) \\ \\ &=\frac{2}{\pi}\sum_{k=0}^{m-1}\frac{1}{(2k+1)} \end{align}$$
$\blacksquare$

Proof that the Laplacian of (1a,b,c) is $\delta(0,0)$ 
From the trivial subset, it is easy to see that the Laplacian at $(m,n)=(0,0)$ equals $-2\times 0 + 4(\frac{1}{2}\times \frac{1}{2}) = 1$. Now for $m \ge n \ge 0$ and $m \neq 0$, we must show that: 
$$4A(m,n) \overset{?}{=} A(m,n+1) + A(m,n-1) + A(m+1,n) + A(m-1,n)$$
Note that I claim that this property holds for all individual terms $\{(1a), (1b), (1c)\}$ of the given solution.
For now, I will only show this for the first term. So I must show that:
$$\begin{align} 4(-1)^{n}\frac{1}{2} p_{(m-n-1)}\left(\frac{m+n}{2}\right) \\ &\overset{?}{=} 
(-1)^{n+1}\frac{1}{2} p_{(m-n-2)}\left(\frac{m+n+1}{2}\right)\\&+
(-1)^{n-1}\frac{1}{2} p_{(m-n)}\left(\frac{m+n-1}{2}\right)\\&+
(-1)^{n}\frac{1}{2} p_{(m-n)}\left(\frac{m+1 +n}{2}\right)\\&+
(-1)^{n}\frac{1}{2} p_{(m-n-2)}\left(\frac{m-1+n}{2}\right) \\ \end{align}$$ 
$$\Leftrightarrow $$
$$\begin{align} 4 p_{(m-n-1)}\left(\frac{m+n}{2}\right) \\ &\overset{?}{=} \left(p_{(m-n)}\left(\frac{m+n}{2}+\frac{1}{2}\right) - p_{(m-n)}\left(\frac{m+n}{2}-\frac{1}{2}\right)\right) \\&-
\\&\left(p_{(m-n-2)}\left(\frac{m+n}{2}+\frac{1}{2}\right) - p_{(m-n-2)}\left(\frac{m+n}{2}-\frac{1}{2}\right)\right)  \end{align}$$  
Now using the recursive formulation of the polynomial, and the notation $P_N(x) = \int p_N(x)dx$, we see that the constants ($\cos(N\frac{\pi}{2})$) cancel, so we must show that:
$$\begin{align} 4 p_{(m-n-1)}\left(\frac{m+n}{2}\right) \\ &\overset{?}{=} 4\sum_{j=1}^{\left\lceil \frac{m-n}{2} \right\rceil}\frac{1}{2j-1}\left.P_{(m-n+1-2j)}(x)  \right|_{\left(\frac{m+n}{2}-\frac{1}{2}\right)}^{\left(\frac{m+n}{2}+\frac{1}{2}\right)} \\&-
\\&4\sum_{j=1}^{\left\lceil \frac{m-n-2}{2} \right\rceil}\frac{1}{2j-1}\left.P_{(m-n-2+1-2j)}(x)  \right|_{\left(\frac{m+n}{2}-\frac{1}{2}\right)}^{\left(\frac{m+n}{2}+\frac{1}{2}\right)} \end{align}$$ 
Combining the two definite integrals and dividing by four we get: 
$$\begin{align} p_{(m-n-1)}\left(\frac{m+n}{2}\right) \\ &\overset{?}{=}
 \left.P_{(m-n-1)}(x)\right|_{\left(\frac{m+n}{2}-\frac{1}{2}\right)}^{\left(\frac{m+n}{2}+\frac{1}{2}\right)} \\ \\ &+ \sum_{j=2}^{\left\lceil \frac{m-n}{2} \right\rceil}\left.\left(\frac{-2}{(2j-1)(2j-3)}\right)P_{(m-n+1-2j)}(x)\right|_{\left(\frac{m+n}{2}-\frac{1}{2}\right)}^{\left(\frac{m+n}{2}+\frac{1}{2}\right)}\end{align}$$
Which rearranged says that the definite integral of this polynomial from $x_1 - \frac 1 2 $ to $x_1 + \frac 1 2 $ is the value of that polynomial at $x_1$ , plus the integral of its derivatives (using again the recusrive definition of the polynomials):  
$$\begin{align} \left.P_{(m-n-1)}(x)\right|_{\left(x_1-\frac{1}{2}\right)}^{\left(x_1+\frac{1}{2}\right)} & = p_{(m-n-1)}(x_1) \\&+ \sum_{j=2}^{\left\lceil \frac{m-n}{2} \right\rceil}  \left.\left(\frac{2}{(2j-1)(2j-3)}\right) P_{(m-n+1-2j)}(x)\right|_{\left(x_1-\frac{1}{2}\right)}^{\left(x_1+\frac{1}{2}\right)}\end{align}$$
$\blacksquare$
For the other two terms (1b) and (1c), the reasoning is similar.  

Rationale behind the solution: Laplacian Minesweeping with a Faraday Shield 
As already noted, from the subset of trivial solutions, combined with the harmonicity of $A(m,n)$, all other values can be calculated, like a game of minesweeper: 

Sweeping all solutions from the trivial ones, and the Laplacian filter
Now it is illustrative to decompose the subset of trivial solutions as follows: 
 
It turns out that only the multiples of $\frac{1}{2}$ are responsible for the Laplacian being 1 at $(0,0)$, and zero elsewhere. The diagonal elements involving the factors of $\frac{2}{\pi}$ will with the Laplacian filter all cancel to $0$.    
The decomposition into the values $\{\frac{2}{\pi},\frac{8}{3\pi}, \frac{23}{15\pi},...  \}$ can be continued by decomposing them in four diagonal, infinite halflines (see image below). Now the only way the Laplacian of a diagonal half-line can be zero, is that it ends in a perpendicular diagonal of alternating values (this can be easily verified): 

Alternating diagonal acting like a 'Faraday Shield'
Behind this 'Faraday'-diagonal, we need a second alternating diagonal, to compensate for the first one. The main difference, is that its amplitude must increase linearly to both sides:

Second Faraday diagonal with linear increasing amplitude
In turn, this second diagonal must be compensated by a third diagonal, whose amplitude increases quadratically, and so on...

The diagonal alternating patterns with increasing amplitude (magnitude-scaled)
Once this idea is clear, it is easy to see that the needed polynomials describing the amplitudes of the oscillations, must be each others anti-derivatives. More precisely: each higher order polynomial is a weighted sum of the anti-derivatives of lower order polynomials as given above.
With a similar argument, we can also show that the four sides of the central diamond of halves are continued by infinite 'Faraday-lines'. Also these lead to higher order oscillations, which can be described by the same set of polynomials. 
Numerical validation
I validated the integral numerically for several values of $(m,n)$ on a grid of  $2^{13} \times 2^{13}$ gridpoints. 

Image of the function $\frac{1-\cos(mx+ny)}{2-(\cos x + \cos y)}$ as evaluated in the numerical validation
Matlab code 
%% Set 0 <= n <= m
m = 3; n = 7

    % ensure that:  0 <= n <= m
    n = round(abs(n));
    m = round(abs(m));
    if n > m 
        a = n;
        n = m;
        m = a;
    end 

%% 1) Numerical integration (validation): 
N = 2^9;
[x,y] = meshgrid(2*pi*(-N/2:N/2-1)/N); 
f = 1/(2*pi)^2*(1 - cos(m*x + n*y))./(2 - cos(x) - cos(y)); 
f(N/2+1,N/2+1) =  1/(2*pi)^2*(n^2 + m^2); 
% compensate for discrete grid
f(N/2+1,N/2+1) = f(N/2+1,N/2+1)/2; 
figure; imagesc(f); axis equal tight;
Anm_numerical = sum(f(:))/N^2*4*pi^2


%% 2) Proposed analytical solution: 
% Initialize polynomial coefficients: 
PMAX = m+n - 1;
C = zeros(PMAX,PMAX); 
for k = 1:PMAX
    C(k,1) = cos((k-1)*pi/2);
    for kBack = k-1:-2:1
        C(k,2:end) = C(k,2:end) + 1/(k - kBack)*C(kBack,1:end-1);
    end
end

% 2a) irrational part: 
xVals = (m + [-n, +n])/2; % u and v
PVals = (m + [+n, -n]) - 2; % P_u and P_v

% Initialize integration sum: 
S = 0;
for ValsNr = 1:2
    x = xVals(ValsNr); % u and v
    P = PVals(ValsNr); % P_u and P_v

    % Initialize partial sum: 
    s = 0; 
    for k = 0:floor(P/2)
        pNr = P-2*k; % polynomial index (~=degree)
        value_pNr = 2/pi/(2*k+1); % 
        sign_pNr  = cos((pNr - 2*x)*pi/2); % sign of oscillating polynomial
        for powIndex = 0:floor(pNr/2)
            pow = pNr - 2*powIndex; % power of coefficient
            coef = (4*x)^pow/factorial(pow)*C(pNr+1, pow+1);
            s = s + coef*value_pNr*sign_pNr;
        end
    end
    S = S + s;
end

% 2b) rational part: 
x = (m + n)/2; % v
P = (m - n)-1; % P_v

% Initialize partial sum: 
s = 0; 
pNr = P; % polynomial index (~=degree)
value_pNr = 1/2; % 
sign_pNr  = (-1)^n; % sign of oscillating polynomial
for powIndex = 0:floor(pNr/2)
    pow = pNr - 2*powIndex; % power of coefficient
    coef = (4*x)^pow/factorial(pow)*C(pNr+1, pow+1);
    s = s + coef*value_pNr*sign_pNr;
end
S = S + s;

Anm_analytic = S
ErrorBetweenNumericalAnalytic = (Anm_analytic - Anm_numerical)