Data Structures and algorithm analysis—1.2.4&1.2.5Modular Arithmeti&The P Word(数据结构—模数运算&P字)

1.2.4. Modular Arithmetic

1.2.4.模数运算

     We say that a is congruent to b modulo n, written a b(mod n), if n divides a - b.Intuitively, this means that the remainder is the same when either a or b isdivided by n. Thus, 81 61 1(mod 10). As with equality, if a b (mod n), then a +c b + c(mod n) and adbd( mod n).

     我们说a恒等于b对n求模,写成a b(mod n)(a同余于b模n,或读作a与b关于模m同余),如果n能整除a-b。直观地说,意思就是当a或b被n除的时候,它们的余数相同。例如, 81 61 1(mod 10)。等价的,如果 a b (mod n),那么a + c b + c(mod n)和ad bd (mod n)。


There are a lot of theorems that apply to modular arithmetic, some of which require extraordinary proofs in number theory. Wewill use modular arithmetic sparingly, and the preceding theorems will suffice.

有很多适用于模数运算的定理,有些在数论中证明的很巧妙。我们用到模数运算不多,前面的那些定理就够用了。

1.2.5. The P Word

1.2.5.证明方法

     The two most common ways of proving statements in data structure analysis are proof by induction and proof by contradiction (and occasionally a proof by intimidation, by professors only). The best way of proving that a theorem is false is by exhibiting a counter example.

     数据结构中两个最常见的证明方法是归纳证明法和反证法(只有教授偶尔使用归谬法)。证明一个定理错误的最好的方法是举反例。

Proof by Induction

归纳法证明

A proof by induction has two standard parts. The first step is proving a base case,that is, establishing that a theorem is true for some small (usually degenerate) value(s); this step is almost always trivial. Next, an inductive hypothesis is assumed. Generally this means that the theorem is assumed to betrue for all cases up to some limit k. Using this assumption, the theorem is then shown to be true for the next value, which is typically k + 1. This proves the theorem (as long as k is finite).

归纳法证明由标准的两步构成。第一步是证明基本的情况,确定一个定理对一小部分值成立;这一步是琐细的。下一步,一个归纳的假设是假定的。通常情况下这就意味着到k为止的所有情况下假设都是成立的。使用这个假设,证明接下来的k+1值对于这个假设也是成立的。定理可证(只要k是有限的)。

     As an example, we prove that the Fibonacci numbers,satisfy。(Some definitions have F0 = 0, which shifts the series.) To do this, we first verify that the theorem is true for the trivial cases.It is easy to verify that F1 = 1 < 5/3 and F2 = 2。We assume that the theorem is true for i = 1, 2, . . . , k; this is the inductive hypothesis. To prove the theorem, we need to show that。We have,by the definition, and we can use the inductive hypothesis on the right-hand side, obtaining

  

which simplifies to


proving the theorem.

      举个例子,我们证明斐波那契数列,,满足。(有一些定义改变了这个数列,设置了F0=0)。为了这名这个定理,我们首先证明这个定理适用于琐细的情况。证明F1 = 1 < 5/3 和F2 = 2是简单的。我们假设这个定理适用于i = 1, 2, . . . , k;这是归纳假设。为了证明这个定理,我们需要证明(1是加于k上的)。我们有,通过定义,我们把这个归纳假设用在等号右边,得到

化简为

定理可证。

 

     As asecond example, we establish the following theorem.

     第二个例子,我们证明下一个定理。

 

THEOREM 1.3.


PROOF:

证明:

     The proof is by induction. For the basis, it is readily seen that the theorem is true when n = 1. For the inductive hypothesis, assume that the theorem is true for. We will establish that, under this assumption, the theorem is true for n + 1. We have

Applying the inductive hypothesis, we obtain

Thus,

proving the theorem.

   用归纳法证明。首先,当n=1时,定理显然成立。假设这个定理对于都是成立的。我们将证明这个定理在这个假设的情况下对于n+1也是成立的。我们有

根据这个归纳假设,可以得到

因此,

Proof by Counterexample

举反例法证明

     The statement is false.The easiest way to prove this is to compute

       是错误的。最简单的证明方法就是估计

Proof by Contradiction

反证法

     Proof by contradiction proceeds by assuming that the theorem is false and showing that this assumption implies that some known property is false, and hence theoriginal assumption was erroneous. A classic example is the proof that there is an infinite number of primes. To prove this, we assume that the theorem is false, so that there is some largest prime,Let be all the primes in order and consider。Clearly, N is larger than , so by assumption N is not prime. However, none of divide N exactly, because there will always be a remainder of 1. This is a contradiction, because every number is either prime or a product of primes.Hence, the original assumption, that pk is the largest prime, is false, which implies that the theorem is true.


       反证法通过假设这个定理是错的来进行的,证明这个假设就意味着证明一些已知条件是错的,从而假设是错误的。一个典型的例子就是证明有无穷多个质数。为了证明,我们假设这个定理是错误的,所以就有最大的质数,使得是按顺序排列的所有的质数并且令。很明显,N比大,所以根据假设,N不是质数。事实上,没有一个数能整除N,因为总有一个余数1.这就是反证,因为每一个数都是质数或者质数的乘积。因此,最初的假设:是最大的质数是错误的,证明了定理是正确的。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值