Skip to main content
added 12 characters in body
Source Link
Fedor Petrov
  • 108.9k
  • 9
  • 264
  • 459

There is a short way to take out trigonometry and remain with the sum of $\pm 1$, similar (but not immediately equivalent, see later) to these appearing in the Christophe Leuridan and Alexander Kalmynin's solution: \begin{align*}\sum_{m=1}^{p} \sum_{n=1}^{q} \frac{2}{\cos(\frac{2m\pi}{p})+\cos(\frac{2n\pi}{q})} &=\sum_{x^q=y^p=1}\frac4{x+1/x+y+1/y}\\[4pt] &=\sum_{x^q=y^p=1}\frac{4x}{(1+x/y)(1+xy)}\\[4pt] &=\sum_{x^q=y^p=1}\frac{x(1+(x/y)^{pq})(1+(xy)^{pq})}{(1+x/y)(1+xy)}\\[4pt] &=\sum_{x^q=y^p=1}x\sum_{a=0}^{pq-1}(-1)^a(x/y)^a\sum_{b=0}^{pq-1}(-1)^b(xy)^b\\[4pt] &=pq\sum_{\substack{0\leqslant a,b\leqslant pq-1\\q|1+a+b,\ p|b-a}}(-1)^{a+b}, \end{align*} since the summation of a single monomial $x^A y^B$ over $\{x^q=y^p=1\}$ gives $pq$ when $q|A$ and $p|B$ and 0 otherwise.

Thus, an equivalent reformulation of the inequality is $$ M:=\sum_{\substack{0\leqslant a,b\leqslant pq-1\\q|1+a+b,\ p|b-a}}(-1)^{a+b}\leqslant |p-q|+1.\tag{$\heartsuit$} $$ I include the proveproof of $(\heartsuit)$, it is short and elementary but, as for me, not trivial. Without Sasha's answer I would think longer about this. We may assume (from the very beginning) that $q>p$. Call a pair $(a,b)\in \{0,1,\ldots,pq-1\}^2$ appropriate, if $q|1+a+b$ and $p|b-a$, and denote the set of appropriate pairs by $\Theta$.

We partition the sum over appropriate pairs in $(\heartsuit)$ onto three parts, over the sets $\Omega_1,\Omega_2,\Omega_3$, where \begin{align*} \Omega_1&:=\{(a,b)\in \Theta:(q-p)/2\leqslant a\leqslant pq-1,(q+p)/2\leqslant b\leqslant pq-1\}\\ \Omega_2&:=\{(a,b)\in \Theta:0\leqslant a<(q-p)/2\}\\ \Omega_3&:=\{(a,b)\in \Theta:0\leqslant b<(q+p)/2\}. \end{align*} Note that the sets $\Omega_1$, $\Omega_2$ and $\Omega_3$ are disjoint (for a pair of integers $(a,b)$ enjoying both inequalities $0\leqslant a<(q-p)/2$ and $0\leqslant b<(q+p)/2$ we have $0<a+b+1<q$, thus it is not appropriate).

The main idea is that on $\Omega_1$ there exists a sign-reversing involution $$(a,b)\mapsto (pq-1+(q-p)/2-a,pq-1+(q+p)/2-b),$$ which preserves being an appropriate pair but changes the parity of $a+b$.

On $\Omega_2$, we must have $b=q-1-a+m\cdot q$ for $m\in \{0,1,\ldots,p-1\}$ (since $b\equiv q-1-a\pmod q$) and $m=m(a)$ is chosen so that $q-1-2a+m(a)q$ is divisible by $p$, there exists unique such $m(a)$, and $(-1)^{a+b}=(-1)^{m(a)}$.

Analogously, on $\Omega_3$, we must have $a=q-1-b+m(b)\cdot q$, and $(-1)^{a+b}=(-1)^{m(b)}$. Thus, the sum over $\Omega_2$ and $\Omega_3$ is nothing but $$\sum_{a=0}^{(q-p)/2-1}(-1)^{m(a)}+\sum_{b=0}^{(q+p)/2-1}(-1)^{m(b)}.$$ Now note that $m((q-1)/2)=0$ and for $0\leqslant a<q$, $a\ne (q-1)/2$, we have $m(a)+m(q-1-a)=p$. Thus, the sum of $(-1)^{m(a)}$ for $a\in [(q-p)/2,(q+p)/2-1]$ (this set is symmetric with respect to $(q-1)/2$, so we may partition it onto $\{(q-1)/2\}$ and pairs with sum $q-1$) equals $1$. Therefore, $$ M=1+2\sum_{a=0}^{(q-p)/2-1} (-1)^{m(a)}\leqslant 1+(q-p), $$ with equality of and only if $m(a)$ is even for all $a=0,1,\ldots,(q-p)/2-1$.

There is a short way to take out trigonometry and remain with the sum of $\pm 1$, similar (but not immediately equivalent, see later) to these appearing in the Christophe Leuridan and Alexander Kalmynin's solution: \begin{align*}\sum_{m=1}^{p} \sum_{n=1}^{q} \frac{2}{\cos(\frac{2m\pi}{p})+\cos(\frac{2n\pi}{q})} &=\sum_{x^q=y^p=1}\frac4{x+1/x+y+1/y}\\[4pt] &=\sum_{x^q=y^p=1}\frac{4x}{(1+x/y)(1+xy)}\\[4pt] &=\sum_{x^q=y^p=1}\frac{x(1+(x/y)^{pq})(1+(xy)^{pq})}{(1+x/y)(1+xy)}\\[4pt] &=\sum_{x^q=y^p=1}x\sum_{a=0}^{pq-1}(-1)^a(x/y)^a\sum_{b=0}^{pq-1}(-1)^b(xy)^b\\[4pt] &=pq\sum_{\substack{0\leqslant a,b\leqslant pq-1\\q|1+a+b,\ p|b-a}}(-1)^{a+b}, \end{align*} since the summation of a single monomial $x^A y^B$ over $\{x^q=y^p=1\}$ gives $pq$ when $q|A$ and $p|B$ and 0 otherwise.

Thus, an equivalent reformulation of the inequality is $$ M:=\sum_{\substack{0\leqslant a,b\leqslant pq-1\\q|1+a+b,\ p|b-a}}(-1)^{a+b}\leqslant |p-q|+1.\tag{$\heartsuit$} $$ I include the prove of $(\heartsuit)$, it is short and elementary but, as for me, not trivial. Without Sasha's answer I would think longer about this. We may assume (from the very beginning) that $q>p$. Call a pair $(a,b)\in \{0,1,\ldots,pq-1\}^2$ appropriate, if $q|1+a+b$ and $p|b-a$, and denote the set of appropriate pairs by $\Theta$.

We partition the sum over appropriate pairs in $(\heartsuit)$ onto three parts, over the sets $\Omega_1,\Omega_2,\Omega_3$, where \begin{align*} \Omega_1&:=\{(a,b)\in \Theta:(q-p)/2\leqslant a\leqslant pq-1,(q+p)/2\leqslant b\leqslant pq-1\}\\ \Omega_2&:=\{(a,b)\in \Theta:0\leqslant a<(q-p)/2\}\\ \Omega_3&:=\{(a,b)\in \Theta:0\leqslant b<(q+p)/2\}. \end{align*} Note that the sets $\Omega_1$, $\Omega_2$ and $\Omega_3$ are disjoint (for a pair $(a,b)$ enjoying both inequalities $0\leqslant a<(q-p)/2$ and $0\leqslant b<(q+p)/2$ we have $0<a+b+1<q$, thus it is not appropriate).

The main idea is that on $\Omega_1$ there exists a sign-reversing involution $$(a,b)\mapsto (pq-1+(q-p)/2-a,pq-1+(q+p)/2-b),$$ which preserves being an appropriate pair but changes the parity of $a+b$.

On $\Omega_2$, we must have $b=q-1-a+m\cdot q$ for $m\in \{0,1,\ldots,p-1\}$ (since $b\equiv q-1-a\pmod q$) and $m=m(a)$ is chosen so that $q-1-2a+m(a)q$ is divisible by $p$, there exists unique such $m(a)$, and $(-1)^{a+b}=(-1)^{m(a)}$.

Analogously, on $\Omega_3$, we must have $a=q-1-b+m(b)\cdot q$, and $(-1)^{a+b}=(-1)^{m(b)}$. Thus, the sum over $\Omega_2$ and $\Omega_3$ is nothing but $$\sum_{a=0}^{(q-p)/2-1}(-1)^{m(a)}+\sum_{b=0}^{(q+p)/2-1}(-1)^{m(b)}.$$ Now note that $m((q-1)/2)=0$ and for $0\leqslant a<q$, $a\ne (q-1)/2$, we have $m(a)+m(q-1-a)=p$. Thus, the sum of $(-1)^{m(a)}$ for $a\in [(q-p)/2,(q+p)/2-1]$ (this set is symmetric with respect to $(q-1)/2$, so we may partition it onto $\{(q-1)/2\}$ and pairs with sum $q-1$) equals $1$. Therefore, $$ M=1+2\sum_{a=0}^{(q-p)/2-1} (-1)^{m(a)}\leqslant 1+(q-p), $$ with equality of and only if $m(a)$ is even for all $a=0,1,\ldots,(q-p)/2-1$.

There is a short way to take out trigonometry and remain with the sum of $\pm 1$, similar (but not immediately equivalent, see later) to these appearing in the Christophe Leuridan and Alexander Kalmynin's solution: \begin{align*}\sum_{m=1}^{p} \sum_{n=1}^{q} \frac{2}{\cos(\frac{2m\pi}{p})+\cos(\frac{2n\pi}{q})} &=\sum_{x^q=y^p=1}\frac4{x+1/x+y+1/y}\\[4pt] &=\sum_{x^q=y^p=1}\frac{4x}{(1+x/y)(1+xy)}\\[4pt] &=\sum_{x^q=y^p=1}\frac{x(1+(x/y)^{pq})(1+(xy)^{pq})}{(1+x/y)(1+xy)}\\[4pt] &=\sum_{x^q=y^p=1}x\sum_{a=0}^{pq-1}(-1)^a(x/y)^a\sum_{b=0}^{pq-1}(-1)^b(xy)^b\\[4pt] &=pq\sum_{\substack{0\leqslant a,b\leqslant pq-1\\q|1+a+b,\ p|b-a}}(-1)^{a+b}, \end{align*} since the summation of a single monomial $x^A y^B$ over $\{x^q=y^p=1\}$ gives $pq$ when $q|A$ and $p|B$ and 0 otherwise.

