zoukankan      html  css  js  c++  java
  • An interesting combinational problem

    A question of details in the solution at the end of this post of the question is asked by me at MSE

    Nowadays, I learnt from Liu Ben a question asked in the interview of ENS. 

    Assume $m,n$ are two coprime odd numbers, consider the interval $[0,mn]$. We cut the interval by $m,2m,ldots,(n-1)m$ and $n, 2n,ldots, (m-1)n$ into $m+n-1$ pieces of small intervals. And we color them from left to right by black-and-white periodically and black first. The question is to show $$( extrm{the length of black})-( extrm{the length of white})=1$$

    For example, if $m=3,n=5$, $$egin{array}{c*{31}}0 &&&&&& 3 &&&&&& 6 &&&&&& 9 &&&&&& 12 &&&&&& 15 \ mid & lacksquare && lacksquare && lacksquare &mid & square && square & mid  & lacksquare & mid  & square&& square&& square &mid & lacksquare &mid & square&& square&mid & lacksquare&& lacksquare&& lacksquare & mid  \ 0 &&&&&&&&&& 5 &&&&&&&&&& 10 &&&&&&&&&& 15end{array} $$The length of black is $8$ and the length of white is $7$.  

    The problem seems to be elementary at the first sight. But after a period of thinking, one find it is hard to deal with. Here is Liu Ben's Original answer, I fulfill details to read more easily, 

    The number of cuts before $x$ is $lfloor frac{x-1}{n} floor+lfloor frac{x-1}{m} floor$, so $$(-1)^{lfloor frac{x-1}{n} floor+lfloor frac{x-1}{m} floor}=egin{cases} 1 & extrm{$[x-1,x]$ is colored by black }\ -1 &  extrm{$[x-1,x]$ is colored by white } end{cases}$$Thus it is equivlent to show that $sum_{x=0}^{mn-1} (-1)^{lfloor frac{x}{n} floor+lfloor frac{x}{m} floor}=1$, and we have know that $(-1)^{m+n}=1, (-1)^0=1$, so  it is equivlent to show that $$sum_{x=1}^{mn} (-1)^{lfloor frac{x}{n} floor+lfloor frac{x}{m} floor}=1$$Now we need some identity to expand the expression $(-1)^{lfloor frac{x}{n} floor}$,

    $$egin{array}{rll} (-1)^{lfloor x floor}& = (-1)^{lfloor x floor}-1+1 \ & =1+ 2left(sum_{n=0}^{lfloor x floor}(-1)^{n} ight)= 1+ 2left(sum_{nleq x}(-1)^{n} ight)end{array}$$

    So 

    $$egin{array}{rll}&quad  sum_{x=1}^{mn} (-1)^{lfloor frac{x}{n} floor+lfloor frac{x}{m} floor} \  & =sum_{x=1}^{mn} left(1+2left(sum_{kleq x/n} (-1)^k ight) ight)left(1+2left(sum_{kleq x/m} (-1)^k ight) ight) \ & = mn+2underbrace{sum_{x=1}^{mn}sum_{kleq x/n} (-1)^k}_{:=A}+2underbrace{sum_{x=1}^{mn}sum_{kleq x/m} (-1)^k}_{:=B}+4sum_{x=1}^{mn}left(sum_{kleq x/n} (-1)^k ight)left(sum_{hleq x/m} (-1)^h ight)end{array}$$

    Firstly, we calculate $A$, 

    $$egin{array}{rll}A & =sum_{x=1}^{mn}sum_{kleq x/n} (-1)^k \ & = sum_{k=1}^m #{xgeq nk: x=1,ldots,mn}(-1)^k  \ & =sum_{k=0}^m n(m-k)(-1)^k \ & = nsum_{k=0}^m k(-1)^k\& =-nfrac{m+1}{2}end{array}$$

    Similarly, $B=-mfrac{n+1}{2}$, therefore it remains to show 

    $$sum_{x=1}^{mn}left(sum_{kleq x/n} (-1)^k ight)left(sum_{hleq x/m} (-1)^h ight)=frac{(m+1)(n+1)}{4}$$

    Let's compute ! 

    $$egin{array}{rll}sum_{x=1}^{mn}left(sum_{kleq x/n} (-1)^k ight)left(sum_{hleq x/m} (-1)^h ight) & =sum_{k=0}^{m}sum_{h=0}^n#{xgeq max (nk,mh), x=1,ldots,mn}(-1)^{k+h}\ & =sum_{k=0}^{m}sum_{h=0}^n(mn- max(nk,mh))(-1)^{k+h} \ & =sum_{k=0}^{m}sum_{h=0}^n max(nk,mh)(-1)^{k+h} \ & =sum_{k=0}^{m}sum_{h=0}^n frac{1}{2}(nk+mh+left|nk-mh ight|)(-1)^{k+h}  \ &= frac{1}{2}sum_{k=0}^{m}sum_{h=0}^n left|nk-mh ight|(-1)^{k+h} \ & = frac{mn}{2}sum_{k=0}^msum_{h=0}^nleft|frac{k}{m}-frac{h}{n} ight|(-1)^{k+h}end{array}$$

    So it reduces to show $sum_{k=0}^msum_{h=0}^nleft|frac{k}{m}-frac{h}{n} ight|(-1)^{k+h}=0$. We need some tools to calculate, consider the function $f$ with peroid $2$ and $f(x)=|x|$ for $xin [-1,1]$, then the Fourier series of $f$ is $$f=sum_{ell in mathbb{Z}} a_{ell} mathrm{e}^{frac{2pi i ell x}{2}}qquad a_{ell} =frac{1}{2}int_{-1}^1 |x| mathrm{e}^{frac{2pi i ell x}{2}} extrm{d}x=egin{cases}frac{1}{2} & n=0 \ -frac{2}{pi^2 n^2} & n extrm{is odd} \ 0 & n eq 0 extrm{is even}end{cases}$$

    In other word, we have 

    $$xin [-1,1]Rightarrow frac{1}{4}-frac{|x|}{2}=sum_{ell extrm{odd}} frac{1}{pi^2 ell ^2}mathrm{e}^{2pi i ell x}$$

    Now, continuous

    $$egin{array}{rll} frac{mn}{2}sum_{k=0}^msum_{h=0}^nleft|frac{k}{m}-frac{h}{n} ight|(-1)^{k+h} & = mn sum_{k=0}^msum_{h=0}^nfrac{left|frac{k}{m}-frac{h}{n} ight|}{2}(-1)^{k+h} \ & =mn sum_{k=0}^msum_{h=0}^nigg(frac{1}{4}-frac{left|frac{k}{m}-frac{h}{n} ight|(-1)^{k+h}}{2} igg) \ & = sum_{k=0}^m sum_{h=0}^n sum_{ell extrm{odd}} frac{1}{pi^2 ell ^2} mathrm{e}^{frac{2pi i}{2}cdot ell left(frac{k}{m}-frac{h}{n} ight)}  \  & =mnsum_{ell extrm{odd}} frac{1}{pi^2 ell^2 }left(sum_{k=0}^m (-1)^kmathrm{e}^{frac{2 pi i  ell k}{2 m }} ight)left(sum_{h=0}^n (-1)^hmathrm{e}^{-frac{2 pi i  ell h}{2 n }} ight)end{array}$$

    It reduces to the case of the summation of geometry series, we have 

    $$sum_{k=0}^m (-1)^kmathrm{e}^{frac{2 pi i  ell k}{2 m }}=egin{cases}-1& m mid ell \ -1+m & mmid ell end{cases}qquad sum_{h=0}^n (-1)^hmathrm{e}^{-frac{2 pi i  ell h}{2 n }} = egin{cases}-1& n mid ell \ -1+n & nmid ell end{cases}$$

    Now we can deduct the result, 

    $$egin{array}{rll} & quad mnsum_{ell extrm{odd}} frac{1}{pi^2 ell^2 }left(sum_{k=0}^m (-1)^kmathrm{e}^{frac{2 pi i  ell k}{2 m }} ight)left(sum_{h=0}^n (-1)^hmathrm{e}^{-frac{2 pi i  ell h}{2 n }} ight) \ & =mnsum_{ell extrm{odd}} frac{1}{pi^2 ell^2 } - mnsum_{egin{subarray}{l}ell extrm{odd}\ m|ell end{subarray}} frac{m}{pi^2 ell^2} - mnsum_{egin{subarray}{l}ell extrm{odd}\ n|ell end{subarray}} frac{n}{pi^2 ell^2} + mnsum_{egin{subarray}{l}ell extrm{odd}\ n|ell \ m|ell end{subarray}} frac{nm}{pi^2 ell^2} \ & = mnsum_{ell extrm{odd}} frac{1}{pi^2 ell^2 } - nsum_{egin{subarray}{l}ell extrm{odd}\ m|ell end{subarray}} frac{1}{pi^2 (ell/m)^2} - msum_{egin{subarray}{l}ell extrm{odd}\ n|ell end{subarray}} frac{1}{pi^2 (ell/n)^2} + sum_{egin{subarray}{l}ell extrm{odd}\ nmmid ell end{subarray}} frac{1}{pi^2 (ell/mn)^2} \ & =(m-1)(n-1) sum_{ell extrm{odd}} frac{1}{pi^2 ell^2 }  =frac{(m-1)(n-1)}{4}end{array}$$

    The proof is complete. $square$

    If we reflect the process above carefully, we will find that the trick of exponential sums is useful in the domain of combinatorics involving number theory. It is powerful but not too beutiful. The amazing point is that in the process of counting number, $pi$ can occur, even it will be cancelled finally. 

    Some days after, Liu Ben gives a new answer which uses Fourier analysis, it is more elegant than the above, and I fulfill details to read more easily, 

     Actually, as above it reduces to show $$int_0^{mn}(-1)^{lfloor frac{x}{n} floor+lfloor frac{x}{m} floor} extrm{d}x=int_0^{mn}(-1)^{lfloor frac{x}{n} floor}overline{(-1)^{lfloor frac{x}{m} floor}} extrm{d}x=1$$Conside $f(x)=(-1)^{lfloor x floor}$ as a function of period $2$, one can calculate its Fourier expansion$$f(x)=frac{2}{pi i}sum_{ell extrm{odd}}frac{1}{ell} mathrm{e}^{frac{2pi i ell x}{2}}$$So $$egin{array}{rll}int_0^{mn}(-1)^{lfloor frac{x}{n} floor}overline{(-1)^{lfloor frac{x}{m} floor}} extrm{d}x& =int_{0}^{mn}f(x/n)overline{f(x/m)} extrm{d}x \ & =mnint_0^1 f(ny)overline{f(my)} extrm{d}y \ & = frac{4 mn}{pi^2}sum_{egin{subarray}{l}r,s  extrm{odd} \ mr=nsend{subarray}}frac{1}{rs} \ & =  frac{4 mn}{pi^2}sum_{egin{subarray}{l}r,s  extrm{odd} \ r=tn,s=tmend{subarray}}frac{1}{rs} \ &  =frac{4}{pi^2}sum_{t extrm{odd}}frac{1}{t^2}=1end{array} $$The proof is complete. $square$

    To complete this post, I want to give my answer of this problem. I think this answer is the most ingenious one. This is a proof without words as following. 

    When I heared the problem, I had no papers and pen to use. After thinking over brokenly, I came up the answer above one day after. And one can easily find that in the case of one of $m,n$ is even, then the difference between black and white vanish, and when $m,n$ are odd generally, the difference is $(m,n)$. 

     

    Ackowlegement

    I want to thank Liu Ben for his nice presentation of question and answer. And congratulation to his addmision by ENS

     

    $square$
  • 相关阅读:
    6、CC2541修改按键调节广播发送功率例程为持续发送4DB的蓝牙基站
    [nRF51822] 16、nRF51822的随机数生成器,及随机数生成器的一些知识(可以帮您补补随机数发生器的知识)
    [PCB设计] 4、BAT脚本处理AD生成的GERBER文件为生产文件
    [异常解决] 奇巧淫技——VirtualBox中的linux无显示启动,并在win7上远程控制
    [PCB设计] 3、用CAM350修改GERBER文件(删除某些部分)
    [异常解决] Make nRF51 DFU Project Appear "fatal error: uECC.h: No such file or directory"
    [异常解决] How to build a gcc toolchain for nRF51 on linux (very detailed!!!)
    [异常解决] windows用SSH和linux同步文件&linux开启SSH&ssh client 报 algorithm negotiation failed的解决方法之一
    [模拟电路] 2、Passive Band Pass Filter
    Docker常用命令
  • 原文地址:https://www.cnblogs.com/XiongRuiMath/p/10356120.html
Copyright © 2011-2022 走看看