I have to determine the distance along the Z-axis from O to where the upper line crosses the Z-axis and makes angle $\displaystyle \beta$ between the Z-axis and the line.

The lower line which length equals L starts at the origin and makes an angle $\displaystyle \alpha$ between the Z-axis and the line itself (so the angle between the line and the X-axis is $\displaystyle \frac{1}{2}\pi-\alpha$)

This distance along the Z-axis equals (Lcos$\displaystyle \alpha$ + Lsin$\displaystyle \alpha$cotan$\displaystyle \beta$)ez

ez is the unit vector and there should be an arrow above the letter e.

I don't understand why you can express this distance like this.

Because I'm not certain if the rest of you can see this picture, since it's posted on a secured website (login), I have posted the same picture as an attachment.