Why this is a Pythagorean theorem problem
A roof's slope forms a right triangle: the run is the horizontal leg, the rise is the vertical leg, and the rafter itself is the hypotenuse — the sloped line connecting them. Since these are exactly the three sides of a right triangle, rafter length (before any overhang) is simply √(run² + rise²), the same Pythagorean theorem used for any right triangle's hypotenuse.
Why the overhang gets added separately, not included in the triangle
The eave overhang — the portion of the rafter that extends past the wall line to shelter it from rain — isn't part of the rise/run triangle at all, since it doesn't gain any additional height as it extends. It's simply extra length added on in a straight line continuation of the rafter's slope. This is why the formula is rafterLength = √(run² + rise²) + overhang, a simple addition rather than another squared term inside the square root.
A worked example
For a run of 6 m, a rise of 2 m, and a 0.5 m eave overhang: the Pythagorean portion is √(6² + 2²) = √40 ≈ 6.3246 m, and adding the 0.5 m overhang gives a total rafter length of about 6.8246 m. The angle for this same rise/run ratio works out to 18.43° — the identical angle as the "4 in 12" pitch example in the roof-pitch article, since 2:6 simplifies to the same ratio as 4:12.
Why getting this right matters for material ordering
Rafters are cut to length before installation, so underestimating this calculation means a rafter that doesn't reach the intended overhang, while overestimating wastes lumber (or requires trimming on site, which is manageable but avoidable with an accurate upfront calculation). Because the formula is exact geometry rather than an approximation, the main source of real-world error is inaccurate rise/run/overhang measurements going in, not the formula itself.
This is a simplified single-rafter calculation
This calculation gives the length for one straight rafter on a simple sloped roof. Roofs with more complex geometry — hips, valleys, or multiple differently pitched sections — need each distinct rafter type calculated separately using its own specific run, rise, and overhang, since a hip or valley rafter's geometry isn't a simple single right triangle the way a common rafter's is.