# Problem Set I.3


```python
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import sympy
import networkx as nx
```

## \# 1

$Bx=0,AB=C \implies ABx=Cx, A(Bx)=Cx, A \cdot 0 = Cx, Cx = 0$ or $ABx=0$

## \# 2

Example of $rank(A^2) < rank(A)$

$$A=\begin{bmatrix}
 0 & 1 \\
 0 & 0
\end{bmatrix},
A^2=\begin{bmatrix}
 0 & 1 \\
 0 & 0
\end{bmatrix}
\cdot
\begin{bmatrix}
 0 & 1 \\
 0 & 0
\end{bmatrix}
=\begin{bmatrix}
 0 & 0 \\
 0 & 0
\end{bmatrix}$$

$rank(A^TA)=rank(A)$

$$A^TA=\begin{bmatrix}
 0 & 0 \\
 1 & 0
\end{bmatrix}
\cdot
\begin{bmatrix}
 0 & 1 \\
 0 & 0
\end{bmatrix}
=\begin{bmatrix}
 0 & 1 \\
 0 & 0
\end{bmatrix}
$$

$rank(AA^T)=rank(A)$

$$AA^T=\begin{bmatrix}
 0 & 1 \\
 0 & 0
\end{bmatrix}
\cdot
\begin{bmatrix}
 0 & 0 \\
 1 & 0
\end{bmatrix}
=\begin{bmatrix}
 1 & 0 \\
 0 & 0
\end{bmatrix}
$$

## \# 3

$$
C=\begin{bmatrix}
 A \\
 B
\end{bmatrix}
$$

$$Cx=0
\implies 
\begin{bmatrix}
 A \\
 B
\end{bmatrix}x=0,
\begin{bmatrix}
 Ax \\
 Bx
\end{bmatrix}=0
\implies Ax=0,Bx=0
$$

$N(C)=N(A) \cap N(B)$

## \# 4

$C(A)=C(A^T)$ and $N(A)=N(A^T)$

$Ax=A^Tx=0$ because $Ax=0$ and $A^Ty=0$ and $A^T=A \implies x = y$

$$\begin{bmatrix}
 u & v
\end{bmatrix}=\begin{bmatrix}
 u & v
\end{bmatrix}^T,
\begin{bmatrix}
 u & v
\end{bmatrix}=\begin{bmatrix}
 u^* \\
 v^*
\end{bmatrix}
$$

I suppose than $A = A^T \implies S = S^T$ is symmetric matrix

## \# 5

1) $r = m = n$, $A_1x=b$ has 1 solution for every b

$A_1$ is any full-rank matrix

2) $r = m < n$, $A_2x=b$ has 1 or $\infty$ solutions

$$A_2x=
\begin{bmatrix}
 1 & 0
\end{bmatrix}
\cdot
\begin{bmatrix}
 x_1 \\
 x_2
\end{bmatrix}
=b
$$

$A_2$ has an extra column

3) $r=n < m, A_3x=b$ has 0 or 1 solutions

$A_3=A_2^T$

4) $r < m, r < n; A_4x = b$ has 0 or $\infty$ solutions

$$
A_4=
\begin{bmatrix}
 1 & 0 \\
 0 & 0
\end{bmatrix}
$$

or dependent columns

$$
\begin{bmatrix}
 1 & 2 \\
 1 & 2
\end{bmatrix}
$$

$$
\begin{bmatrix}
 1 & 2 & 3 \\
 1 & 2 & 3 \\
 1 & 2 & 3
\end{bmatrix}
$$

And etc.

## \# 6

$Ax=0, A^TAx=A^T(Ax)=A^T0=0$

$N(A) \subset N(A^TA)$

$A^TAx=0$, then $x^TA^TAx=x^T0 \implies (Ax)^T(Ax)=0 \implies ||Ax||^2=0$

$N(A^TA)=N(A)$

## \# 7

$$A=\begin{bmatrix}
 0 & 1 \\
 0 & 0
