Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Draft

Views: 51
Kernel: Python 2 (SageMath)

Inequality proof

The setting in Silverman's book is the following: Let s=c1c2c3cn{\bf{s}} = c_1c_2c_3\dots c_n be a string of n alphabetic characters and let FiF_i be the frequency with which letter i appears in the string s\bf{s}.

Also, define IndCon(s):=1n(n1)i=025Fi(Fi1)IndCon({\bf{s}}) := \frac{1}{n\left(n-1\right)} \sum_{i=0}^{25} F_i \left(F_i -1\right).

Our setting will be a slightly more general. Instead of 25 letters, we assume there are kk letters. We would like to prove that (for k1k \geq 1) 1n(n1)i=0kFi(Fi1)1n(n1)i=0knk(nk1)=kn(n1)nk(nk1)i=0kFi(Fi1)knk(nk1)\begin{alignat}{2} \frac{1}{n\left(n-1\right)} &\sum_{i=0}^{\color{red}k} F_i \left(F_i -1\right) &&\geq \frac{1}{n\left(n-1\right)} \sum_{i=0}^{\color{red}k} \frac{n}{k} \left(\frac{n}{k} -1\right) = \frac{k}{n\left(n-1\right)} \frac{n}{k} \left(\frac{n}{k} -1\right) \\ \Leftrightarrow &\sum_{i=0}^{\color{red}k} F_i \left(F_i -1\right) &&\geq k \frac{n}{k} \left(\frac{n}{k} -1\right) \end{alignat}

The Left Hand side of the inequality corresponds to an arbitary distribution while the Right Hand side corresponds to the unifrom distribuation in which each letter occurs with an equal probability (completely random text).

Roughly Speaking

Let's see what happens in an extreme case. If F1=nF_1 = n and Fi=0, i1F_i = 0,\ i \not = 1 then what we want to show is n(n1)knk(nk1)n\left(n-1\right) \geq k \frac{n}{k} \left(\frac{n}{k} -1\right)

Since nn1n \approx n-1 we may repalce n1n-1 with nn, so, the last inequality becomes n2kn2k21kk2=1kk11n^2 \geq k \frac{n^2}{k^2} \Leftrightarrow 1 \geq \frac{k}{k^2} = \frac{1}{k} \Leftrightarrow k\cdot 1 \geq 1 .

Proof

Two letters (Prerequisite: Caculus I)

If the minimu value of the function f(F1,F2)=F1(F11)+F2(F21)f\left(F_1, F_2\right) = F_1\left(F_1 -1\right) + F_2\left(F_2 -1\right), where F1+F2=n, Fi[1,n]F_1 + F_2 = n{\bf,} \ F_i \in [1, n], occurs at F1=F2=n2F_1 = F_2 = \frac{n}{2} then we are done.

From the relation F1+F2=nF_1 + F_2 = n we can consider ff as a function in one variable, i.e. f(F1)=F1(F11)+(nF1)(nF11)f(F_1) = F_1\left(F_1 -1\right) + \left(n- F_1\right) \left(n - F_1 -1\right) It is easier to deal with functions of one variable instead of two.

From Calculus I we know ff attains the minimum value at the boundary points or on the critical points.

Finding the critical points

ddF1f=F1+F11(nF11)(nF1)=4F12n0=ddF1f4F12n=0F1=n2\frac{d}{dF_1} f = F_1 + F_1 -1 -\left(n- F_1 -1\right) - \left(n- F_1 \right) = 4F_1 - 2n \Rightarrow 0 = \frac{d}{dF_1} f \Leftrightarrow 4F_1 -2n = 0 \Leftrightarrow F_1 = \frac{n}{2}. Thus,there is, only, one critical poitn F1=n2F_1 = \frac{n}{2}

Computing the global minimum/maximum

F1F_10n2\frac{n}{2}n
f(F1)f(F_1)n(n1)n\left(n-1\right)2n2(n22)2\cdot \frac{n}{2}\left(\frac{n-2}{2}\right)n(n1)n\left(n-1\right)

As we can see the least value in the above table is 2n2(n22)2\cdot \frac{n}{2}\left(\frac{n-2}{2}\right) which corresponds to F1=F2=n2F_1 = F_2 = \frac{n}{2} , as required!