Thus, an equivalent reformulation of the inequality is $$ M:=\sum_{\substack{0\leqslant a,b\leqslant pq-1\\q|1+a+b,\ p|b-a}}(-1)^{a+b}\leqslant |p-q|+1.\tag{$\heartsuit$} $$ I include the proof of $(\heartsuit)$, it is short and elementary but, as for me, not trivial. Without Sasha's answer I would think longer about this. We may assume (from the very beginning) that $q>p$. Call a pair $(a,b)\in \{0,1,\ldots,pq-1\}^2$ appropriate, if $q|1+a+b$ and $p|b-a$, and denote the set of appropriate pairs by $\Theta$.

We partition the sum over appropriate pairs in $(\heartsuit)$ onto three parts, over the sets $\Omega_1,\Omega_2,\Omega_3$, where \begin{align*} \Omega_1&:=\{(a,b)\in \Theta:(q-p)/2\leqslant a\leqslant pq-1,(q+p)/2\leqslant b\leqslant pq-1\}\\ \Omega_2&:=\{(a,b)\in \Theta:0\leqslant a<(q-p)/2\}\\ \Omega_3&:=\{(a,b)\in \Theta:0\leqslant b<(q+p)/2\}. \end{align*} Note that the sets $\Omega_1$, $\Omega_2$ and $\Omega_3$ are disjoint (for a pair of integers $(a,b)$ enjoying both inequalities $0\leqslant a<(q-p)/2$ and $0\leqslant b<(q+p)/2$ we have $0<a+b+1<q$, thus it is not appropriate).

The main idea is that on $\Omega_1$ there exists a sign-reversing involution $$(a,b)\mapsto (pq-1+(q-p)/2-a,pq-1+(q+p)/2-b),$$ which preserves being an appropriate pair but changes the parity of $a+b$.

On $\Omega_2$, we must have $b=q-1-a+m\cdot q$ for $m\in \{0,1,\ldots,p-1\}$ (since $b\equiv q-1-a\pmod q$) and $m=m(a)$ is chosen so that $q-1-2a+m(a)q$ is divisible by $p$, there exists unique such $m(a)$, and $(-1)^{a+b}=(-1)^{m(a)}$.

Analogously, on $\Omega_3$, we must have $a=q-1-b+m(b)\cdot q$, and $(-1)^{a+b}=(-1)^{m(b)}$. Thus, the sum over $\Omega_2$ and $\Omega_3$ is nothing but $$\sum_{a=0}^{(q-p)/2-1}(-1)^{m(a)}+\sum_{b=0}^{(q+p)/2-1}(-1)^{m(b)}.$$ Now note that $m((q-1)/2)=0$ and for $0\leqslant a<q$, $a\ne (q-1)/2$, we have $m(a)+m(q-1-a)=p$. Thus, the sum of $(-1)^{m(a)}$ for $a\in [(q-p)/2,(q+p)/2-1]$ (this set is symmetric with respect to $(q-1)/2$, so we may partition it onto $\{(q-1)/2\}$ and pairs with sum $q-1$) equals $1$. Therefore, $$ M=1+2\sum_{a=0}^{(q-p)/2-1} (-1)^{m(a)}\leqslant 1+(q-p), $$ with equality of and only if $m(a)$ is even for all $a=0,1,\ldots,(q-p)/2-1$.

just prettifying
Source Link
GH from MO
  • 105.2k
  • 8
  • 292
  • 398

There is a short way to take out trigonometry and remain with the sum of $\pm 1$, similar (but not immediately equivalent, see later) to these appearing in the Christophe Leuridan and Alexander Kalmynin's solution: $$\sum \frac{2}{\cos(\frac{2m\pi}{p})+\cos(\frac{2n\pi}{q})}=\sum_{x^q=y^p=1}\frac4{x+1/x+y+1/y}\\=\sum_{x^q=y^p=1}\frac{4x}{(1+x/y)(1+xy)}=\sum_{x^q=y^p=1}\frac{x(1+(x/y)^{pq})(1+(xy)^{pq})}{(1+x/y)(1+xy)}\\ =\sum_{x^q=y^p=1}x\sum_{a=0}^{pq-1}(-1)^a(x/y)^a\sum_{b=0}^{pq-1}(-1)^b(xy)^b\\=pq\sum_{0\leqslant a,b\leqslant pq-1,q|1+a+b,p|b-a}(-1)^{a+b},$$ \begin{align*}\sum_{m=1}^{p} \sum_{n=1}^{q} \frac{2}{\cos(\frac{2m\pi}{p})+\cos(\frac{2n\pi}{q})} &=\sum_{x^q=y^p=1}\frac4{x+1/x+y+1/y}\\[4pt] &=\sum_{x^q=y^p=1}\frac{4x}{(1+x/y)(1+xy)}\\[4pt] &=\sum_{x^q=y^p=1}\frac{x(1+(x/y)^{pq})(1+(xy)^{pq})}{(1+x/y)(1+xy)}\\[4pt] &=\sum_{x^q=y^p=1}x\sum_{a=0}^{pq-1}(-1)^a(x/y)^a\sum_{b=0}^{pq-1}(-1)^b(xy)^b\\[4pt] &=pq\sum_{\substack{0\leqslant a,b\leqslant pq-1\\q|1+a+b,\ p|b-a}}(-1)^{a+b}, \end{align*} since the summation of a single monomial $x^A y^B$ over $\{x^q=y^p=1\}$ gives $pq$ when $q|A$ and $p|B$ and 0 otherwise.

