- #1
Ermol
- 1
- 0
1. It's a MATLAB project. given a matrix of the type
A (mod p)
where p prime (and for now say the matrix is square, though i don't think this is that relevant) i need to write a program in Matlab that will calculate the basis of the kernel of the matrix. Obviously the null program wouldn't work.
Prior to this I wrote the program that finds the row echelon form and the rank of any matrix of this form.
What I'm trying to do is if i have a matrix of the form:
[1 . . . .
0 1 . . .
0 0 0 1 .
0 0 0 0 0
0 0 0 0 0]
or something along those lines.
Take any such matrix A, and we want to find the basis for the space of all x such that Ax=0. So we can express:
x4 in terms of x5
x2 in terms of x3 and x5
x1 in terms of x3 and x5
That was basically the hint we got, so need to express the xi corresponding to the first elements in each row that has non-zero elements in terms of the other xj.
I got this so far, though it's obviously incomplete
[m,n] = size(A);
A=echelon(A,p);
i=1:r;
j=r+1:m;
B=A(i,:)
br=B(r,:)
x(r) = br(j)*x(j) (*)
My first question is how to define an x s.t. this works? I would normally start with x=zeros(r,1), but it won't work with the code above. I would then define x(r) as in (*). Then x(r-1) and so on up til x=1. But i don't know what exactly to do.
A (mod p)
where p prime (and for now say the matrix is square, though i don't think this is that relevant) i need to write a program in Matlab that will calculate the basis of the kernel of the matrix. Obviously the null program wouldn't work.
Homework Equations
Prior to this I wrote the program that finds the row echelon form and the rank of any matrix of this form.
The Attempt at a Solution
What I'm trying to do is if i have a matrix of the form:
[1 . . . .
0 1 . . .
0 0 0 1 .
0 0 0 0 0
0 0 0 0 0]
or something along those lines.
Take any such matrix A, and we want to find the basis for the space of all x such that Ax=0. So we can express:
x4 in terms of x5
x2 in terms of x3 and x5
x1 in terms of x3 and x5
That was basically the hint we got, so need to express the xi corresponding to the first elements in each row that has non-zero elements in terms of the other xj.
I got this so far, though it's obviously incomplete
[m,n] = size(A);
A=echelon(A,p);
i=1:r;
j=r+1:m;
B=A(i,:)
br=B(r,:)
x(r) = br(j)*x(j) (*)
My first question is how to define an x s.t. this works? I would normally start with x=zeros(r,1), but it won't work with the code above. I would then define x(r) as in (*). Then x(r-1) and so on up til x=1. But i don't know what exactly to do.