I learned Geometric Sequence and Arithmetic Sequence in my senior high school. And as a programmer I found them very useful when calculating the time complex of an algorithm. But the theorem related to them are easily forgotten, so I tried to prove them in order to memorize them better.
Sum of Geometric Sequence
A sequence of items:
a1,a2,a3,...,an
where
ak=ak−1∗r
(
r is called
common ratio) is called
geometric sequence. To get sum of which
Sn=a1+a2+a3+...+an
(1)Sn(2)Sn+1(3)Sn∗r=a1+a1∗r1+a1∗r2+...+a1∗rn−1=a1+a1∗r1+a1∗r2+...+a1∗rn−1+a1∗rn=Sn+a1∗rn=a1∗r1+a1∗r2+...+a1∗rn−1+a1∗rn
(2) - (1) will give us:
(4)Sn+1−Sn=a1∗rn
(2) - (3) will give us:
(5)Sn+1 −Sn∗r=a1
That is two variables in two equations, (4) - (5) will give us
Sn∗r−SnSn=a1∗rn−a1=(a1∗rn−a1)/(r−1)=a1(rn−1)/(r−1)
Sum of Arithmetic Sequence
A sequence of items:
a1,a2,a3,...,an
where
ak=ak−1+d
(d is called
common difference) is called
arithmetic sequence. To get sum of which
Sn=a1+a2+a3+...+an
We have:
(1)Sn=a1+a2+a3+...+an(2)Sn=an+an−1+an−2+...+a1
(1) + (2) will give us:
(3)2∗Sn=(a1+an)+(a2+an−1)+(a3+an−2)+...+(an+a1)
As
ak=ak−1+d=ak−2+d∗2=...=a1+d∗(k−1)
we have:
ak+al=2∗a1+d(k+l−2)
That is as lone as
k+lis the same,
ak+alwill be the same. So (3) can be expand as
2∗SnSn=(a1+an)∗n=(a1+an)∗n/2
0 评论:
Post a Comment