Seeking extremum of univariate parameter equation How to get the maximum value of Z = (COS q) ^ 2 - 4 (sin q) ^ 2 + 2 is 3 and the minimum value is - 2?

Seeking extremum of univariate parameter equation How to get the maximum value of Z = (COS q) ^ 2 - 4 (sin q) ^ 2 + 2 is 3 and the minimum value is - 2?

Let cos ^ 2A = t, then sin ^ 2A = 1-cos ^ 2A = 1-T, 0