📄 chap2.tex
字号:
%Chapter 2 of Concrete Mathematics% (c) Addison-Wesley, all rights reserved.\input gkpmac\refin bib\refin chap5\pageno=21\beginchapter 2 Sums"SUMS" ARE EVERYWHERE in mathematics, so we need basic tools to handle them.This chapter developsthe notation and general techniquesthat make summation user-friendly.\beginsection 2.1 NotationIn Chapter 1 we encountered the sumof the first~$n$ integers, which we wrote out as$1+2+3+\cdots+(n-1)+n$.The `$\,\cdots\,$' in such formulastells us to complete the pattern establishedby the surrounding terms.Of course we have to watch out for sums like $1 + 7 + \cdots + 41.7$,which are meaningless without a mitigating context.On the other hand, the inclusion of terms like $3$ and $(n-1)$ was abit of overkill; the pattern would presumably have been clear if wehad written simply $1+2+\cdots+n$. Sometimes we might even be so bold as to writejust $1+\cdots+n$.We'll be working with sums of the general form\begindisplaya_1 + a_2 + \cdots + a_n \,,\eqno\eqref|3dots-sum|\enddisplaywhere each $a_k$ is a numberthat has been defined somehow.This notation has the advantage that we can ``see'' the whole sum,"!..." "!three dots (...)" "!ellipsis (...)"almost as if it were written out in full, if we have a good enough imagination. Each element~$a_k$of a sum is called a {\it "term"}.\g A term is how long this course lasts.\gThe terms are often specified implicitly as formulasthat follow a readily perceived pattern, and in such cases we must sometimeswrite them in an expanded formso that the meaning is clear. For example, if\begindisplay1+2+\cdots+2^{n-1}\enddisplayis supposed to denote a sum of $n$ terms, not of $2^{n-1}$, we shouldwrite it more explicitly as\begindisplay2^0+2^1+\cdots+2^{n-1}.\enddisplayThe three-dots notation\g \noindent\llap{``}Le signe $\sum_{i=1}^{i=\infty}$ indique que l'on~doitdonner au nombre entier $i$ toutes ses valeurs $1$, $2$, $3$, \dots,et prendre la somme des termes.''\par\noindent\hfill\dash---J. "Fourier" [|fourier|]\ghas many uses, but it can be ambiguous and a bitlong-winded. Other alternatives are available, notably the delimited form\begindisplay\sum_{k=1}^n a_k\,,\eqno\eqref|delim-sum|\enddisplay\looseness=-1which is called "Sigma-notation"because it uses the Greek letter $\sum$ (uppercase sigma).This notation tells us to include in the sum preciselythose terms~$a_k$ whose index~$k$ is an integer that liesbetween the lower and upper limits 1~and~$n$, inclusive.In words, we ``sum over $k$, from~$1$ to~$n$.''Joseph Fourier introduced this delim\-ited $\sum$-"notation" in 1820,and it soon took the mathematical world by storm.Incidentally,the quantity after $\sum$ (here~$a_k$) is called the {\it "summand"}. The "index variable"~$k$is said to be {\it bound\/} to the $\sum$ sign in \thiseq, because the"!bound variables"$k$ in $a_k$ is unrelated to appearances of~$k$ outside the Sigma-notation.Any other letter\g Well, I wouldn't want to use $a$ or $n$ as the index variable instead of~$k$in \thiseq; those letters are ``"free variables"'' that do have meaning outsidethe $\sum$ here.\gcould be substituted for~$k$ here without changing themeaning of \thiseq. The letter $i$ is often used (perhaps because it standsfor ``index''), but we'll generally sum on $k$ since it's wise to keep$i$ for $\sqrt{-1}$.It turns out that a generalized Sigma-notation is evenmore useful than the delimited form: We simply write one or moreconditions under the $\sum$, to specify the set of indices over whichsummation should take place. For example, the sums in \eq(|3dots-sum|) and\eq(|delim-sum|) can also be written as\begindisplay\sum_{1 \le k \le n} a_k \,.\eqno\eqref|gen-sum|\enddisplayIn this particular example there isn't much difference between thenew form and \eq(|delim-sum|), but the general form allows us totake sums over "index set"s that aren't restricted to consecutive integers.For example, we can express the sum of the squares of all odd positiveintegers below~100 as follows:\begindisplay \sum\twoconditions{1 \le k < 100}{k \rm\ odd} k^2 \,\,.\enddisplayThe delimited equivalent of this sum,\begindisplay \sum_{k=0}^{49} (2k+1)^2 \,,\enddisplayis more cumbersome and less clear.Similarly, the sum of reciprocals of all prime numbers between $1$ and~$N$is\begindisplay\sum\twoconditions{p \leq N}{p \rm\ prime}{1\over p} \,;\enddisplaythe delimited form would require us to write\begindisplay\sum_{k=1}^{\pi(N)}{1\over p_k}\,,\enddisplaywhere $p_k$ denotes the $k$th prime and $\pi(N)$ is the number ofprimes $\le N$.(Incidentally, this sum gives the approximate averagenumber of distinct "prime factors" of a random integer near~$N$, sinceabout $1/p$ of those integers are divisible by~$p$.Its value for large~$N$ is approximately $\ln\ln N+M$, where$M\approx0.2614972128476427837554268386086958590515666$ is "Mertens"'sconstant~[|mertens-M|];$\ln x$ stands for the natural logarithm of~$x$, and $\ln\ln x$ standsfor $\ln(\ln x)$.)The biggest advantage of general Sigma-notation is thatwe can manipulate it more easily than the delimited form.\g The summation symbol looks like a distorted pacman.\gFor example, suppose we want to change the index variable~$k$ to~$k+1$.With the general form, we have\begindisplay \sum_{1 \leq k \leq n} a_k = \sum_{1 \leq k+1 \leq n} a_{k+1} \,;\enddisplayit's easy to see what's going on, and we can do the substitution almostwithout thinking. But with the delimited form, we have\begindisplay \sum_{k=1}^n a_k = \sum_{k=0}^{n-1} a_{k+1} \,;\enddisplayit's harder to see what's happened, and we're more likely to make a mistake.On the other hand, the delimited form isn't completely useless.It's nice and tidy, and we can write it quickly because \eq(|delim-sum|)\g A tidy sum.\ghas seven symbols compared with \eq(|gen-sum|)'s eight.Therefore we'll often use $\sum$ with upper and lower delimiterswhen we state a problem or present a result, but we'llprefer to work with relations-under-$\sum$ when we're manipulating a sumwhose index variables need to be transformed.The $\sum$ sign occurs more than 1000 times in this book,\g That's nothing. You should see how many times {\char6} appearsin The~Iliad.\g so we should besure that we know exactly what it means. Formally, we write\begindisplay\sum_{P(k)}a_k\eqno\enddisplayas an abbreviation for the sum of all terms $a_k$ such that $k$ is aninteger satisfying a given "property" $P(k)$. (A ``property $P(k)$'' isany statement about $k$ that can be either true or false.) For the time being, we'llassume that only finitely many integers~$k$ satisfying~$P(k)$ have$a_k\ne0$; otherwise infinitely many nonzero numbers are being addedtogether, and things can get a bit tricky. At the other extreme, if$P(k)$ is false for all integers~$k$, we have an ``empty'' sum;the value of an "empty sum" is defined to be zero.A slightly modified formof \thiseq\ is used when a sum appears within the text of a paragraphrather than in a displayed equation: We write `$\sum_{P(k)}a_k$', attachingproperty~$P(k)$ as a subscript of~$\sum$, so that the formula won'tstick out too much. Similarly, `$\sum_{k=1}^na_k$' is a convenientalternative to \eq(|delim-sum|) when we want to confine the notationto a single line.People are often tempted to write\begindisplay\advance\abovedisplayskip-3pt\advance\belowdisplayskip-3pt\sum_{k=2}^{n-1}k(k-1)(n-k)\qquad\hbox{instead of} \qquad\sum_{k=0}^{n}k(k-1)(n-k)\enddisplaybecause the terms for $k=0$, $1$, and $n$ in this sum are zero. Somehow itseems more efficient to add up $n-2$ terms instead of $n+1$ terms.But such temptations should be resisted; "efficiency" of computation isnot the same as efficiency of understanding! We will find it advantageousto keep upper and lower boundson an index of summation as simple as possible, becausesums can be manipulated much more easily when the boundsare simple. Indeed, the form $\sum_{k=2}^{n-1}$ can even be dangerouslyambiguous, because its meaning is not at all clear when $n=0$ or $n=1$(see exercise~|backward-delim|). Zero-valued terms cause no harm, and they often"!0, not considered harmful"save a lot of trouble.So far the "notation"s we've been discussing are quite standard, but now weare about to make a radical departure from tradition. Kenneth~E. "Iverson"introduced a wonderful idea in his programming language APL[|APL|, page~11; see also |knuth-tnn|],and we'll see that it greatly simplifies many of the things we want todo in this book. The idea is simply to enclose a true-or-false statementin brackets, and to say that the result is $1$ if the statement is true,\tabref|nn:iverson|%\g Hey: The ``"Kronecker delta"'' that I've seen in otherbooks (I~mean $\delta_{kn}$, which is$1\mskip-1mu$~if $@{k=n}$, \ $0$~otherwise) is just a special case of Iverson'sconvention: We can write $\[k=n]$ instead.\g$0$ if the statement is false. For example,\begindisplay\[p{\rm\ prime}] =\cases{1,&if $p$ is a prime number;\cr 0,&if $p$ is not a prime number.\cr}\enddisplayIverson's convention allows us to express sums with no constraints whateveron the index of summation, because we can rewrite \thiseq\ in the form\begindisplay \advance\belowdisplayskip-3pt\sum_k a_k\bigi[P(k)\bigr]\,.\eqno\enddisplayIf $P(k)$ is false, the term $a_k\bigi[P(k)\bigr]$ is zero, so we cansafely include it among the terms being summed. This makes it easy tomanipulate the index of summation, because we don't have to fusswith boundary conditions.\g\noindent\llap{``}I am often surprised by new, important applications [of this notation].''\par\hskip0pt plus 1fill minus 3pt\dash---B.~de~"Finetti"~[|de-finetti|]\looseness=-1\gA slight technicality needs to be mentioned: Sometimes $a_k$ isn't definedfor all integers~$k$. We get around this difficulty by assuming that $\bigi[P(k)\bigr]$is ``very strongly zero'' when $P(k)$ is false; it's so much zero, it makes"!zero, strongly"$a_k\bigi[P(k)\bigr]$ equal to zero even when $a_k$ is undefined.For example, ifwe use Iverson's convention to write the sum of reciprocal primes $\le N$ as\begindisplay\sum_p\[p{\rm\ prime}]\[p\le N]/p\,,\enddisplaythere's no problem of division by zero when $p=0$, because our conventiontells us that $\[0{\rm\ prime}]\[0\le N]/0=0$.Let's sum up what we've discussed so far about sums. There are twogood ways to express a sum of terms: One way uses `$\,\cdots\,$', theother uses `$\,\sum\,$'. The three-dots form often suggests usefulmanipulations, particularly the combination of adjacent terms, since wemight be able to spot a simplifying pattern if we let the whole sumhang out before our eyes. But too much detail can also be overwhelming.Sigma-notation is compact, impressive to family and friends, and\g\dots\ and it's less likely to lose points on an exam for ``lackof rigor.\qback''\goften suggestive of manipulations that are not obvious in three-dots form.When we work with Sigma-notation, zero terms are not generally harmful;"!0, not considered harmful"in fact, zeros often make $\sum$-manipulation easier.\beginsection 2.2 Sums and RecurrencesOK, we understand now how to express sums with fancy notation.But how does a person actually go about finding the value of a sum?One way is to observe that there's an intimate relation betweensums and "recurrence"s. The sum\begindisplayS_n=\sum_{k=0}^n a_k\enddisplayis equivalent to the recurrence\g(Think of\/ $S_n$ as not just a single number, but as asequence defined for all $n\ge0$.)\g\begindisplay\eqalign{S_0&=a_0\,;\cr S_n &= S_{n-1} + a_n\,, \qquad\hbox{for $n>0$.}\cr}\eqno\eqref|sum-rec|\enddisplayTherefore we can evaluate sums in closed form by using the methodswe learned in Chapter~1 to solve recurrences in closed form.For example, if $a_n$ is equal to a constant plus a multiple of~$n$,the sum-recurrence \eq(|sum-rec|) takes the following general form:\begindisplay\eqalign{R_0&=\alpha\,;\cr R_n &= R_{n-1} + \beta + \gamma n\,, \qquad\hbox{for $n>0$.}\cr}\eqno\eqref|abc-rec|\enddisplayProceeding as in Chapter 1, we find $R_1=\alpha+\beta+\gamma$,$R_2=\alpha+2\beta+3\gamma$, and so on; in general the solution can bewritten in the form\begindisplayR_n=A(n)@\alpha+B(n)@\beta+C(n)@\gamma\,,\eqno\enddisplaywhere $A(n)$, $B(n)$, and $C(n)$ are the coefficients of dependence onthe general parameters $\alpha$, $\beta$, and $\gamma$.The "repertoire method" tells us to try plugging in simple functions of~$n$ for$R_n$, hoping to find constant parameters $\alpha$, $\beta$, and $\gamma$where the solution is especially simple.Setting $R_n=1$ implies $\alpha=1$, $\beta=0$, $\gamma=0$; hence\begindisplayA(n)=1\,.\enddisplaySetting $R_n=n$ implies $\alpha=0$, $\beta=1$, $\gamma=0$; hence\begindisplayB(n)=n\,.\enddisplaySetting $R_n=n^2$ implies $\alpha=0$, $\beta=-1$, $\gamma=2$; hence\begindisplay2C(n)-B(n)=n^2\enddisplayand we have $C(n)=(n^2+n)/2$. Easy as pie.\g Actually easier;~$\pi\,{=}\kern-4pt$\smallskip\hskip-\mathsurround$\sum_{n\ge0}\kern-1.8pt{8\over(4n+1)(4n+3)}$\kern-1pt.\kern-3.5pt\null\gTherefore if we wish to evaluate\begindisplay\sum_{k=0}^n(a+bk)\,,\enddisplaythe sum-recurrence \eq(|sum-rec|) boils down to \eq(|abc-rec|) with
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -