# 7.4 1차 독립. 행렬의 계수. 벡터공간

### 세 개의 벡터 $\mathbf{a_1}$, $\mathbf{a_2}$, $\mathbf{a_3}$.

a1 = vector(QQ, [3,0,2,2]) a2 = vector(QQ, [-6,42,24,54]) a3 = vector(QQ, [21,-21,0,-15]) print "a1 ="; show(a1) print "a2 ="; show(a2) print "a3 ="; show(a3)
 a1 = \newcommand{\Bold}[1]{\mathbf{#1}}\left(3,\,0,\,2,\,2\right) a2 = \newcommand{\Bold}[1]{\mathbf{#1}}\left(-6,\,42,\,24,\,54\right) a3 = \newcommand{\Bold}[1]{\mathbf{#1}}\left(21,\,-21,\,0,\,-15\right) a1 = a2 = a3 =

### $$6 \mathbf{a_1} - \frac{1}{2} \mathbf{a_2} - \mathbf{a_3} = \mathbf{0}$$

show(6*a1 - (1/2)*a2 - a3 )
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(0,\,0,\,0,\,0\right)

### $$A = \left[\begin{array}{c} \mathbf{a_1}\\ \mathbf{a_2} \\ \mathbf{a_3} \end{array}\right]$$

A = matrix(QQ, [a1,a2,a3]) print "A ="; show(A)
 A = \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrr} 3 & 0 & 2 & 2 \\ -6 & 42 & 24 & 54 \\ 21 & -21 & 0 & -15 \end{array}\right) A =

### $$\mathrm{rank}(A) = 2$$

r = A.rank() print "Rank of A ="; show(r)
 Rank of A = \newcommand{\Bold}[1]{\mathbf{#1}}2 Rank of A =

### $$R'_2 = R_2 + 2R_1, \qquad R'_3 = R_3 + (-7)R_1$$

 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrr} 3 & 0 & 2 & 2 \\ 0 & 42 & 28 & 58 \\ 0 & -21 & -14 & -29 \end{array}\right)

### $$R''_3 = R'_3 + \frac{1}{2}R'_2 = -6R_1 +\frac{1}{2}R_2 +R_3 \qquad \Leftrightarrow \qquad 6\mathbf{a_1} - \frac{1}{2} \mathbf{a_2} - \mathbf{a_3} = \mathbf{0}$$

 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrr} 3 & 0 & 2 & 2 \\ 0 & 42 & 28 & 58 \\ 0 & 0 & 0 & 0 \end{array}\right)

### 기약 행사다리꼴(Reduced Row Echelon Form)

show(A.rref())
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrr} 1 & 0 & \frac{2}{3} & \frac{2}{3} \\ 0 & 1 & \frac{2}{3} & \frac{29}{21} \\ 0 & 0 & 0 & 0 \end{array}\right)

### $\Rightarrow$ 행렬 $A$의 1차독립인 열벡터의 갯수 $=2$.

A = matrix(QQ, [a1,a2,a3]) tranA = A.transpose() print "The transpose of A ="; show(tranA)
 The transpose of A = \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 3 & -6 & 21 \\ 0 & 42 & -21 \\ 2 & 24 & 0 \\ 2 & 54 & -15 \end{array}\right) The transpose of A =

### $\Rightarrow$ $\mathrm{rank} A^T = \mathrm{rank} A = 2$

S = tranA.rref() print "S ="; show(S)
 S = \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 1 & 0 & 6 \\ 0 & 1 & -\frac{1}{2} \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{array}\right) S =

### $\Leftrightarrow$ $\mathbf{a_1}$, $\mathbf{a_2}$의 생성공간(span)

V1 = span([a1,a2], QQ) show(V1)
 \newcommand{\Bold}[1]{\mathbf{#1}}\mathrm{RowSpan}_{\Bold{Q}}\left(\begin{array}{rrrr} 1 & 0 & \frac{2}{3} & \frac{2}{3} \\ 0 & 1 & \frac{2}{3} & \frac{29}{21} \end{array}\right)

### $\Leftrightarrow$ $\mathbf{a_2}$, $\mathbf{a_3}$의 생성공간(span)

V2 = span([a2,a3]) show(V2)
 \newcommand{\Bold}[1]{\mathbf{#1}}\mathrm{RowSpan}_{\Bold{Q}}\left(\begin{array}{rrrr} 1 & 0 & \frac{2}{3} & \frac{2}{3} \\ 0 & 1 & \frac{2}{3} & \frac{29}{21} \end{array}\right)

### 행렬 $A$

A = matrix(QQ, [a1,a2,a3]) print "A ="; show(A)
 A = \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrr} 3 & 0 & 2 & 2 \\ -6 & 42 & 24 & 54 \\ 21 & -21 & 0 & -15 \end{array}\right) A =

### 행렬 $A$의 기약 행사다리꼴

show(A.rref())
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrr} 1 & 0 & \frac{2}{3} & \frac{2}{3} \\ 0 & 1 & \frac{2}{3} & \frac{29}{21} \\ 0 & 0 & 0 & 0 \end{array}\right)

