Find the function y = 2sin2x + SiNx cosx when x belongs to the maximum and minimum values of brackets - π / 2 to π / 2

Find the function y = 2sin2x + SiNx cosx when x belongs to the maximum and minimum values of brackets - π / 2 to π / 2

y=2sin2x+sinx-cosx=2-2(1-sin2x)+sinx-cosx
=2-2(sin²x+cos²x-2sinxcosx)+(sinx-cosx)
=﹣2(sinx-cosx)²+(sinx-cosx)+2
=﹣2sin²(x-π/4)+sin(x-π/4)+2
=﹣2[sin(x-π/4)-1/4]²+17/8
∵x∈[﹣π/2,π/2] ∴x-π/4∈[﹣3π/4,π/4] ∴sin(x-π/4)∈[﹣√2/2,√2/2]
When sin (x - π / 4) = 1 / 4, the maximum value of Y is 17 / 8
When sin (x - π / 4) = - 2 / 2, the minimum value of Y is - 1