Rank function returning two different values to the same matrix

5 visualizaciones (últimos 30 días)
Subash Chandar
Subash Chandar el 23 de Nov. de 2018
Editada: David Goodmanson el 24 de Nov. de 2018
a=rank(rand(100,24))
b=rank(rand(100,1)*rand(1,24))
a=24
b=1
I just wonder why the value of b is 1 and not 24. Thanks in advance.

Respuestas (1)

David Goodmanson
David Goodmanson el 23 de Nov. de 2018
Editada: David Goodmanson el 24 de Nov. de 2018
Hi Subash,
It's not the same construction process at all. Try it with smaller numbers, and integers:
m = 5;
n = 4;
A = randi(10,m,n)
b = randi(10,m,1)
c = randi(10,1,n)
B=b*c
A =
3 5 8 2
4 7 6 1
2 6 10 5
10 7 3 5
7 6 2 4
b =
8
7
8
10
10
c = 2 2 7 1
B =
16 16 56 8
14 14 49 7
16 16 56 8
20 20 70 10
20 20 70 10
matrix A is a set of random integers, and it so happens that its four rows are linearly independent, so rank = 4. (Usually, but not always, matrices with integer random number entries have the largest possible rank).
Matrix B is an outer product of a column vector and a row vector, and consequently all its rows are multiples of each other. (I picked an example where all rows are obvious integer multiples of row 4). There is only one independent column vector here, so the rank is 1.

Categorías

Más información sobre Linear Algebra en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by