Calculate: integral of (sin(x)+cos(x))^2 x

Expression: $\int{ {\left( \sin\left({x}\right)+\cos\left({x}\right) \right)}^{2} } \mathrm{d} x$

Use ${\left( a+b \right)}^{2}={a}^{2}+2ab+{b}^{2}$ to expand the expression

$\int{ {\sin\left({x}\right)}^{2}+2\sin\left({x}\right)\cos\left({x}\right)+{\cos\left({x}\right)}^{2} } \mathrm{d} x$

Use ${\sin\left({t}\right)}^{2}+{\cos\left({t}\right)}^{2}=1$ to simplify the expression

$\int{ 1+2\sin\left({x}\right)\cos\left({x}\right) } \mathrm{d} x$

Use $2\sin\left({t}\right)\cos\left({t}\right)=\sin\left({2t}\right)$ to simplify the expression

$\int{ 1+\sin\left({2x}\right) } \mathrm{d} x$

Use the property of integral $\int{ f\left( x \right)\pmg\left( x \right) } \mathrm{d} x=\int{ f\left( x \right) } \mathrm{d} x\pm\int{ g\left( x \right) } \mathrm{d} x$

$\int{ 1 } \mathrm{d} x+\int{ \sin\left({2x}\right) } \mathrm{d} x$

Use $\int{ 1 } \mathrm{d} x=x$ to evaluate the integral

$x+\int{ \sin\left({2x}\right) } \mathrm{d} x$

Evaluate the indefinite integral

$x-\frac{ \cos\left({2x}\right) }{ 2 }$

Add the constant of integration $C \in ℝ$

$\begin{array} { l }x-\frac{ \cos\left({2x}\right) }{ 2 }+C,& C \in ℝ\end{array}$