Find the maximum value of the function y = 2-sin ^ 2x + cosx and the corresponding value of X

Find the maximum value of the function y = 2-sin ^ 2x + cosx and the corresponding value of X

y=2-sin^2x+cosx=1+(cosx)^2+cosx=(cosx+1/2)^2+3/4
So, when cosx = 1, the maximum value of Y is: 3
In this case, x = 2K π