Thus, an equivalent reformulation of the inequality is $$ M:=\sum_{0\leqslant a,b\leqslant pq-1,q|1+a+b,p|b-a}(-1)^{a+b}\leqslant |p-q|+1.\tag{$\heartsuit$} $$$$ M:=\sum_{\substack{0\leqslant a,b\leqslant pq-1\\q|1+a+b,\ p|b-a}}(-1)^{a+b}\leqslant |p-q|+1.\tag{$\heartsuit$} $$ I include the prove of $(\heartsuit)$, it is short and elementary but, as for me, not trivial. Without Sasha's answer I would think longer about this. We may assume (from the very beginning) that $q>p$. Call a pair $(a,b)\in \{0,1,\ldots,pq-1\}^2$ appropriate, if $q|1+a+b,p|b-a$$q|1+a+b$ and $p|b-a$, and denote the set of appropriate pairs by $\Theta$.

We partition the sum over appropriate pairs in $(\heartsuit)$ onto three parts, over the sets $\Omega_1,\Omega_2,\Omega_3$, where \begin{align*} \Omega_1&:=\{(a,b)\in \Theta:(q-p)/2\leqslant a\leqslant pq-1,(q+p)/2\leqslant b\leqslant pq-1\}\\ \Omega_2&:=\{(a,b)\in \Theta:0\leqslant a<(q-p)/2\}\\ \Omega_3&:=\{(a,b)\in \Theta:0\leqslant b<(q+p)/2\}. \end{align*} Note that the sets $\Omega_1$, $\Omega_2$ and $\Omega_3$ are disjoint (for a pair $(a,b)$ enjoying both inequalities $0\leqslant a<(q-p)/2$ and $0\leqslant b<(q+p)/2$ we have $0<a+b+1<q$, thus it is not appropriate).

The main idea is that on $\Omega_1$ there exists a sign-reversing involution $(a,b)\to (pq-1+(q-p)/2-a,pq-1+(q+p)/2-b)$,$$(a,b)\mapsto (pq-1+(q-p)/2-a,pq-1+(q+p)/2-b),$$ which preserves being an appropriate pair but changes the parity of $a+b$.

On $\Omega_2$, we must have $b=q-1-a+m\cdot q$ for $m\in \{0,1,\ldots,p-1\}$ (since $b\equiv q-1-a\pmod q$) and $m=m(a)$ is chosen so that $q-1-2a+m(a)q$ is divisible by $p$, there exists unique such $m(a)$, and $(-1)^{a+b}=(-1)^{m(a)}$.

Analogously, on $\Omega_3$, we must have $a=q-1-b+m(b)\cdot q$, and $(-1)^{a+b}=(-1)^{m(b)}$. Thus, the sum over $\Omega_2$ and $\Omega_3$ is nothing but $$\sum_{a=0}^{(q-p)/2-1}(-1)^{m(a)}+\sum_{b=0}^{(q+p)/2-1}(-1)^{m(b)}. $$
$$\sum_{a=0}^{(q-p)/2-1}(-1)^{m(a)}+\sum_{b=0}^{(q+p)/2-1}(-1)^{m(b)}.$$ Now note that $m((q-1)/2)=0$ and for $0\leqslant a<q$, $a\ne (q-1)/2$, we have $m(a)+m(q-1-a)=p$. Thus, the sum of $(-1)^{m(a)}$ for $a\in [(q-p)/2,(q+p)/2-1]$ (this set is symmetric with respect to $(q-1)/2$, so we may partition it onto $\{(q-1)/2\}$ and pairs with sum $q-1$) equals $1$. Therefore, $$ M=1+2\sum_{a=0}^{(q-p)/2-1} (-1)^{m(a)}\leqslant 1+(q-p), $$ with equality of and only if $m(a)$ is even for all $a=0,1,\ldots,(q-p)/2-1$.

There is a short way to take out trigonometry and remain with the sum of $\pm 1$, similar (but not immediately equivalent, see later) to these appearing in the Christophe Leuridan and Alexander Kalmynin's solution: $$\sum \frac{2}{\cos(\frac{2m\pi}{p})+\cos(\frac{2n\pi}{q})}=\sum_{x^q=y^p=1}\frac4{x+1/x+y+1/y}\\=\sum_{x^q=y^p=1}\frac{4x}{(1+x/y)(1+xy)}=\sum_{x^q=y^p=1}\frac{x(1+(x/y)^{pq})(1+(xy)^{pq})}{(1+x/y)(1+xy)}\\ =\sum_{x^q=y^p=1}x\sum_{a=0}^{pq-1}(-1)^a(x/y)^a\sum_{b=0}^{pq-1}(-1)^b(xy)^b\\=pq\sum_{0\leqslant a,b\leqslant pq-1,q|1+a+b,p|b-a}(-1)^{a+b},$$ since the summation of a single monomial $x^A y^B$ over $\{x^q=y^p=1\}$ gives $pq$ when $q|A$ and $p|B$ and 0 otherwise.