\end{bmatrix};
A^2=\begin{bmatrix}
 0 & 0 \\
 0 & 0
\end{bmatrix}
$$

$A$ and $A^2$ have different $N(A)$

## \# 8

$$A=\begin{bmatrix}
 0 & 1 \\
 0 & 0
\end{bmatrix}
$$

$C(A)=N(A)=\begin{bmatrix}
 x_1 \\
 0
\end{bmatrix};$

But $C(A) \neq N(A^T)$ because those two subspaces are orthogonal

## \# 9


```python
g = nx.DiGraph()
g.add_nodes_from([1,2,3,4,5])
g.add_edge(1,2)
g.add_edge(1,3)
g.add_edge(1,4)
g.add_edge(2,5)
g.add_edge(2,3)
g.add_edge(3,4)
g.add_edge(3,5)
g.add_edge(4,5)

pos = { 1: (0, 20), 2: (20, 20), 3: (10, 10), 4: (0, 0), 5: (20, 0)}

nx.draw_networkx(g, pos=pos, with_labels=True)

plt.show()
```

$$A=
\begin{bmatrix}
 -1 &  1 &  0 &  0 & 0 \\
 -1 &  0 &  1 &  0 & 0 \\
 -1 &  0 &  0 &  1 & 0 \\
  0 & -1 &  1 &  0 & 0 \\
  0 & -1 &  0 &  0 & 1 \\
  0 &  0 & -1 &  1 & 0 \\
  0 &  0 & -1 &  0 & 1 \\
  0 &  0 &  0 & -1 & 1
\end{bmatrix}
$$


```python
A = sympy.Matrix([
    [-1,  1,  0,  0, 0],
    [-1,  0,  1,  0, 0],
    [-1,  0,  0,  1, 0],
    [ 0, -1,  1,  0, 0],
    [ 0, -1,  0,  0, 1],
    [ 0,  0, -1,  1, 0],
    [ 0,  0, -1,  0, 1],
    [ 0,  0,  0, -1, 1],
])
A
```




$\displaystyle \left[\begin{matrix}-1 & 1 & 0 & 0 & 0\\-1 & 0 & 1 & 0 & 0\\-1 & 0 & 0 & 1 & 0\\0 & -1 & 1 & 0 & 0\\0 & -1 & 0 & 0 & 1\\0 & 0 & -1 & 1 & 0\\0 & 0 & -1 & 0 & 1\\0 & 0 & 0 & -1 & 1\end{matrix}\right]$




```python
A.nullspace()
```




    [Matrix([
     [1],
     [1],
     [1],
     [1],
     [1]])]




```python
x_1, x_2, x_3, x_4, x_5 = sympy.symbols("x_1, x_2, x_3, x_4, x_5")

eq1 = -x_1 + x_2
eq2 = -x_1 + x_3
eq3 = -x_1 + x_4
eq4 = -x_2 + x_3
eq5 = -x_2 + x_5
eq6 = -x_3 + x_4
eq7 = -x_3 + x_5
eq8 = -x_4 + x_5

sympy.solve([eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8], [x_1, x_2, x_3, x_4, x_5], dict=True)
```




    [{x_1: x_5, x_2: x_5, x_3: x_5, x_4: x_5}]



$x_1=x_2=x_3=x_4=x_5$


```python
c = sympy.Symbol("c")

x = sympy.Matrix([c, c, c, c, c])

A*x
```




$\displaystyle \left[\begin{matrix}0\\0\\0\\0\\0\\0\\0\\0\end{matrix}\right]$



$rank(A)=n-1=4, N(A^T)=m-r=8-4=4$ also means 4 loops in the graph


```python
A.T.nullspace()
```




    [Matrix([
     [ 1],
     [-1],
     [ 0],
     [ 1],
     [ 0],
     [ 0],
     [ 0],
     [ 0]]),
     Matrix([
     [ 0],
     [ 1],
     [-1],
     [ 0],
     [ 0],
     [ 1],
     [ 0],
     [ 0]]),
     Matrix([
     [-1],
     [ 1],
     [ 0],
     [ 0],
     [-1],
     [ 0],
     [ 1],
     [ 0]]),
     Matrix([
     [-1],
     [ 0],
     [ 1],
     [ 0],
     [-1],
     [ 0],
     [ 0],
     [ 1]])]



