Find the maximum and minimum of the function y = sin (x + π / 6) + cosx, (0 ≤ x ≤ π)

Find the maximum and minimum of the function y = sin (x + π / 6) + cosx, (0 ≤ x ≤ π)

y=sin(x+π/6)+cosx
=sinxcos(π/6)+cosxsin(π/6)+cosx
=(√3/2)*sinx+(3/2)cosx
=√3*[(1/2)*sinx+(√3/2)cosx]
=√3*sin(x+π/3)
Because 0 ≤ x ≤ π, that is, π / 3 ≤ x + π / 3 ≤ 4 π / 3
So - √ 3 / 2 ≤ sin (x + π / 3) ≤ 1
Then when x + π / 3 = π / 2, i.e. x = π / 6, sin (x + π / 3) = 1, the function y has the maximum value √ 3;
When x + π / 3 = 4 π / 3, that is, x = π, sin (x + π / 3) = - √ 3 / 2, the function y has a minimum value of - 3 / 2