Three letters or more (Calculus III)

Let f(F1,F2,,Fk)=iFi(Fi1)f\left(F_1, F_2, \dots , F_k\right) = \sum_i F_i\left(F_i -1\right) subjects to g(F1,F2,,Fk)=(iFi)n g\left(F_1, F_2, \dots, F_k\right) = \left(\sum_i F_i\right) -n

We are interested in finding points that maximize/minimize ff. As in the case Two letters, if we show that the minimum occurs at F1=F2==FkF_1 = F_2 = \dots = F_k then we are done.

Recall: The method of Lagrange multipliers find the maximum/minimum when the gradient of a specific function equals to zero. Below a break down of the of the method which can be implemented in SageMath

  1. Compute (fλg)=F1(fλg)dF1+F2(fλg)dF2++Fk(fλg)dFk \nabla \cdot \left( f-\lambda g\right) = \frac{\partial}{\partial F_1}\left( f-\lambda g\right) dF_1 + \frac{\partial}{\partial F_2}\left( f-\lambda g\right) dF_2 + \dots + \frac{\partial}{\partial F_k}\left( f-\lambda g\right) dF_k where λ\lambda is an extra variable.

  2. Since dFidF_is are linearly independent then (fλg)=0F1(fλg)=0\nabla \cdot \left( f-\lambda g\right) = 0 \Leftrightarrow \frac{\partial}{\partial F_1}\left( f-\lambda g\right) = 0 for each ii

  3. Solve these equations to find the critical points

  4. Substitute each critical point (x1,x2,,xk)\left(x_1, x_2, \dots, x_k\right) in ff i.e. compute f(x1,x2,,xk)f\left(x_1, x_2, \dots, x_k\right) then record it in some set, say MM. The maximum or minimum value of ff subjects to the constraint gg must be in MM

1: For each variable F1,F2,,FkF_1, F_2, \dots, F_k we have Fif=Fi+Fi1=2Fi1\frac{\partial}{\partial F_i} f = F_i + F_i -1 = 2F_i -1 and Fiλg=λ\frac{\partial}{\partial F_i} \lambda \cdot g = \lambda

2: 2F11λ=0F1=1+λ22F21λ=0F2=1+λ22Fk1λ=0Fk=1+λ2iFi=n\begin{alignat}{2} &2F_1-1 - \lambda = 0 \Rightarrow F_1 = \frac{1+\lambda}{2}\\ &2F_2-1 - \lambda = 0 \Rightarrow F_2 = \frac{1+\lambda}{2}\\ &\vdots \\ &2F_k-1 - \lambda = 0 \Rightarrow F_k = \frac{1+\lambda}{2}\\ & \sum_i F_i = n \end{alignat}

3: Hence, Fi=FjF_i = F_j for all i,ji, j. . If we find the value of F1F_1 then we found all FiF_is value, since they are equal to each other. Using the last result, iFi=F1i1=nF1=F2==Fk=nk\sum_i F_i = F_1 \sum_i 1 = n \Rightarrow F_1= F_2= \dots= F_k = \frac{n}{k}

4: f(nk,nk,,nk)=knk(nk1)=n(nk1)f\left(\frac{n}{k},\frac{n}{k}, \dots, \frac{n}{k}\right) = k \frac{n}{k} \left(\frac{n}{k} -1\right) = n \left(\frac{n}{k} -1\right) . We know that n(nk1) n \left(\frac{n}{k} -1\right) is an extreme value, but we don't know whether it is a minimum value or not. Let us plug in ff with any other point. For instance, F1=n,Fi=0,ijF_1 = n, F_i = 0, i\not = j then it is clear that n(n1)n(nk1)nnkn\left(n-1\right) \geq n \left(\frac{n}{k} -1\right) \Leftrightarrow n\geq \frac{n}{k} since it is an extreme point then it must be the minimum of ff under the constraint gg

We found that the minimum value n(nk1) n \left(\frac{n}{k} -1\right) occurs at F1=F2==FkF_1 = F_2 = \dots = F_k Q.E.D