{%hackmd 5xqeIJ7VRCGBfLtfMi0_IQ %} # How to find a basis of the row space? ## Problem Let $$ A = \begin{bmatrix} 1 & -5 & -4 & -4 & 5 & 8 \\ -2 & 10 & 8 & 8 & -9 & -14 \\ -5 & 25 & 20 & 20 & -23 & -36 \\ -5 & 25 & 20 & 20 & -23 & -36 \end{bmatrix}\text{ and } R = \begin{bmatrix} 1 & -5 & -4 & -4 & 0 & -2 \\ 0 & 0 & 0 & 0 & 1 & 2 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 \end{bmatrix}. $$ It is known that $R$ is the reduced echelon form of $A$. Find a basis for the row space $\Row(A)$. ## Thought By the rules of row operations, the each row of $R$ is a linear combination of the rows of $A$. Since row operations are reversible, each row of $A$ is a linear combination of $R$ as well. Thus, we know $\Row(A) = \Row(R)$. Let $S = \{\br_1, \br_2\}$ be the set of nonzero rows in $R$. Then $\Row(A) = \vspan(S)$. Thus, $S$ satisfies one of the conditions of being a basis of $\Row(A)$. As long as we can show that $S$ is linearly independent, then $S$ is a basis of $\Row(A)$. ## Sample answer Let $$ \begin{aligned} S &= \{\br_1, \br_2\} \\ &= \left\{ \begin{bmatrix} {\color{red}1} & -5 & -4 & -4 & 0 & -2 \end{bmatrix}, \begin{bmatrix} 0 & 0 & 0 & 0 & {\color{red}1} & 2 \end{bmatrix} \right\} \end{aligned} $$ be the set of nonzero rows of $R$. Since row operations does not change the row space, we know $\Row(A) = \Row(R) = \vspan(S)$. Now we may check the linearly independency of $S$. Suppose $$ c_1\br_1 + c_2\br_2 = \bzero. $$ By comparing the first entries on the both sides, we know $c_1 = 0$. Similarly, the equation on the fifth entries gives $c_2 = 0$. Therefore, $S$ is linearly independent. Combining all above results, we know $S$ is a basis of $\Row(A)$. ## Note It turns out that by the definition of the reduced echelon form, there is a "hidden identity matrix" in $S$. (Use the electronic version of this note to see the red part above.) Therefore, the set $S$ of nonzero rows of $R$ is always linearly independent by our choice (why?). This means the dimension of $\Row(A)$ is the number of leading variables. This number is called the _rank_ of $A$, denoted as $\rank(A)$. Run the SageMath code below or simply click [here](https://sagecell.sagemath.org/?q=ewiqir). The code generates some random matrices. Use the code to do some practices by yourself, and then check your answer by modifying `print_ans` in the code. ```python= load("https://raw.githubusercontent.com/jephianlin/LA-notebook/main/lingeo.py") set_random_seed(None) # replace None with your favorite number m,n,r = 4,6,2 # m x n matrix with rank r A, R, pivots = random_good_matrix(m,n,r, return_answer=True) pretty_print(LatexExpr("A="), A, LatexExpr("\\rightsquigarrow R="), R) Kb = kernel_matrix(A) Cb = column_space_matrix(A) Rb = row_space_matrix(A) print_ans = "No" # replace No with K, C, R, or All if print_ans in ["K", "All"]: K_basis = [(Kb[:,i//2] if i % 2 == 0 else ",") for i in range(2*(n-r)-1)] pretty_print("a basis of ker(A) can be", LatexExpr("\\ \\Big\\{"), *K_basis, LatexExpr("\\Big\\}")) if print_ans in ["C", "All"]: K_basis = [(Cb[:,i//2] if i % 2 == 0 else ",") for i in range(2*r-1)] pretty_print("a basis of Col(A) can be", LatexExpr("\\ \\Big\\{"), *K_basis, LatexExpr("\\Big\\}")) if print_ans in ["R", "All"]: K_basis = [(Rb[i//2,:] if i % 2 == 0 else ",") for i in range(2*r-1)] pretty_print("a basis of Row(A) can be", LatexExpr("\\ \\Big\\{"), *K_basis, LatexExpr("\\Big\\}")) ``` *This note can be found at Course website > Learning resources.*