## 2019年12月14日土曜日

### 数学 - Python - 解析学 - “ε-δ”その他 - 帰納法 - 二項係数、組み合わせ、階乗、等式の証明

1. $\begin{array}{l}\left(\begin{array}{c}n\\ k\end{array}\right)\\ =\frac{n!}{k!\left(n-k\right)!}\\ =\frac{n!}{\left(n-k\right)!\left(n-\left(n-k\right)\right)!}\\ =\left(\begin{array}{c}n\\ n-k\end{array}\right)\end{array}$

（証明終）

2. $\begin{array}{l}k>0\\ \left(\begin{array}{c}n\\ k-1\end{array}\right)+\left(\begin{array}{c}n\\ k\end{array}\right)\\ =\frac{n!}{\left(k-1\right)!\left(n-\left(k-1\right)\right)!}+\frac{n!}{k!\left(n-k\right)!}\\ =\frac{n!\left(k+\left(n-\left(k-1\right)\right)\right)}{k!\left(n-\left(k-1\right)\right)!}\\ =\frac{n!\left(n+1\right)}{k!\left(n-\left(k-1\right)\right)!}\\ =\frac{\left(n+1\right)!}{k!\left(\left(n+1\right)-k\right)\right)!}\\ =\left(\begin{array}{c}n+1\\ k\end{array}\right)\end{array}$

（証明終）

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import symbols, binomial

print('8.')

class MyTestCase(TestCase):
def test_a(self):
for n in range(10):
for k in range(0, n + 1):
self.assertEqual(binomial(n, k), binomial(n, n - k))

def test_b(self):
for n in range(1, 10):
for k in range(1, n + 1):
self.assertEqual(binomial(n, k - 1) +
binomial(n, k), binomial(n + 1, k))

if __name__ == '__main__':
main()


% ./sample8.py -v
8.
test_a (__main__.MyTestCase) ... ok
test_b (__main__.MyTestCase) ... ok

----------------------------------------------------------------------
Ran 2 tests in 0.007s

OK
%