This is very simple, in the image attached, you can see for the angle theta in the right angled triangle, AC is the p [perpendicular], BC is the b [base] and AB is h [hypotenuse].
Cos^2theta + sin^2 theta can be written as :-
..........[because cos theta = b/h and sin theta = p/h]
So, since b^2 + p^2 = h^2 [pythagoras theorem], we can write
as h^2/h^2 = 1.