Try   HackMD

How to find a basis of the kernel?

Problem

Let

A=[154458210889145252020233652520202336] and R=[154402000012000000000000].

It is known that

R is the reduced echelon form of
A
. Find a basis for the kernel
ker(A)
.

Thought

According to the article "How to solve a system of linear equations?", the kernel of

A can be written as
span({h1,,hk})
for some homogeneous solutions
hi
's, where
k
is the number of free variables. Let
S={h1,,hk}
. Then we have
ker(A)=span(S)
, which is one of the conditions for
S
being a basis of
ker(A)
. As long as we can show that
S
is linearly independent, then
S
is a basis of
ker(A)
.

Sample answer

By observing the reduced echelon form, we know the indices

2,
3
,
4
, and
6
correspond to the free variables. By setting one of them as
1
and others as
0
, we get the set of homogeneous solutions

S={h1,h2,h3,h4}={[510000],[401000],[400100],[200021]}.

By the way we solve the solutions, we know

ker(A)=span(S). Now we may check the linearly independency of
S
. Suppose

c1h1+c2h2+c3h3+c4h4=0.

By comparing the second entries on the both sides, we know

c1=0. Similarly, the equation on the third entries gives
c2=0
. The fourth entries give
c3=0
, and the sixth entries give
c4=0
. Therefore,
S
is linearly independent.

Combining all above results, we know

S is a basis of
ker(A)
.

Note

It turns out that by the way we found the homogeneous solutions, 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 homogeneous solutions is always linearly independent by our choice (why?).

This means the dimension of

ker(A) is the number of free variables. This number is called the nullity of
A
, denoted as
null(A)
.

Run the SageMath code below or simply click here. 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.

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\\}"))

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

This note can be found at Course website > Learning resources.