Well, I guess QR factorization of A\in \mathbb{R}^{m\times n} with m<n leads to A=QR=b \Rightarrow R=Q'b = \tilde{b} since Q^{-1} = Q' (Q' is the transpose of Q).

Because A has fewer rows than columns and R is upper triangular, R has structure R = (R_1, M) where R_1 is upper triangular and square, while M may be anything.

With R_1 upper triangular, it has rank m, and we can split x into x_1 of length m and x_2 of length n-m.

Then Ax=b \Rightarrow R_1 x_1 + M x_2 = \tilde{b}, or x_1 = R_1^{-1}(\tilde{b}-Mx_2)

Here, you can choose x_2 to be anything you want, e.g., x_2=0, and find a unique x_1 which satisfies Ax=b. With this procedure, x will be guaranteed to hold at least n-m zeros.

A simple example:

```
julia> using LinearAlgebra
julia> A = rand(-9:9,2,4)
2×4 Array{Int64,2}:
-1 2 5 -2
-6 -4 -1 5
julia> b=rand(-9:9,2)
2-element Array{Int64,1}:
-5
-8
julia> rank(A)
2
julia> F = qr(A);
julia> F.R
2×4 Array{Float64,2}:
6.08276 3.61678 0.164399 -4.60317
0.0 -2.63038 -5.09637 2.79478
julia> R1 = F.R[:,1:2]
2×2 Array{Float64,2}:
6.08276 3.61678
0.0 -2.63038
julia> M = F.R[:,3:end]
2×2 Array{Float64,2}:
0.164399 -4.60317
-5.09637 2.79478
julia> x1 = R1\F.Q'*b
2-element Array{Float64,1}:
2.2500000000000027
-1.3750000000000024
julia> x = vcat(x1,zeros(2))
4-element Array{Float64,1}:
2.2500000000000027
-1.3750000000000024
0.0
0.0
julia> A*x
2-element Array{Float64,1}:
-5.000000000000007
-8.000000000000007
julia> b
2-element Array{Int64,1}:
-5
-8
```

Here, I haven’t had use of matrix `M`

— since I chose x_2=0. However, if you for some reason is a fan of the Hitchhikers Guide to the Galaxy and like the number 42, you may do as follows:

```
julia> x2 = fill(42,2)
2-element Array{Int64,1}:
42
42
julia> x1 = R1\(F.Q'*b-M*x2)
2-element Array{Float64,1}:
54.75000000000007
-38.125000000000064
julia> x = vcat(x1,x2)
4-element Array{Float64,1}:
54.75000000000007
-38.125000000000064
42.0
42.0
julia> A*x
2-element Array{Float64,1}:
-5.000000000000199
-8.000000000000199
julia> b
2-element Array{Int64,1}:
-5
-8
```

NOTE: it is possible that \mathrm{rank}(A) < \min(m,n). In that case, you need to split up R further.