Thus, an equivalent reformulation of the inequality is $$ M:=\sum_{0\leqslant a,b\leqslant pq-1,q|1+a+b,p|b-a}(-1)^{a+b}\leqslant |p-q|+1.\tag{$\heartsuit$} $$ I include the prove of $(\heartsuit)$, it is short and elementary but, as for me, not trivial. Without Sasha's answer I would think longer about this. We may assume (from the very beginning) that $q>p$. Call a pair $(a,b)\in \{0,1,\ldots,pq-1\}^2$ appropriate, if $q|1+a+b,p|b-a$, and denote the set of appropriate pairs by $\Theta$.

We partition the sum over appropriate pairs in $(\heartsuit)$ onto three parts, over the sets $\Omega_1,\Omega_2,\Omega_3$, where \begin{align*} \Omega_1&:=\{(a,b)\in \Theta:(q-p)/2\leqslant a\leqslant pq-1,(q+p)/2\leqslant b\leqslant pq-1\}\\ \Omega_2&:=\{(a,b)\in \Theta:0\leqslant a<(q-p)/2\}\\ \Omega_3&:=\{(a,b)\in \Theta:0\leqslant b<(q+p)/2\}. \end{align*} Note that the sets $\Omega_1$, $\Omega_2$ and $\Omega_3$ are disjoint (for a pair $(a,b)$ enjoying both inequalities $0\leqslant a<(q-p)/2$ and $0\leqslant b<(q+p)/2$ we have $0<a+b+1<q$, thus it is not appropriate).

The main idea is that on $\Omega_1$ there exists a sign-reversing involution $(a,b)\to (pq-1+(q-p)/2-a,pq-1+(q+p)/2-b)$, which preserves being an appropriate pair but changes the parity of $a+b$.

On $\Omega_2$, we must have $b=q-1-a+m\cdot q$ for $m\in \{0,1,\ldots,p-1\}$ (since $b\equiv q-1-a\pmod q$) and $m=m(a)$ is chosen so that $q-1-2a+m(a)q$ is divisible by $p$, there exists unique such $m(a)$, and $(-1)^{a+b}=(-1)^{m(a)}$.

Analogously, on $\Omega_3$, we must have $a=q-1-b+m(b)\cdot q$, and $(-1)^{a+b}=(-1)^{m(b)}$. Thus, the sum over $\Omega_2$ and $\Omega_3$ is nothing but $$\sum_{a=0}^{(q-p)/2-1}(-1)^{m(a)}+\sum_{b=0}^{(q+p)/2-1}(-1)^{m(b)}. $$
Now note that $m((q-1)/2)=0$ and for $0\leqslant a<q$, $a\ne (q-1)/2$, we have $m(a)+m(q-1-a)=p$. Thus, the sum of $(-1)^{m(a)}$ for $a\in [(q-p)/2,(q+p)/2-1]$ (this set is symmetric with respect to $(q-1)/2$, so we may partition it onto $\{(q-1)/2\}$ and pairs with sum $q-1$) equals $1$. Therefore, $$ M=1+2\sum_{a=0}^{(q-p)/2-1} (-1)^{m(a)}\leqslant 1+(q-p), $$ with equality of and only if $m(a)$ is even for all $a=0,1,\ldots,(q-p)/2-1$.

There is a short way to take out trigonometry and remain with the sum of $\pm 1$, similar (but not immediately equivalent, see later) to these appearing in the Christophe Leuridan and Alexander Kalmynin's solution: \begin{align*}\sum_{m=1}^{p} \sum_{n=1}^{q} \frac{2}{\cos(\frac{2m\pi}{p})+\cos(\frac{2n\pi}{q})} &=\sum_{x^q=y^p=1}\frac4{x+1/x+y+1/y}\\[4pt] &=\sum_{x^q=y^p=1}\frac{4x}{(1+x/y)(1+xy)}\\[4pt] &=\sum_{x^q=y^p=1}\frac{x(1+(x/y)^{pq})(1+(xy)^{pq})}{(1+x/y)(1+xy)}\\[4pt] &=\sum_{x^q=y^p=1}x\sum_{a=0}^{pq-1}(-1)^a(x/y)^a\sum_{b=0}^{pq-1}(-1)^b(xy)^b\\[4pt] &=pq\sum_{\substack{0\leqslant a,b\leqslant pq-1\\q|1+a+b,\ p|b-a}}(-1)^{a+b}, \end{align*} since the summation of a single monomial $x^A y^B$ over $\{x^q=y^p=1\}$ gives $pq$ when $q|A$ and $p|B$ and 0 otherwise.

Thus, an equivalent reformulation of the inequality is $$ M:=\sum_{\substack{0\leqslant a,b\leqslant pq-1\\q|1+a+b,\ p|b-a}}(-1)^{a+b}\leqslant |p-q|+1.\tag{$\heartsuit$} $$ I include the prove of $(\heartsuit)$, it is short and elementary but, as for me, not trivial. Without Sasha's answer I would think longer about this. We may assume (from the very beginning) that $q>p$. Call a pair $(a,b)\in \{0,1,\ldots,pq-1\}^2$ appropriate, if $q|1+a+b$ and $p|b-a$, and denote the set of appropriate pairs by $\Theta$.

