<jupyter_start><jupyter_text>Problem Set I.3<jupyter_code>import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import sympy
import networkx as nx<jupyter_output><empty_output><jupyter_text>\ 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<jupyter_code>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()<jupyter_output><empty_output><jupyter_text>$$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}$$<jupyter_code>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
A.nullspace()
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)<jupyter_output><empty_output><jupyter_text>$x_1=x_2=x_3=x_4=x_5$<jupyter_code>c = sympy.Symbol("c")

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

A*x<jupyter_output><empty_output><jupyter_text>$rank(A)=n-1=4, N(A^T)=m-r=8-4=4$ also means 4 loops in the graph<jupyter_code>A.T.nullspace()<jupyter_output><empty_output><jupyter_text>Loop 1:<jupyter_code>y_1 = sympy.Matrix([1, 0, -1, 0, 1, 0, 0, -1])

y_1
A.T*y_1<jupyter_output><empty_output><jupyter_text>Loop 2:<jupyter_code>y_2 = sympy.Matrix([1, -1, 0, 0, 1, 0, -1, 0])

y_2
A.T*y_2<jupyter_output><empty_output><jupyter_text>Loop 3:<jupyter_code>y_3 = sympy.Matrix([1, 0, -1, 1, 0, 1, 0, 0])

y_3
A.T*y_3<jupyter_output><empty_output><jupyter_text>Loop 4:<jupyter_code>y_4 = sympy.Matrix([1, -1, 0, 1, 0, 0, 0, 0])

y_4
A.T*y_4<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.23920111472364142, 'fraction_numerical': 0.08267533673943335, 'mean_word_length': 3.631182795698925, 'pattern_counts': {'":': 0, '<': 42, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '317402', 'license': 'MIT', 'n_tokens_mistral': 2385, 'n_tokens_neox': 2145, 'n_words': 474, 'path': '1. Highlights of Linear Algebra/3. The Four Fundamental Subspaces/Problem Set I.3.ipynb', 'repo_name': 'nickovchinnikov/LinearAlgebraAndLearningFromData', 'size': '4306'}