0

I found this code to resolve a linear equation system with b=0, but I would like to know why with the first matrix only one column is returned and with the second matrix two columns are returned.

library(MASS)
Null(t(A))

R > (A <- matrix(c(1,2,3,2,4,7), ncol = 3, byrow = TRUE))
     [,1] [,2] [,3]
[1,]    1    2    3
[2,]    2    4    7
R > Null(t(A))
              [,1]
[1,] -8.944272e-01
[2,]  4.472136e-01
[3,]  7.771561e-16
R > (A <- matrix(c(1,2,3,2,4,6), ncol = 3, byrow = TRUE))
     [,1] [,2] [,3]
[1,]    1    2    3
[2,]    2    4    6
R > Null(t(A))
           [,1]       [,2]
[1,] -0.5345225 -0.8017837
[2,]  0.7745419 -0.3381871
[3,] -0.3381871  0.4927193
mickey
  • 2,168
  • 2
  • 11
  • 20

1 Answers1

2
library(MASS)

A <- matrix(c(1,2,3,2,4,7), ncol = 3, byrow = T)
t(A)
#>      [,1] [,2]
#> [1,]    1    2
#> [2,]    2    4
#> [3,]    3    7



B <- matrix(c(1,2,3,2,4,6), ncol = 3, byrow = T)
t(B)
#>      [,1] [,2]
#> [1,]    1    2
#> [2,]    2    4
#> [3,]    3    6

From the above, you can see that in your last case, all the rows are linearly combination of one another. In your 1st case, 2 rows are linear combinations. You have a rank of 2 vs 1 and thus answers of 2 vs 1.

Jrakru56
  • 1,211
  • 9
  • 16
  • 1
    Another way of saying this is to compare `qa <- qr(t(A));qa$rank` with `qb <- qr(t(B));qb$rank`. Upvote. – Rui Barradas Nov 16 '18 at 14:48
  • 1
    That's what it's call! I am ashamed to say that I was scratching my head trying to remember how a minimum basis is called. – Jrakru56 Nov 16 '18 at 14:49