Need help with matlab question
Show older comments
i need to solve a linear system of equation Ax = b; involving any singular matrix, A i have tried doing:
>> A=[3 3;3 3]
A =
3 3
3 3
>> B=[1;1]
B =
1
1
>> X=linsolve(A,B)
but i jsut get the response "Warning: Matrix is singular to working precision."
where am i going wrong?
6 Comments
Guillaume
on 8 Dec 2017
I'm curious as to what result you would consider correct in such case?
Dan Smith
on 8 Dec 2017
Dan Smith
on 8 Dec 2017
Dan Smith
on 8 Dec 2017
Guillaume
on 8 Dec 2017
i have absolutely no knowledge on matlab
The problem with your question is nothing to do with matlab and everything to do with mathematics.
Mathematics tell you that
[3 3 * [X1 = [1
3 3] X2] 1]
has an infinity of solutions (all points on the line y=(1-3*x)/3) and that
[3 3 * [X1 = [1
3 3] X2] 0]
has no solution.
This is really basic linear algebra.
Accepted Answer
More Answers (1)
Birdman
on 8 Dec 2017
Look, now let's solve the question by hand and see what we will see. If you multiply A*x and equal to b, you will have two equations:
3*X1+3*X2=1;
3*X1+3*X2=1;
As you see, there are infinitely many solution to the problem, which results in no unique solution. This will happen when only there is a linear dependence between A's rows or columns, which in this case we see it. Therefore this problem has infinitely many solution. Do not search for a unique one. Also, take the determinant of A, which will be zero, which will prove that rows or columns are linearly dependent of A.
6 Comments
Dan Smith
on 8 Dec 2017
Birdman
on 8 Dec 2017
It will be same thing Dan, as long as there is a linear dependence between rows and columns of A(in other words, the determinant of A is zero).
Consider A=[1 2;3 4];b=[3 5].
There will be a unique solution for this since there is no linear dependence between rows and columns of A.
Dan Smith
on 8 Dec 2017
Birdman
on 8 Dec 2017
I mean that first column of A is a real multiple of second column or vice versa. Same goes for the rows.
Dan Smith
on 8 Dec 2017
John D'Errico
on 8 Dec 2017
Edited: John D'Errico
on 8 Dec 2017
Read my answer, where I explain in some detail why that can never happen for singular A, and when a solution will exist, and why there will be infinitely many solutions.
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!