Let the ladder length be L, making initial and final heights L sin alpha and L sin beta, and initial and final ground distances L cos alpha and L cos beta. The distances pulled away and slid down are a equals L cos beta minus L cos alpha and b equals L sin alpha minus L sin beta. Using trigonometric sum to product identities, a equals 2L sin (alpha plus beta) divided by 2 sin (alpha minus beta) divided by 2, and b equals 2L cos (alpha plus beta) divided by 2 sin (alpha minus beta) divided by 2. Dividing a by b gives a equals b tan (alpha plus beta) divided by 2.