3. Calculate:

$$
\int_{0}^{\frac{\pi}{2}} \frac{\sin ^{2} x+\sin x}{\sin x+\cos x+1} d x
$$
3. Noting:

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

and

$$
\begin{gathered}
\frac{\pi}{2}-x=t \Rightarrow 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+\cos t}{\cos t+\sin t+1} d t=\int_{0}^{\frac{\pi}{2}} \frac{\cos t+\sin t+1-\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}{\cos t+\sin t+1}\right) d t=\frac{\pi}{2}-I \Rightarrow 2 I=\frac{\pi}{2}
\end{gathered}
$$

thus

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

$\qquad$