Roofs come in many styles, but the simplest one to build – not including flat or lean-to roofs – is probably the open gable. When properly constructed with the correct hardware, the trusses of an open gable roof evenly distribute the load of the roof and do not require any support other than the walls. To calculate truss dimensions, you can apply the Pythagorean theorem because each truss can be reduced to a pair of right-angled triangles arranged back-to-back.
Roofers call the distance between the outsides of the walls that will support the roof the "span," and they refer to half this distance as the "run." The run forms the base of a right-angled triangle with height equal to the "rise" of the roof, and the hypotenuse is formed by the "rafter." Most roofs overhang the side walls by a small amount – 12 to 18 inches – and it's important to keep this in mind when calculating rafter length.
The "pitch" of the roof, which is the amount of slope it has, is an important parameter, and while mathematicians would express this as an angle, roofers prefer to express it as a ratio. For example, a roof that rises 1 inch for every 4 inches of horizontal distance has a 1/4 pitch. The optimum pitch depends on the roof covering. For example, asphalt shingles require a minimum pitch of 2/12 for proper drainage. In most cases, pitch shouldn't exceed 12/12, or the roof becomes too dangerous to walk on.
Calculating Rafter Length From Rise
After measuring the roof span, the next step in designing a gable roof is to determine the rise, based on desired roofing material and other design considerations. This determination also affects the length of the roof rafters. Considering the entire truss as a pair of back-to-back, right-angled triangles allows you to base the calculations on the Pythagorean theorem, which tells you that a2 + b2 = c2, where a is the span, b is the rise and c is the rafter length.
If you already know the rise, it's easy to determine the rafter length by simply plugging the numbers into this equation. For example, a roof that spans 20 feet and rises 7 feet needs rafters that are the square root of 400 + 49 = 21.2 feet, not including the extra length required for the overhangs.
Calculating Rafter Length From Pitch
If you don't know the rise of the roof, you may know the pitch based on the manufacturer's recommendations for the roofing you plan to use. That's still enough information to calculate rafter length, using a simple ratio.
An illustration makes this clear: Suppose the desired pitch is 4/12. That's equivalent to a right-angled triangle with a base of 12 inches – which is 1 foot – and a rise of 4 inches. The length of the hypotenuse of this triangle is the square root of a2 + b2 = 122 + 42 = 144 in + 16 in = 12.65 inches. Let's convert that to feet, because the lengths of the span and rafter are measured in feet: 12.68 inches = 1.06 feet. The length of the hypotenuse of this small triangle is therefore 1.06 feet.
Suppose the base of the actual roof is measured to be 40 feet. You can set up the following equivalence: base of triangle/base of actual roof = hypotenuse of triangle/hypotenuse of roof. Plugging in the numbers, you get 1/40 = 1.06 /x, where x is the required rafter length. Solving for x, you get x = (40) ( 1.06) = 42.4 feet.
Now that you know the length of the rafter, you have two options for finding the rise. You can set up a similar ratio, or you can solve the Pythagorean equation. Choosing option 2, we know that the rise (b) is equal to the square root of c2 - a2, where c is the rafter length and a is the span. Therefore, the rise equals: root (42.42 - 402) = root (1,797.8 - 1,600) = 14.06 feet.