We partition the sum over appropriate pairs in $(\heartsuit)$ onto three parts, over the sets $\Omega_1,\Omega_2,\Omega_3$, where \begin{align*} \Omega_1&:=\{(a,b)\in \Theta:(q-p)/2\leqslant a\leqslant pq-1,(q+p)/2\leqslant b\leqslant pq-1\}\\ \Omega_2&:=\{(a,b)\in \Theta:0\leqslant a<(q-p)/2\}\\ \Omega_3&:=\{(a,b)\in \Theta:0\leqslant b<(q+p)/2\}. \end{align*} Note that the sets $\Omega_1$, $\Omega_2$ and $\Omega_3$ are disjoint (for a pair $(a,b)$ enjoying both inequalities $0\leqslant a<(q-p)/2$ and $0\leqslant b<(q+p)/2$ we have $0<a+b+1<q$, thus it is not appropriate).

The main idea is that on $\Omega_1$ there exists a sign-reversing involution $$(a,b)\mapsto (pq-1+(q-p)/2-a,pq-1+(q+p)/2-b),$$ which preserves being an appropriate pair but changes the parity of $a+b$.

On $\Omega_2$, we must have $b=q-1-a+m\cdot q$ for $m\in \{0,1,\ldots,p-1\}$ (since $b\equiv q-1-a\pmod q$) and $m=m(a)$ is chosen so that $q-1-2a+m(a)q$ is divisible by $p$, there exists unique such $m(a)$, and $(-1)^{a+b}=(-1)^{m(a)}$.

Analogously, on $\Omega_3$, we must have $a=q-1-b+m(b)\cdot q$, and $(-1)^{a+b}=(-1)^{m(b)}$. Thus, the sum over $\Omega_2$ and $\Omega_3$ is nothing but $$\sum_{a=0}^{(q-p)/2-1}(-1)^{m(a)}+\sum_{b=0}^{(q+p)/2-1}(-1)^{m(b)}.$$ Now note that $m((q-1)/2)=0$ and for $0\leqslant a<q$, $a\ne (q-1)/2$, we have $m(a)+m(q-1-a)=p$. Thus, the sum of $(-1)^{m(a)}$ for $a\in [(q-p)/2,(q+p)/2-1]$ (this set is symmetric with respect to $(q-1)/2$, so we may partition it onto $\{(q-1)/2\}$ and pairs with sum $q-1$) equals $1$. Therefore, $$ M=1+2\sum_{a=0}^{(q-p)/2-1} (-1)^{m(a)}\leqslant 1+(q-p), $$ with equality of and only if $m(a)$ is even for all $a=0,1,\ldots,(q-p)/2-1$.

added 67 characters in body
Source Link
Fedor Petrov
  • 108.9k
  • 9
  • 264
  • 459

There is a short way to take out trigonometry and remain with the sum of $\pm 1$, similar (but not immediately equivalent, see later) to these appearing in the Christophe Leuridan and Alexander Kalmynin's solution: $$\sum \frac{2}{\cos(\frac{2m\pi}{p})+\cos(\frac{2n\pi}{q})}=\sum_{x^q=y^p=1}\frac4{x+1/x+y+1/y}\\=\sum_{x^q=y^p=1}\frac{4x}{(1+x/y)(1+xy)}=\sum_{x^q=y^p=1}\frac{x(1+(x/y)^{pq})(1+(xy)^{pq})}{(1+x/y)(1+xy)}\\ =\sum_{x^q=y^p=1}x\sum_{a=0}^{pq-1}(-1)^a(x/y)^a\sum_{b=0}^{pq-1}(-1)^b(xy)^b\\=pq\sum_{0\leqslant a,b\leqslant pq-1,q|1+a+b,p|b-a}(-1)^{a+b},$$ since the summation of a single monomial $x^A y^B$ over $\{x^q=y^p=1\}$ gives $pq$ when $q|A$ and $p|B$ and 0 otherwise.

Thus, an equivalent reformulation of the inequality is $$ M:=\sum_{0\leqslant a,b\leqslant pq-1,q|1+a+b,p|b-a}(-1)^{a+b}\leqslant |p-q|+1.\tag{$\heartsuit$} $$ I include the prove of $(\heartsuit)$, it is short and elementary but, as for me, not trivial. Without Sasha's answer I would think longer about this. We may assume (from the very beginning) that $q>p$. Call a pair $(a,b)\in \{0,1,\ldots,pq-1\}^2$ appropriate, if $q|1+a+b,p|b-a$, and denote the set of appropriate pairs by $\Theta$.

We partition the sum over appropriate pairs in $(\heartsuit)$ onto three parts, over the sets $\Omega_1,\Omega_2,\Omega_3$, where \begin{align*} \Omega_1&:=\{(a,b)\in \Theta:(q-p)/2\leqslant a\leqslant pq-1,(q+p)/2\leqslant b\leqslant pq-1\}\\ \Omega_2&:=\{(a,b)\in \Theta:0\leqslant a<(q-p)/2\}\\ \Omega_3&:=\{(a,b)\in \Theta:0\leqslant b<(q+p)/2\}. \end{align*} Note that the sets $\Omega_1$, $\Omega_2$ and $\Omega_3$ are disjoint (for a pair $(a,b)$ enjoying both inequalities $0\leqslant a<(q-p)/2$ and $0\leqslant b<(q+p)/2$ we have $0<a+b+1<q$, thus it is not appropriate).

The main idea is that on $\Omega_1$ there exists a sign-reversing involution $(a,b)\to (pq-1+(q-p)/2-a,pq-1+(q+p)/2-b)$, which preserves being an appropriate pair but changes the parity of $a+b$.

