本文主要是介绍【组合数学题解】利用m²=2C(m,2)+C(m,1)求1²+2²+···+n²的值,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
这道题我在网上没有找到满意的解答,自己也懒得找教材有没有配套的答案,所以把解题过程记录在这里了(没有和老师对答案,不管是不是出题人想要的过程反正是利用组合数学的知识求出来了)。
题目:
利用 m 2 = 2 ( m 2 ) + ( m 1 ) m^2=2 \left( \begin{array}{lc} m\\ 2 \end{array} \right) + \left( \begin{array}{lc} m\\ 1 \end{array} \right) m2=2(m2)+(m1)
求 1 2 + 2 2 + ⋅ ⋅ ⋅ + n 2 1^2+2^2+···+n^2 12+22+⋅⋅⋅+n2的值.
首先看常规解法(即不用组合数学的方法):
解:
step1
:先将 m 2 m^2 m2对应的组合式代入 1 2 + 2 2 + ⋅ ⋅ ⋅ + n 2 1^2+2^2+···+n^2 12+22+⋅⋅⋅+n2.
1 2 + 2 2 + ⋅ ⋅ ⋅ + n 2 = 2 ( 1 2 ) + ( 1 1 ) + 2 ( 2 2 ) + ( 2 1 ) + 2 ( 3 2 ) + ( 3 1 ) + ⋅ ⋅ ⋅ + 2 ( n 2 ) + ( n 1 ) = 2 ( ( 1 2 ) + ( 2 2 ) + ⋅ ⋅ ⋅ + ( n 2 ) ) + ( ( 1 1 ) + ( 2 1 ) + ⋅ ⋅ ⋅ + ( n 1 ) ) 1^2+2^2+···+n^2=2 \left( \begin{array}{lc} 1\\ 2 \end{array} \right) + \left( \begin{array}{lc} 1\\ 1 \end{array} \right) +2 \left( \begin{array}{lc} 2\\ 2 \end{array} \right) + \left( \begin{array}{lc} 2\\ 1 \end{array} \right) +2 \left( \begin{array}{lc} 3\\ 2 \end{array} \right) + \left( \begin{array}{lc} 3\\ 1 \end{array} \right) +···+2 \left( \begin{array}{lc} n\\ 2 \end{array} \right) + \left( \begin{array}{lc} n\\ 1 \end{array} \right)\\ =2\left( \begin{array}{lc} \left( \begin{array}{lc} 1\\ 2 \end{array} \right)+ \left( \begin{array}{lc} 2\\ 2 \end{array} \right)+···+ \left( \begin{array}{lc} n\\ 2 \end{array} \right) \end{array} \right)+ \left( \begin{array}{lc} \left( \begin{array}{lc} 1\\ 1 \end{array} \right)+ \left( \begin{array}{lc} 2\\ 1 \end{array} \right)+···+ \left( \begin{array}{lc} n\\ 1 \end{array} \right) \end{array} \right) 12+22+⋅⋅⋅+n2=2(12)+(11)+2(22)+(21)+2(32)+(31)+⋅⋅⋅+2(n2)+(n1)=2((12)+(22)+⋅⋅⋅+(n2))+((11)+(21)+⋅⋅⋅+(n1))
step2
:对于后半部分 ( ( 1 1 ) + ( 2 1 ) + ⋅ ⋅ ⋅ + ( n 1 ) ) \left( \begin{array}{lc} \left( \begin{array}{lc} 1\\ 1 \end{array} \right)+ \left( \begin{array}{lc} 2\\ 1 \end{array} \right)+···+ \left( \begin{array}{lc} n\\ 1 \end{array} \right) \end{array} \right) ((11)+(21)+⋅⋅⋅+(n1))整理.
( ( 1 1 ) + ( 2 1 ) + ⋅ ⋅ ⋅ + ( n 1 ) ) = 1 + 2 + ⋅ ⋅ ⋅ + n = ( n + 1 ) n 2 \left( \begin{array}{lc} \left( \begin{array}{lc} 1\\ 1 \end{array} \right)+ \left( \begin{array}{lc} 2\\ 1 \end{array} \right)+···+ \left( \begin{array}{lc} n\\ 1 \end{array} \right) \end{array} \right)=1+2+···+n\\ =\frac{(n+1)n}{2} ((11)+(21)+⋅⋅⋅+(n1))=1+2+⋅⋅⋅+n=2(n+1)n
step3
:对于前半部分 2 ( ( 1 2 ) + ( 2 2 ) + ⋅ ⋅ ⋅ + ( n 2 ) ) 2\left( \begin{array}{lc} \left( \begin{array}{lc} 1\\ 2 \end{array} \right)+ \left( \begin{array}{lc} 2\\ 2 \end{array} \right)+···+ \left( \begin{array}{lc} n\\ 2 \end{array} \right) \end{array} \right) 2((12)+(22)+⋅⋅⋅+(n2))整理.
由 C ( n , k ) = C ( n − 1 , k − 1 ) + C ( n − 1 , k ) C(n,k)=C(n-1,k-1)+C(n-1,k) C(n,k)=C(n−1,k−1)+C(n−1,k)得:
C ( 1 , 2 ) = C ( 1 , 2 ) C(1, 2)=C(1,2) C(1,2)=C(1,2)
C ( 2 , 2 ) = C ( 1 , 1 ) + C ( 1 , 2 ) C(2,2)=C(1,1)+C(1,2) C(2,2)=C(1,1)+C(1,2)
C ( 3 , 2 ) = C ( 2 , 1 ) + C ( 2 , 2 ) = C ( 2 , 1 ) + C ( 1 , 1 ) + C ( 1 , 2 ) C(3,2)=C(2,1)+C(2,2)=C(2,1)+C(1,1)+C(1,2) C(3,2)=C(2,1)+C(2,2)=C(2,1)+C(1,1)+C(1,2)
⋅ ⋅ ⋅ ··· ⋅⋅⋅
C ( n , 2 ) = C ( n − 1 , 1 ) + C ( n − 1 , 2 ) = C ( n − 1 , 1 ) + C ( n − 2 , 1 ) ⋅ ⋅ ⋅ + C ( 2 , 1 ) + C ( 1 , 1 ) + C ( 1 , 2 ) C(n,2)=C(n-1,1)+C(n-1,2)=C(n-1,1)+C(n-2,1)···+C(2,1)+C(1,1)+C(1,2) C(n,2)=C(n−1,1)+C(n−1,2)=C(n−1,1)+C(n−2,1)⋅⋅⋅+C(2,1)+C(1,1)+C(1,2)
则 2 ( C ( 1 , 2 ) + C ( 2 , 2 ) + ⋅ ⋅ ⋅ + C ( n , 2 ) ) = 2 ( n C ( 1 , 2 ) + ( n − 1 ) C ( 1 , 1 ) + ( n − 2 ) C ( 2 , 1 ) + ⋅ ⋅ ⋅ + ( n − ( n − 1 ) ) ( C ( n − 1 , 1 ) + ( n − n ) C ( n , 1 ) ) = 2 ( n ∗ 0 + ( n − 1 ) ∗ 1 + ( n − 2 ) ∗ 2 + ⋅ ⋅ ⋅ + ( n − ( n − 1 ) ) ∗ ( n − 1 ) + ( n − n ) ∗ n ) = 2 ( ( 0 ∗ n + 1 ∗ n + 2 ∗ n + ⋅ ⋅ ⋅ + n ∗ n ) − ( 1 2 + 2 2 + ⋅ ⋅ ⋅ + n 2 ) ) = 2 ( n ( n ( n + 1 ) 2 ) − ( 1 2 + 2 2 + ⋅ ⋅ ⋅ + n 2 ) ) = n 2 ( n + 1 ) − 2 ( 1 2 + 2 2 + ⋅ ⋅ ⋅ + n 2 ) 2(C(1,2)+C(2,2)+···+C(n,2))\\ =2(nC(1,2)+(n-1)C(1,1)+(n-2)C(2,1)+···+(n-(n-1))(C(n-1,1)+(n-n)C(n,1))\\ =2(n*0+(n-1)*1+(n-2)*2+···+(n-(n-1))*(n-1)+(n-n)*n)\\ =2((0*n+1*n+2*n+···+n*n)-(1^2+2^2+···+n^2))\\ =2(n(\frac{n(n+1)}{2})-(1^2+2^2+···+n^2))\\ =n^2(n+1)-2(1^2+2^2+···+n^2) 2(C(1,2)+C(2,2)+⋅⋅⋅+C(n,2))=2(nC(1,2)+(n−1)C(1,1)+(n−2)C(2,1)+⋅⋅⋅+(n−(n−1))(C(n−1,1)+(n−n)C(n,1))=2(n∗0+(n−1)∗1+(n−2)∗2+⋅⋅⋅+(n−(n−1))∗(n−1)+(n−n)∗n)=2((0∗n+1∗n+2∗n+⋅⋅⋅+n∗n)−(12+22+⋅⋅⋅+n2))=2(n(2n(n+1))−(12+22+⋅⋅⋅+n2))=n2(n+1)−2(12+22+⋅⋅⋅+n2)
step4:将第2步和第3步得出的式子代入原式.
1 2 + 2 2 + ⋅ ⋅ ⋅ + n 2 = n 2 ( n + 1 ) − 2 ( 1 2 + 2 2 + ⋅ ⋅ ⋅ + n 2 ) + ( n + 1 ) n 2 1^2+2^2+···+n^2=n^2(n+1)-2(1^2+2^2+···+n^2)+\frac{(n+1)n}{2} 12+22+⋅⋅⋅+n2=n2(n+1)−2(12+22+⋅⋅⋅+n2)+2(n+1)n
step5:将等号右边的 1 2 + 2 2 + ⋅ ⋅ ⋅ + n 2 1^2+2^2+···+n^2 12+22+⋅⋅⋅+n2移到左边,并使系数为1,整理:
3 ( 1 2 + 2 2 + ⋅ ⋅ ⋅ + n 2 ) = n 2 ( n + 1 ) + ( n + 1 ) n 2 3(1^2+2^2+···+n^2)=n^2(n+1)+\frac{(n+1)n}{2} 3(12+22+⋅⋅⋅+n2)=n2(n+1)+2(n+1)n
1 2 + 2 2 + ⋅ ⋅ ⋅ + n 2 = 1 3 ( n 2 ( n + 1 ) + ( n + 1 ) n 2 ) = ( 2 n + 1 ) ( n + 1 ) n 6 1^2+2^2+···+n^2=\frac{1}{3}(n^2(n+1)+\frac{(n+1)n}{2})\\ =\frac{(2n+1)(n+1)n}{6} 12+22+⋅⋅⋅+n2=31(n2(n+1)+2(n+1)n)=6(2n+1)(n+1)n
这篇关于【组合数学题解】利用m²=2C(m,2)+C(m,1)求1²+2²+···+n²的值的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!