A vector is in the orthogonal complement of a subspace if and only if it is orthogonal to every vector in a basis of the subspace.

math.la.t.subspace.orthogonal_complement.basis