On $\Omega_2$, we must have $b=q-1-a+m\cdot q$ for $m\in \{0,1,\ldots,p-1\}$ (since $b\equiv q-1-a\pmod q$) and $m=m(a)$ is chosen so that $q-1-2a+m(a)q$ is divisible by $p$, there exists unique such $m(a)$, and $(-1)^{a+b}=(-1)^{m(a)}$.

Analogously, on $\Omega_3$, we must have $a=q-1-b+m(b)\cdot q$, and $(-1)^{a+b}=(-1)^{m(b)}$. Thus, the sum over $\Omega_2$ and $\Omega_3$ is nothing but $$\sum_{a=0}^{(q-p)/2-1}(-1)^{m(a)}+\sum_{b=0}^{(q+p)/2-1}(-1)^{m(b)}. $$
Now note that $m((q-1)/2)=0$ and for $0\leqslant a<q$, $a\ne (q-1)/2$, we have $m(a)+m(q-1-a)=p$. Thus, the sum of $(-1)^{m(a)}$ for $a\in [(q-p)/2,(q+p)/2-1]$ (this set is symmetric with respect to $(q-1)/2$, so we may partition it onto $\{(q-1)/2\}$ and pairs with sum $q-1$) equals $1$. Therefore, our sum equals $$ 1+2\sum_{a=0}^{(q-p)/2-1} (-1)^{m(a)}\leqslant 1+(q-p). $$$$ M=1+2\sum_{a=0}^{(q-p)/2-1} (-1)^{m(a)}\leqslant 1+(q-p), $$ with equality of and only if $m(a)$ is even for all $a=0,1,\ldots,(q-p)/2-1$.

There is a short way to take out trigonometry and remain with the sum of $\pm 1$, similar (but not immediately equivalent, see later) to these appearing in the Christophe Leuridan and Alexander Kalmynin's solution: $$\sum \frac{2}{\cos(\frac{2m\pi}{p})+\cos(\frac{2n\pi}{q})}=\sum_{x^q=y^p=1}\frac4{x+1/x+y+1/y}\\=\sum_{x^q=y^p=1}\frac{4x}{(1+x/y)(1+xy)}=\sum_{x^q=y^p=1}\frac{x(1+(x/y)^{pq})(1+(xy)^{pq})}{(1+x/y)(1+xy)}\\ =\sum_{x^q=y^p=1}x\sum_{a=0}^{pq-1}(-1)^a(x/y)^a\sum_{b=0}^{pq-1}(-1)^b(xy)^b\\=pq\sum_{0\leqslant a,b\leqslant pq-1,q|1+a+b,p|b-a}(-1)^{a+b},$$ since the summation of a single monomial $x^A y^B$ over $\{x^q=y^p=1\}$ gives $pq$ when $q|A$ and $p|B$ and 0 otherwise.

Thus, an equivalent reformulation of the inequality is $$ M:=\sum_{0\leqslant a,b\leqslant pq-1,q|1+a+b,p|b-a}(-1)^{a+b}\leqslant |p-q|+1.\tag{$\heartsuit$} $$ I include the prove of $(\heartsuit)$, it is short and elementary but, as for me, not trivial. Without Sasha's answer I would think longer about this. We may assume (from the very beginning) that $q>p$. Call a pair $(a,b)\in \{0,1,\ldots,pq-1\}^2$ appropriate, if $q|1+a+b,p|b-a$, and denote the set of appropriate pairs by $\Theta$.

We partition the sum over appropriate pairs in $(\heartsuit)$ onto three parts, over the sets $\Omega_1,\Omega_2,\Omega_3$, where \begin{align*} \Omega_1&:=\{(a,b)\in \Theta:(q-p)/2\leqslant a\leqslant pq-1,(q+p)/2\leqslant b\leqslant pq-1\}\\ \Omega_2&:=\{(a,b)\in \Theta:0\leqslant a<(q-p)/2\}\\ \Omega_3&:=\{(a,b)\in \Theta:0\leqslant b<(q+p)/2\}. \end{align*} Note that the sets $\Omega_1$, $\Omega_2$ and $\Omega_3$ are disjoint (for a pair $(a,b)$ enjoying both inequalities $0\leqslant a<(q-p)/2$ and $0\leqslant b<(q+p)/2$ we have $0<a+b+1<q$, thus it is not appropriate).

The main idea is that on $\Omega_1$ there exists a sign-reversing involution $(a,b)\to (pq-1+(q-p)/2-a,pq-1+(q+p)/2-b)$, which preserves being an appropriate pair but changes the parity of $a+b$.

On $\Omega_2$, we must have $b=q-1-a+m\cdot q$ for $m\in \{0,1,\ldots,p-1\}$ (since $b\equiv q-1-a\pmod q$) and $m=m(a)$ is chosen so that $q-1-2a+m(a)q$ is divisible by $p$, there exists unique such $m(a)$, and $(-1)^{a+b}=(-1)^{m(a)}$.

