import numpy as np
import numpy.linalg as la
np.random.seed(13)
xorig = np.random.randn(200)
yorig = np.random.randn(200)
zorig = np.random.randn(200)
Orthonormalize $x$ and $y$ as we know:
x = xorig/la.norm(xorig)
y = yorig
y = y - x.dot(y)*x
y = y / la.norm(y)
Check:
print(la.norm(x))
print(la.norm(y))
print(x.dot(y))
Now what to with $z$?
z = zorig
z = z - np.dot(z, x)*x - np.dot(z,y)*y
z = z / la.norm(z)
Check:
print(la.norm(z))
print(x.dot(z))
print(y.dot(z))