Overdetermined linear system: how can the nullspace help me to find one working solution?

253 Views Asked by At

I have an overdetermined linear system and found a general solution to it with four of the twelve variables being free.

I have this assignment to use that solution and nullspace to find a working solution to the system, a solution that has only positive integers. I know that each null space vector corresponds to a free variable, right - but how to use this to find a working solution that I do not know.

I figured out a working solution that has just positive integers by solving the reduced row echelon.

Here are some examples from my Matlab code and outputs:

%The system
AB =

     1    -1     0     0     0     0     0     0     0     0     0     0     0
     0     1     1     0     0     0     0     0     0     0    -1     0   150
     0     0    -1     1     0     0     0     0     0     0     0     0    20
     0     0     0     1     1     0     0     0     0     0     0    -1   410
     0     0     0     0     1    -1     0     0     0     0     0     0   180
     0     0     0     0     0     1     1     0    -1     0     0     0   210
     0     0     0     0     0     0    -1     1     0     0     0     0    80
     1     0     0     0     0     0     0     1     0    -1     0     0   230
     0     0     0     0     0     0     0     0     1    -1     1    -1     0

%General solution by linsolve(A,b) - has 4 free variables

x =
  -60.0000
  -60.0000
  210.0000
  230.0000
  180.0000
         0
  210.0000
  290.0000
         0
         0
   -0.0000
         0

%My reduced row echelon
     1     0     0     0     0     0     0     1     0    -1     0     0   230
     0     1     0     0     0     0     0     1     0    -1     0     0   230
     0     0     1     0     0     0     0    -1     0     1    -1     0   -80
     0     0     0     1     0     0     0    -1     0     1    -1     0   -60
     0     0     0     0     1     0     0     1     0    -1     1    -1   470
     0     0     0     0     0     1     0     1     0    -1     1    -1   290
     0     0     0     0     0     0     1    -1     0     0     0     0   -80
     0     0     0     0     0     0     0     0     1    -1     1    -1     0
     0     0     0     0     0     0     0     0     0     0     0     0     0

%By hands I found that this was a working solution and all positive integers
x1 =

   210
   210
    10
    30
   440
   260
    20
   100
    70
    80
    70
    60

%the null space vectors
nullspace =

    0.4145    0.0926    0.3329    0.0217
    0.4145    0.0926    0.3329    0.0217
   -0.4035   -0.1754    0.2937    0.1090
   -0.4035   -0.1754    0.2937    0.1090
    0.1665    0.1341   -0.1503    0.4726
    0.1665    0.1341   -0.1503    0.4726
   -0.3065    0.4078    0.0292   -0.1748
   -0.3065    0.4078    0.0292   -0.1748
   -0.1400    0.5420   -0.1211    0.2978
    0.1080    0.5005    0.3621   -0.1531
    0.0110   -0.0827    0.6266    0.1306
   -0.2370   -0.0412    0.1435    0.5816
1

There are 1 best solutions below

0
On

Let $K$ be the $12 \times 4$ representing the kernel above.

By right multiplying it by the invertible matrix

$$M=\begin{pmatrix} 1 & 0 & 0 & 0\\ 4 & 2 & 1 & 1\\ 4 & 1 & 2 & 1\\ 0 & 1 & 1 & 1\end{pmatrix},$$

one gets the following matrix:

$$K'=KM=\begin{pmatrix} 2.1165&0.5398&0.7801&0.4472\\ 2.1165&0.5398&0.7801&0.4472\\ 0.0697&0.0519&0.5210&0.2273\\ 0.0697&0.0519&0.5210&0.2273\\ 0.1017&0.5905&0.3061&0.4564\\ 0.1017&0.5905&0.3061&0.4564\\ 1.4415&0.6700&0.2914&0.2622\\ 1.4415&0.6700&0.2914&0.2622\\ 1.5436&1.2607&0.5976&0.7187\\ 3.5584&1.2100&1.0716&0.7095\\ 2.1866&0.5918&1.3011&0.6745\\ 0.1722&0.6427&0.8274&0.6839 \end{pmatrix}$$

whose columns $K'_1,K'_2,K'_3,K'_4$ constitute as well a basis of the kernel (by considering its columns), with the advantage to have all its coordinates positive.

Therefore, you can get an infinite number of solutions with positive entries by adding to your particular solution any combination $a_1K'_1+a_2K'_2+a_4K'_3+a_4K'_4$ with sufficiently large positive coefficients $a_k$.

Remark: I have obtained $M$ by multiplication of $K$ by thousands of random matrices, followed by a "tuning' of the results.