In general, any expression of the form A\*sin(x)+B\*cos(x) can be written as C\*sin(x+D). Using the angle sum formula, this can be written as C\*(cos(D)sin(x)+sin(D)cos(x)). Comparing the original coefficients, we see that A=C\*cos(D) and B=C\*sin(D), which gives A^2 +B^2 =C^2 , which then gives you your maximum and minimum values.