To illustrate that Modified Gram-Schmidt works, consider a \(2\times 2\) matrix as in your example. I'll use sympy to make the algebra less tedious. You can make it a \(4\times 3\) simply by adjusting the parameters.

In [11]:
import sympy as sp
import sympy.matrices

from sympy import init_printing
init_printing()
In [18]:
num_rows = 2
num_cols = 2

a = sp.Matrix([[
        # Uncomment this row for symbolic math, as shown below:
        "a%d%d" % (row, col)
        
        # Uncomment this row for numerical math, as shown below:
        row+col
        
        for col in xrange(num_cols)]
        for row in xrange(num_rows)])
a
Out[18]:
$$\left[\begin{matrix}a_{00} & a_{01}\\a_{10} & a_{11}\end{matrix}\right]$$
In [19]:
a[:,0]
Out[19]:
$$\left[\begin{matrix}a_{00}\\a_{10}\end{matrix}\right]$$
In [20]:
from sympy.matrices import zeros

r = zeros(num_rows, num_cols)
q = zeros(num_rows, num_cols)
r
Out[20]:
$$\left[\begin{matrix}0 & 0\\0 & 0\end{matrix}\right]$$

What follows is just Algorithm 3.3 from the book, typed up:

In [21]:
a_mod = a.copy()

for k in range(num_cols):
    ak = a_mod[:,k]
    r[k,k] = ak.norm()
    q[:,k ] = ak/ak.norm()
    for j in range(k+1, num_cols):
        r[k,j] = q[:,k].dot(a[:,j])
        a_mod[:,j] = a_mod[:,j] - r[k,j] * q[:,k]
In [22]:
print sp.simplify(q[:,0].norm())
print sp.simplify(q[:,1].norm())
1
1

In [24]:
q
Out[24]:
$$\left[\begin{matrix}\frac{a_{00}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} & \frac{- \frac{a_{00}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} \left(\frac{a_{00} a_{01}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} + \frac{a_{10} a_{11}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}}\right) + a_{01}}{\sqrt{\left\lvert{- \frac{a_{00}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} \left(\frac{a_{00} a_{01}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} + \frac{a_{10} a_{11}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}}\right) + a_{01}}\right\rvert^{2} + \left\lvert{- \frac{a_{10}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} \left(\frac{a_{00} a_{01}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} + \frac{a_{10} a_{11}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}}\right) + a_{11}}\right\rvert^{2}}}\\\frac{a_{10}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} & \frac{- \frac{a_{10}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} \left(\frac{a_{00} a_{01}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} + \frac{a_{10} a_{11}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}}\right) + a_{11}}{\sqrt{\left\lvert{- \frac{a_{00}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} \left(\frac{a_{00} a_{01}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} + \frac{a_{10} a_{11}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}}\right) + a_{01}}\right\rvert^{2} + \left\lvert{- \frac{a_{10}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} \left(\frac{a_{00} a_{01}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} + \frac{a_{10} a_{11}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}}\right) + a_{11}}\right\rvert^{2}}}\end{matrix}\right]$$
In [25]:
r
Out[25]:
$$\left[\begin{matrix}\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}} & \frac{a_{00} a_{01}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} + \frac{a_{10} a_{11}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}}\\0 & \sqrt{\left\lvert{- \frac{a_{00}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} \left(\frac{a_{00} a_{01}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} + \frac{a_{10} a_{11}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}}\right) + a_{01}}\right\rvert^{2} + \left\lvert{- \frac{a_{10}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} \left(\frac{a_{00} a_{01}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}} + \frac{a_{10} a_{11}}{\sqrt{\left\lvert{a_{00}}\right\rvert^{2} + \left\lvert{a_{10}}\right\rvert^{2}}}\right) + a_{11}}\right\rvert^{2}}\end{matrix}\right]$$
In [23]:
sp.simplify(q * r - a)
Out[23]:
$$\left[\begin{matrix}0 & 0\\0 & 0\end{matrix}\right]$$