'Error finding the simplest row form of a matrix
This problem was discovered when I was solving this second order differential equation by matlab
syms x(t)
diff(x,t,2)+k*diff(x,t)+b*x==0
I transform it into a system of first order equations, whose coefficient matrix is
syms b k
A=[0 1;
-b-k]
Then I solve this system by following code
syms x1(t) x2(t)
X=[x1;x2];
odes=diff(X)==A*X;
[x1sol(t),x2sol(t)]=dsolve(odes);
x1sol=simplify(x1sol(t))
x2sol=simplify(x2sol(t))
But this solution is different from the one I calculated manually, because the correct answer is based on the eigenvalues and eigenvectors of A:
λ1=(-b-(b^2-4*k)^(1/2))/2
v1=[-1;
(b+(b^2-4*k)^(1/2))/2]
and
λ2=(-b+(b^2-4*k)^(1/2))/2
v2=[-1;
(-b+(b^2-4*k)^(1/2))/2]
Therefore, Instead of solving the system directly, I calculate the the eigenvalues and eigenvectors of A directly
[V,D]=eig(A)
or indirectly
syms k b t
I=eye(2);
A=[0 1;-k -b];
e=eig(A);
B1=e(1)*I-A;
B2=e(2)*I-A;
P1=null(B1)
P2=null(B2)
By comparing the results of MATLAB and manual calculation, I find that the eigenvalues are correct calculated by both means, but the eigenvectors are wrong calculated by both means either (and they are same with dsolve(odes) above). If P1 is the solution to B1X=0 (means P1 is one of the eigenvector of A), then B1P1=0 should be true, so does P2.
Finally, I find that MATLAB seems to make an error when converting B1 a to the simplest row form
B1=
[- b/2 - (b^2 - 4*k)^(1/2)/2, -1]
[ k, b/2 - (b^2 - 4*k)^(1/2)/2]
rrefB1=rref(B1)
ans=
[1, (b - (b^2 - 4*k)^(1/2))/(2*k)]
[0, 0]
and I check rrefB1 multiplies P1, and it equals to 0.
So, the problem is that B1 multiplies P1 doesn't equals to 0, but rrefB1 multiplies P1 equals to 0. In theory, The original matrix (B1) and the simplest row form of it (rrefB1) should have the same fundamental system of solutions.
What's wrong here?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
