Determine the horizontal distance from the edge of the wall to a point directly beneath the ridge of the roof. This should be stated on the building plans. The ridge often runs along the center of the building, so it is halfway between the front and back walls. For example, in a house 40 feet wide with a central roof ridge, it will be 20 feet from the wall.
Determine the height of the roof by consulting the design drawings or plans for the building. If the plans don't state the height of the roof area, just subtract the "ground to top of the wall" height from the total height of the building. The result is the height of the roof section. For example, if the total height of the building is 35 feet, and the ground to top of the wall height is 20 feet, the roof section has a height of 15 feet -- 35 minus 20 equals 15.
Calculate the angle for the roof rafter by substituting the height and width into this equation: Tangent of angle = height of roof section / horizontal distance from wall to ridge. The result is the tangent of the angle. For example, given a roof height of 15 feet and a horizontal width of 20 feet, the tangent of the angle is 15/20, or 0.75.
Convert the tangent of the angle to the actual angle by ascertaining the arc-tangent of the value obtained in step 3. Use the arc-tangent function on your calculator to perform the calculation. The arc-tangent of 0.75 is 36.86, so the angle is 36.86 degrees. You can't measure fractions of a degree on a roof, so round the value up or down to the nearest whole number. In this example, the nearest whole number is 37, so estimate the rafter angle to be 37 degrees.
Calculate the length of the rafter by using Pythagorean theorem, an equation stating that the width of the building squared plus the height squared equals the square of the rafter length. Substitute the height and width into this equation: height^2 + width^2 = rafter length^2, where ^2 means squared, or multiplied by itself. Using the example values from previous steps the equation becomes 15^2 + 20^2 = rafter length^2.
Solve the original equation by calculating the individual values and arriving at a value for rafter length^2. For example, 15^2 + 20^2 can be reduced to 225 + 400 and then reduced further to 625. The result, using the example data, is that rafter length^2 equals 625.
Calculate the square root of rafter length^2 to determine the length of the rafter. For example, the square root of 625 is 25, so the rafter length is 25 feet.