We have derived a quartic equation for computing the direction of an internuclear vector from residual dipolar couplings (RDCs) measured in two aligning media, and two simple trigonometric equations for computing the backbone phi-psi angles from two backbone vectors in consecutive peptide planes. These equations make it possible to compute, exactly and in constant time, the backbone phi-psi angles for a residue from RDCs in two media on any single backbone vector type. Building upon these exact solutions we have designed a novel algorithm for determining a protein backbone substructure consisting of alpha-helices and beta-sheets. Our algorithm employs a systematic search technique to refine the conformation of both alpha-helices and beta-sheets and to determine their orientations using exclusively the angular restraints from RDCs. The algorithm computes the backbone substructure employing very sparse distance restraints between pairs of alpha-helices and beta-sheets refined by the systematic search. The algorithm has been demonstrated on the protein human ubiquitin using only backboneNH RDCs, plus twelve hydrogen bonds and four NOE distance restraints. Further, our results show that both the global orientations and the conformations of alpha-helices and beta-strands can be determined with high accuracy using only two RDCs per residue. The algorithm requires, as its input, backbone resonance assignments, the identification of alpha-helices and beta-sheets as well as sparse NOE distance and hydrogen bond restraints.