2. Calculate $\int_{0}^{\frac{\pi}{2}} \frac{\sin ^{2} x+\sin x}{\sin x+\cos x+1} d x$.
2. Noting $\frac{\pi}{2}-x=t$ and $I=\int_{0}^{\frac{\pi}{2}} \frac{\sin ^{2} x+\sin x}{\sin x+\cos x+1} d x$ we get $I=\int_{0}^{\frac{\pi}{2}} \frac{\cos ^{2} t+\cos t}{\cos t+\sin t+1} d t=$

$$
=\int_{0}^{\frac{\pi}{2}} \frac{1-\sin ^{2} t-\sin t+\cos t+\sin t}{\cos t+\sin t+1} d t=\int_{0}^{\frac{\pi}{2}} \frac{1+\cos t+\sin t-\sin ^{2} t-\sin t}{\cos t+\sin t+1} d t
$$

Thus $\int_{0}^{\frac{\pi}{2}} \frac{1+\cos t+\sin t-\sin ^{2} t-\sin t}{\cos t+\sin t+1} d t=\int_{0}^{\frac{\pi}{2}}\left(1-\frac{\sin ^{2} t+\sin t}{\sin t+\cos t+1}\right) d t=\frac{\pi}{2}-I$,

$2 I=\frac{\pi}{2}, I=\frac{\pi}{4}$