Answer the questions related to the Pythagorean identity.
a. (i) Explain why tanx is undefined when cosx=0.
b. (ii) Starting from the identity sin2x+cos2x=1, derive the identity 1+tan2x=sec2x, clearly stating the restrictions on x for which the result is valid.