No figure submitted, but presumably the following suffices.
The solar panel forms a right triangle with altitude above horizontal of 8 sin 38 and base 8 cos 38.
The height of the roof above horizontal on the same line as the altitude of the solar panel is
8 cos 38 * tan 20.
The length of the support beam is the difference between these 2 numbers.