To find AB, we have to determine AP and AB first.
Segment AP:
For right triangles, we can use the trigonometric functions like tangent which is the ratio of the opposite side and the adjacent side, with respect to the angle.
tan 30 = 10/AB
AB = 10/tan30
AB = 17.32 cm
Segment PB:
We apply the same thing for the other right triangle.
tan45 = PB/8
PB = 8tan45
PB = 8 cm
Thus, AB = AP + PB = 17.32 + 8 = 25.32 cm.