Optimal orthogonal bases in optical applications