For regular hips and valleys, where the roof sections have the same slope and meet to form a 90-degree angle:
The hip and valley factor is a number that is multiplied by the actual run (horizontal distance) of a common rafter to determine the length of a hip or valley rafter. Repeat, the run, not the length, of a common rafter. For precision, the thickness of the ridge board and any eave overhang should be taken into account when determining the run. The hip and valley factor varies according to the slope of the roof, as shown in the table below.
For a roof slope expressed as “X-in-12” (rise-in-run), the hip and valley factor is determined by finding the square root of ((rise/run)² + 2) for the slope of the adjacent roof sections.
Divide the rise by the run (the run is 12). Square the result. Add 2. Find the square root of the result.
A roof hip!
A roof valley!
On a related note, the pitch (properly the “slope”) of a hip or valley rafter will not be the same as the pitch of the adjacent roof sections. While the slope of the common rafters are expressed as “X-in-12”, the slope of the hip and valley rafter on the same roof will be “X-in-16.97”. So where two roof sections intersect to form a 90° angle (a regular hip or valley), and each roof section has, for example, a 6-in-12 slope, the hip or valley rafter at that intersection will have a slope of 6-in-16.97.
Expressing the same thing using degrees: the roof sections in the above example have a 26.57° slope, while the hip or valley rafter will have a 19.47° slope.
Remember that the heel cut, seat cut, and head cut for a hip and valley rafter will have angles that reflect this difference in slope. Do not cut them according to a template you have been using for the common rafters.