to prove that given a vector space U and its subspace W, dim U = dim W + dim (orthogonal complement of W), would this proof work?

suppose {w1,...,wk} is an orthonormal basis for W.

assuming that dim U = n, we can extend this basis to {w1,...,wk,w_k+1,...,wn} which is a basis for U.

then {w_k+1,...,wn} must be a basis for the orthogonal complement since W is in the span of {w1,...,wk}.

so our claim follows.