### 행공간 $\mathrm{row} A$

rowA = A.row_space() print "row(A) ="; show(rowA)
 row(A) = \newcommand{\Bold}[1]{\mathbf{#1}}\mathrm{RowSpan}_{\Bold{Q}}\left(\begin{array}{rrrr} 1 & 0 & \frac{2}{3} & \frac{2}{3} \\ 0 & 1 & \frac{2}{3} & \frac{29}{21} \end{array}\right) row(A) =

### 행공간의 차원 $\mathrm{dim} \,\mathrm{row} A$

dim_row = rowA.dimension() print "Dimension of the row(A) ="; show(dim_row)
 Dimension of the row(A) = \newcommand{\Bold}[1]{\mathbf{#1}}2 Dimension of the row(A) =

### 행공간의 기저(bais)

rowB = rowA.basis() print "Basis of the row(A) ="; show(rowB)
 Basis of the row(A) = \newcommand{\Bold}[1]{\mathbf{#1}}\left[\left(1,\,0,\,\frac{2}{3},\,\frac{2}{3}\right), \left(0,\,1,\,\frac{2}{3},\,\frac{29}{21}\right)\right] Basis of the row(A) =

### 전치행렬 $A^T$

tranA = A.transpose() print "The transpose of A ="; show(tranA)
 The transpose of A = \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 3 & -6 & 21 \\ 0 & 42 & -21 \\ 2 & 24 & 0 \\ 2 & 54 & -15 \end{array}\right) The transpose of A =

### 전치행렬 $A^T$의 기약 행사다리꼴

S = tranA.rref() print "S ="; show(S)
 S = \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrr} 1 & 0 & 6 \\ 0 & 1 & -\frac{1}{2} \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{array}\right) S =

### 열공간 $\mathrm{col} A$

colA = A.column_space() print "col(A) ="; show(colA)
 col(A) = \newcommand{\Bold}[1]{\mathbf{#1}}\mathrm{RowSpan}_{\Bold{Q}}\left(\begin{array}{rrr} 1 & 0 & 6 \\ 0 & 1 & -\frac{1}{2} \end{array}\right) col(A) =

### 열공간의 차원 $\mathrm{dim}\, \mathrm{col} A = \mathrm{dim}\, \mathrm{row} A^T$

dim_col = colA.dimension() print "Dimension of the col(A) ="; show(dim_col)
 Dimension of the col(A) = \newcommand{\Bold}[1]{\mathbf{#1}}2 Dimension of the col(A) =

### 열공간의 기저(bais)

colB = colA.basis() print "Basis of the col(A) ="; show(colB)
 Basis of the col(A) = \newcommand{\Bold}[1]{\mathbf{#1}}\left[\left(1,\,0,\,6\right), \left(0,\,1,\,-\frac{1}{2}\right)\right] Basis of the col(A) =

### 행렬 $A$와 계수 $\mathrm{rank} A$.

A = matrix(QQ, [a1,a2,a3]) print "A ="; show(A) r = A.rank() print "Rank of A ="; show(r)
 A = \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrr} 3 & 0 & 2 & 2 \\ -6 & 42 & 24 & 54 \\ 21 & -21 & 0 & -15 \end{array}\right) Rank of A = \newcommand{\Bold}[1]{\mathbf{#1}}2 A = Rank of A =

### $$\mathrm{rank} A + \mathrm{nullity} A = n$$

null = A.right_nullity() print "Nullity of A ="; show(null)
 Nullity of A = \newcommand{\Bold}[1]{\mathbf{#1}}2 Nullity of A =

### $\mathbb{R}^3$ 공간의 표준 기저는 다음과 같다.

n = 4 V = VectorSpace(QQ, n) B = V.basis() print "A basis of the R^n space"; show(B)
 A basis of the R^n space \newcommand{\Bold}[1]{\mathbf{#1}}\left[\left(1,\,0,\,0,\,0\right), \left(0,\,1,\,0,\,0\right), \left(0,\,0,\,1,\,0\right), \left(0,\,0,\,0,\,1\right)\right] A basis of the R^n space