Loop 1:


```python
y_1 = sympy.Matrix([1, 0, -1, 0, 1, 0, 0, -1])

y_1
```




$\displaystyle \left[\begin{matrix}1\\0\\-1\\0\\1\\0\\0\\-1\end{matrix}\right]$




```python
A.T*y_1
```




$\displaystyle \left[\begin{matrix}0\\0\\0\\0\\0\end{matrix}\right]$



Loop 2:


```python
y_2 = sympy.Matrix([1, -1, 0, 0, 1, 0, -1, 0])

y_2
```




$\displaystyle \left[\begin{matrix}1\\-1\\0\\0\\1\\0\\-1\\0\end{matrix}\right]$




```python
A.T*y_2
```




$\displaystyle \left[\begin{matrix}0\\0\\0\\0\\0\end{matrix}\right]$



Loop 3:


```python
y_3 = sympy.Matrix([1, 0, -1, 1, 0, 1, 0, 0])

y_3
```




$\displaystyle \left[\begin{matrix}1\\0\\-1\\1\\0\\1\\0\\0\end{matrix}\right]$




```python
A.T*y_3
```




$\displaystyle \left[\begin{matrix}0\\0\\0\\0\\0\end{matrix}\right]$



Loop 4:


```python
y_4 = sympy.Matrix([1, -1, 0, 1, 0, 0, 0, 0])

y_4
```




$\displaystyle \left[\begin{matrix}1\\-1\\0\\1\\0\\0\\0\\0\end{matrix}\right]$




```python
A.T*y_4
```




$\displaystyle \left[\begin{matrix}0\\0\\0\\0\\0\end{matrix}\right]$



## \# 10

If $N(A)=x=\begin{bmatrix}
 0      \\
 0      \\
 \vdots \\
 0
\end{bmatrix}$, then what are the nullspace of $B=\begin{bmatrix}
 A & A & A
\end{bmatrix}$

$Ax=0;
B\cdot
\begin{bmatrix}
 x \\
 x \\
 x
\end{bmatrix}
=\begin{bmatrix}
 A & A & A
\end{bmatrix}
\cdot
\begin{bmatrix}
 x \\
 x \\
 x
\end{bmatrix}=0$

$N(B)=\begin{bmatrix}
 x \\
 x \\
 x
\end{bmatrix}$

## \# 11

$dim(S)=2$ and $dim(T)=7$ of $R^{10}$

1) $dim(S \bigcap T) \leq dim(S) \leq 2$

2) $dim(S+T) \leq dim(T) + dim(S)$

Or

$7 \leq dim(S+T) \leq 9$

3) $S^{\perp}=dim(R^{10})-dim(S^{\perp})=10-8=2$



3c68d1360d38463763cb59ef8dd665d4759f59d3
ipynb
Jupyter Notebook
1. Highlights of Linear Algebra/3. The Four Fundamental Subspaces/Problem Set I.3.ipynb
nickovchinnikov/LinearAlgebraAndLearningFromData
a797de46881b52628dac0230ba16fac8e149474f
MIT
2021-08-31T12:03:28.000Z
2021-11-22T12:55:54.000Z
1. Highlights of Linear Algebra/3. The Four Fundamental Subspaces/Problem Set I.3.ipynb
nickovchinnikov/LinearAlgebraAndLearningFromData
a797de46881b52628dac0230ba16fac8e149474f
MIT
1. Highlights of Linear Algebra/3. The Four Fundamental Subspaces/Problem Set I.3.ipynb
nickovchinnikov/LinearAlgebraAndLearningFromData
a797de46881b52628dac0230ba16fac8e149474f
MIT
Qwen/Qwen-72B
1. YES
2. YES