## 2018年1月5日金曜日

### 数学 - Python - 線型代数 - 行列式 - 行列式の計算(行、列についてn重線型かつ交代的、零、3次、展開式)

1. $\begin{array}{}105-30-8\left(45-180\right)\\ =75+8·135\\ =75+1080\\ =1155\end{array}$

2. $\begin{array}{}3\left(-9\right)-5\left(-8\right)\\ =-27+40\\ =13\end{array}$

3. $\begin{array}{}3\left(-2-9\right)+2\left(4-3\right)+\left(-6-1\right)\\ =-33+2-7\\ =-38\end{array}$

4. $\begin{array}{}1+4+3·3\\ =5+9\\ =14\end{array}$

5. $\begin{array}{}2\left(40-3\right)+9\left(-56+18\right)+4\left(7-30\right)\\ =2·37-9·38-4·23\\ =74-342-92\\ =-360\end{array}$

6. $\begin{array}{}\left(45-48\right)-2\left(36-42\right)+3\left(32-35\right)\\ =-3+12-9\\ =0\end{array}$

7. $\begin{array}{}\mathrm{det}\left(\begin{array}{cccc}1& 0& -3& 1\\ 3& 0& 1& 2\\ 0& 1& 1& 3\\ 2& -5& 3& 0\end{array}\right)\end{array}=\mathrm{det}\left(\begin{array}{cccc}1& 0& -3& 1\\ 0& 0& 10& -1\\ 0& 1& 1& 3\\ 0& -5& 9& -2\end{array}\right)\\ =-10\left(-2+15\right)-\left(9+5\right)\\ =-130-14\\ =-144$

8. $\begin{array}{}\mathrm{det}\left(\begin{array}{cccc}1& 0& -2& 1\\ 0& -2& 1& 1\\ 0& 1& -3& 2\\ 0& 1& 2& -3\end{array}\right)\end{array}=-2\left(9-4\right)-\left(-3-2\right)+\left(2+3\right)\\ =-10+5+5\\ =0$

9. $\begin{array}{}\mathrm{det}\left(\begin{array}{cccc}0& 1& 2& -3\\ -1& 0& 0& 1\\ 0& 0& 0& 2\\ 3& -1& -4& 0\end{array}\right)\end{array}=\mathrm{det}\left(\begin{array}{cccc}0& 1& 2& 0\\ -1& 0& 0& 0\\ 0& 0& 0& 2\\ 3& -1& -4& 0\end{array}\right)\\ =\mathrm{det}\left(\begin{array}{cccc}0& 1& 2& 0\\ -1& 0& 0& 0\\ 0& 0& 0& 2\\ 3& 0& -2& 0\end{array}\right)\\ =\mathrm{det}\left(\begin{array}{cccc}0& 1& 0& 0\\ -1& 0& 0& 0\\ 0& 0& 0& 2\\ 0& 0& -2& 0\end{array}\right)\\ =-\mathrm{det}\left(\begin{array}{cccc}1& 0& 0& 0\\ 0& -1& 0& 0\\ 0& 0& 0& 2\\ 0& 0& -2& 0\end{array}\right)\\ =4$

10. $\begin{array}{}\mathrm{det}\left(\begin{array}{cccc}1& 2& 3& 4\\ 0& -7& -10& -13\\ 0& -2& -8& -10\\ 0& -1& -2& -7\end{array}\right)\end{array}=-7\left(56-20\right)+10\left(14-10\right)-13\left(4-8\right)\\ =-7·36+40+13·4\\ =-252+40+52\\ =-160$

11. $\begin{array}{}\mathrm{det}\left(\begin{array}{cccc}1& 2& 3& 4\\ 1& -3& -1& -1\\ 1& 7& 7& -1\\ 10& 9& 8& 7\end{array}\right)\end{array}=\mathrm{det}\left(\begin{array}{cccc}1& 2& 3& 4\\ 0& -5& -4& -5\\ 0& 5& 4& -5\\ 0& -11& -22& -33\end{array}\right)\\ =\mathrm{det}\left(\begin{array}{cccc}1& 0& 0& 0\\ 0& 0& 0& -10\\ 0& 5& 4& -5\\ 0& -1& -14& -43\end{array}\right)\\ =-10\left(-70+4\right)\\ =660$