Analogously, on $\Omega_3$, we must have $a=q-1-b+m(b)\cdot q$, and $(-1)^{a+b}=(-1)^{m(b)}$. Thus, the sum over $\Omega_2$ and $\Omega_3$ is nothing but $$\sum_{a=0}^{(q-p)/2-1}(-1)^{m(a)}+\sum_{b=0}^{(q+p)/2-1}(-1)^{m(b)}. $$
Now note that $m((q-1)/2)=0$ and for $0\leqslant a<q$, $a\ne (q-1)/2$, we have $m(a)+m(q-1-a)=p$. Thus, the sum of $(-1)^{m(a)}$ for $a\in [(q-p)/2,(q+p)/2-1]$ (this set is symmetric with respect to $(q-1)/2$, so we may partition it onto $\{(q-1)/2\}$ and pairs with sum $q-1$) equals $1$. Therefore, our sum equals $$ 1+2\sum_{a=0}^{(q-p)/2-1} (-1)^{m(a)}\leqslant 1+(q-p). $$

There is a short way to take out trigonometry and remain with the sum of $\pm 1$, similar (but not immediately equivalent, see later) to these appearing in the Christophe Leuridan and Alexander Kalmynin's solution: $$\sum \frac{2}{\cos(\frac{2m\pi}{p})+\cos(\frac{2n\pi}{q})}=\sum_{x^q=y^p=1}\frac4{x+1/x+y+1/y}\\=\sum_{x^q=y^p=1}\frac{4x}{(1+x/y)(1+xy)}=\sum_{x^q=y^p=1}\frac{x(1+(x/y)^{pq})(1+(xy)^{pq})}{(1+x/y)(1+xy)}\\ =\sum_{x^q=y^p=1}x\sum_{a=0}^{pq-1}(-1)^a(x/y)^a\sum_{b=0}^{pq-1}(-1)^b(xy)^b\\=pq\sum_{0\leqslant a,b\leqslant pq-1,q|1+a+b,p|b-a}(-1)^{a+b},$$ since the summation of a single monomial $x^A y^B$ over $\{x^q=y^p=1\}$ gives $pq$ when $q|A$ and $p|B$ and 0 otherwise.

Thus, an equivalent reformulation of the inequality is $$ M:=\sum_{0\leqslant a,b\leqslant pq-1,q|1+a+b,p|b-a}(-1)^{a+b}\leqslant |p-q|+1.\tag{$\heartsuit$} $$ I include the prove of $(\heartsuit)$, it is short and elementary but, as for me, not trivial. Without Sasha's answer I would think longer about this. We may assume (from the very beginning) that $q>p$. Call a pair $(a,b)\in \{0,1,\ldots,pq-1\}^2$ appropriate, if $q|1+a+b,p|b-a$, and denote the set of appropriate pairs by $\Theta$.

We partition the sum over appropriate pairs in $(\heartsuit)$ onto three parts, over the sets $\Omega_1,\Omega_2,\Omega_3$, where \begin{align*} \Omega_1&:=\{(a,b)\in \Theta:(q-p)/2\leqslant a\leqslant pq-1,(q+p)/2\leqslant b\leqslant pq-1\}\\ \Omega_2&:=\{(a,b)\in \Theta:0\leqslant a<(q-p)/2\}\\ \Omega_3&:=\{(a,b)\in \Theta:0\leqslant b<(q+p)/2\}. \end{align*} Note that the sets $\Omega_1$, $\Omega_2$ and $\Omega_3$ are disjoint (for a pair $(a,b)$ enjoying both inequalities $0\leqslant a<(q-p)/2$ and $0\leqslant b<(q+p)/2$ we have $0<a+b+1<q$, thus it is not appropriate).

The main idea is that on $\Omega_1$ there exists a sign-reversing involution $(a,b)\to (pq-1+(q-p)/2-a,pq-1+(q+p)/2-b)$, which preserves being an appropriate pair but changes the parity of $a+b$.

On $\Omega_2$, we must have $b=q-1-a+m\cdot q$ for $m\in \{0,1,\ldots,p-1\}$ (since $b\equiv q-1-a\pmod q$) and $m=m(a)$ is chosen so that $q-1-2a+m(a)q$ is divisible by $p$, there exists unique such $m(a)$, and $(-1)^{a+b}=(-1)^{m(a)}$.

Analogously, on $\Omega_3$, we must have $a=q-1-b+m(b)\cdot q$, and $(-1)^{a+b}=(-1)^{m(b)}$. Thus, the sum over $\Omega_2$ and $\Omega_3$ is nothing but $$\sum_{a=0}^{(q-p)/2-1}(-1)^{m(a)}+\sum_{b=0}^{(q+p)/2-1}(-1)^{m(b)}. $$
Now note that $m((q-1)/2)=0$ and for $0\leqslant a<q$, $a\ne (q-1)/2$, we have $m(a)+m(q-1-a)=p$. Thus, the sum of $(-1)^{m(a)}$ for $a\in [(q-p)/2,(q+p)/2-1]$ (this set is symmetric with respect to $(q-1)/2$, so we may partition it onto $\{(q-1)/2\}$ and pairs with sum $q-1$) equals $1$. Therefore, $$ M=1+2\sum_{a=0}^{(q-p)/2-1} (-1)^{m(a)}\leqslant 1+(q-p), $$ with equality of and only if $m(a)$ is even for all $a=0,1,\ldots,(q-p)/2-1$.

added 28 characters in body
Source Link
Fedor Petrov
  • 108.9k
  • 9
  • 264
  • 459
Loading
added 1917 characters in body
Source Link
Fedor Petrov
  • 108.9k
  • 9
  • 264
  • 459
Loading
Source Link
Fedor Petrov
  • 108.9k
  • 9
  • 264
  • 459
Loading