\(f(x) = sin x + cosx - 1\; \text{in}\; [0, \frac\pi2]\)
\(f'(x) = cos x - sin x\)
\(\therefore f'(x) = 0\) given
\(cos x - sin x = 0\)
⇒ \(tan x = 1\)
⇒ \(x = \frac{\pi}4\)
\(f''(x) = - sin x - cos x \)
\(f''(\frac\pi4) = -\frac{2}{\sqrt2} = -\sqrt 2 < 0\)
∴ \(x = \frac\pi4\) is point of maxima of f(x).
∴ Maximum value = \(f(\frac\pi4) = sin\frac\pi4 + cos\frac\pi 4 - 1\)
\(= \frac1{\sqrt2} + \frac1{\sqrt2} - 1 \)
\(=\sqrt2 -1\)