解线性方程组b = 0

时间:2018-11-16 14:12:10

标签: r equation linear-equation

我找到了这段代码来解析b = 0的线性方程组,但是我想知道为什么对于第一个矩阵仅返回一列,而对于第二个矩阵则返回两列。

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

1 个答案:

答案 0 :(得分: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

从上面可以看到,在最后一种情况下,所有行都是线性组合的。在第一种情况下,两行是线性组合。 您的排名是2比1,因此答案是2比1。