12. $\begin{array}{}\mathrm{det}\left(\begin{array}{cccc}1& 0& 0& 0\\ 4& -5& -14& -1\\ 9& -10& -38& -2\\ 16& -17& -66& -15\end{array}\right)\end{array}=\mathrm{det}\left(\begin{array}{cccc}1& 0& 0& 0\\ 0& -5& -14& -1\\ 0& 0& -10& 0\\ 0& -17& -66& -15\end{array}\right)\\ =-5·150-\left(-170\right)\\ =10\left(-75+17\right)\\ =-580$

13. $\begin{array}{}\mathrm{det}\left(\begin{array}{ccccc}1& 1& 1& 0& 0\\ 0& 0& -1& 0& 1\\ 0& -1& -1& 1& 1\\ 0& 0& 1& 1& 1\\ 0& 1& 1& 1& 0\end{array}\right)\end{array}=\mathrm{det}\left(\begin{array}{ccccc}1& 0& 0& 0& 0\\ 0& 0& -1& 0& 1\\ 0& -1& 0& 1& 0\\ 0& 0& 0& 1& 2\\ 0& 1& 1& 1& 0\end{array}\right)\\ =\mathrm{det}\left(\begin{array}{cccc}0& -1& 0& 1\\ -1& 0& 0& 0\\ 0& 0& 1& 2\\ 1& 1& 2& 0\end{array}\right)\\ =-\mathrm{det}\left(\begin{array}{cccc}-1& 0& 0& 0\\ 0& -1& 0& 1\\ 0& 0& 1& 2\\ 1& 1& 2& 0\end{array}\right)\\ =-\left(-4\right)+\left(-1\right)\\ =3$

14. $\begin{array}{}\mathrm{det}\left(\begin{array}{ccccc}1& -2& -3& 0& -5\\ 0& 4& 7& -4& 7\\ 0& -1& -6& 0& -5\\ 0& -8& -17& 5& -18\\ 0& -7& -14& 2& -17\end{array}\right)\end{array}=\mathrm{det}\left(\begin{array}{cccc}0& 0& -4& 7\\ -1& -1& 0& -5\\ -3& 1& 5& -18\\ -5& 3& 2& -17\end{array}\right)\\ =\mathrm{det}\left(\begin{array}{cccc}0& 0& -4& 7\\ -1& -1& 0& -5\\ 0& 4& 5& -3\\ 0& 8& 2& 8\end{array}\right)\\ =\mathrm{det}\left(\begin{array}{ccc}0& -4& 7\\ 4& 5& -3\\ 8& 2& 8\end{array}\right)\\ =\mathrm{det}\left(\begin{array}{ccc}0& -4& 7\\ 4& 5& -7\\ 8& 2& 0\end{array}\right)\\ =\mathrm{det}\left(\begin{array}{ccc}0& -4& 7\\ 4& 1& 0\\ 8& 2& 0\end{array}\right)\\ =0$

コード(Emacs)

Python 3

#!/usr/bin/env python3
from sympy import pprint, Matrix

M1 = Matrix([1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1,
1, 1, 0]).reshape(5, 5)
M2 = Matrix([[1, -2, -3, 0, -5],
[2, 0, 1, -4, -3],
[-2, 3, 0, 0, 5],
[-5, 2, -2, 5, 7],
[-3, -1, -5, 2, -2]])
for M in [M1, M2]:
for t in [M, M.det()]:
pprint(t)
print()
print()


$./sample1.py ⎡1 1 1 0 0⎤ ⎢ ⎥ ⎢1 1 0 0 1⎥ ⎢ ⎥ ⎢1 0 0 1 1⎥ ⎢ ⎥ ⎢0 0 1 1 1⎥ ⎢ ⎥ ⎣0 1 1 1 0⎦ 3 ⎡1 -2 -3 0 -5⎤ ⎢ ⎥ ⎢2 0 1 -4 -3⎥ ⎢ ⎥ ⎢-2 3 0 0 5 ⎥ ⎢ ⎥ ⎢-5 2 -2 5 7 ⎥ ⎢ ⎥ ⎣-3 -1 -5 2 -2⎦ 0$