Final Answer
Step-by-step Solution
Specify the solving method
Apply the trigonometric identity: $\cos\left(\theta \right)^2$$=\frac{1+\cos\left(2\theta \right)}{2}$
Multiplying the fraction by $x$
Take the constant $\frac{1}{2}$ out of the integral
Divide $1$ by $2$
We can solve the integral $\int x\left(1+\cos\left(2x\right)\right)dx$ by applying integration by substitution method (also called U-Substitution). First, we must identify a section within the integral with a new variable (let's call it $u$), which when substituted makes the integral easier. We see that $2x$ it's a good candidate for substitution. Let's define a variable $u$ and assign it to the choosen part
Differentiate both sides of the equation $u=2x$
Find the derivative
The derivative of the linear function times a constant, is equal to the constant
The derivative of the linear function is equal to $1$
Now, in order to rewrite $dx$ in terms of $du$, we need to find the derivative of $u$. We need to calculate $du$, we can do that by deriving the equation above
Isolate $dx$ in the previous equation
Divide both sides of the equation by $2$
Simplifying the quotients
Rewriting $x$ in terms of $u$
Rewriting $x$ in terms of $\frac{u}{2}$
Multiplying the fraction by $1+\cos\left(u\right)$
Solve the product $u\left(1+\cos\left(u\right)\right)$
Divide fractions $\frac{\frac{u+u\cos\left(u\right)}{2}}{2}$ with Keep, Change, Flip: $\frac{a}{b}\div c=\frac{a}{b}\div\frac{c}{1}=\frac{a}{b}\times\frac{1}{c}=\frac{a}{b\cdot c}$
Factor the polynomial $u+u\cos\left(u\right)$ by it's greatest common factor (GCF): $u$
Substituting $u$, $dx$ and $x$ in the integral and simplify
Take the constant $\frac{1}{4}$ out of the integral
Divide $1$ by $4$
Multiply $\frac{1}{2}$ times $\frac{1}{4}$
Simplify the expression inside the integral
We can solve the integral $\int u\left(1+\cos\left(u\right)\right)du$ by applying integration by parts method to calculate the integral of the product of two functions, using the following formula
The derivative of the linear function is equal to $1$
First, identify $u$ and calculate $du$
Now, identify $dv$ and calculate $v$
Solve the integral
The integral of a constant is equal to the constant times the integral's variable
Apply the integral of the cosine function: $\int\cos(x)dx=\sin(x)$
Expand the integral $\int\left(u+\sin\left(u\right)\right)du$ into $2$ integrals using the sum rule for integrals, to then solve each integral separately
Now replace the values of $u$, $du$ and $v$ in the last formula
Solve the product $\frac{1}{8}\left(u\left(u+\sin\left(u\right)\right)-\int udu-\int\sin\left(u\right)du\right)$
Multiply $\frac{1}{8}$ times $2$
Replace $u$ with the value that we assigned to it in the beginning: $2x$
Solve the product $\frac{1}{8}\left(-\int udu-\int\sin\left(u\right)du\right)$
Applying the power rule for integration, $\displaystyle\int x^n dx=\frac{x^{n+1}}{n+1}$, where $n$ represents a number or constant function, in this case $n=1$
Replace $u$ with the value that we assigned to it in the beginning: $2x$
The power of a product is equal to the product of it's factors raised to the same power
The integral $-\frac{1}{8}\int udu$ results in: $-\frac{1}{4}x^2$
Apply the integral of the sine function: $\int\sin(x)dx=-\cos(x)$
Replace $u$ with the value that we assigned to it in the beginning: $2x$
The integral $-\frac{1}{8}\int\sin\left(u\right)du$ results in: $\frac{1}{8}\cos\left(2x\right)$
Gather the results of all integrals
As the integral that we are solving is an indefinite integral, when we finish integrating we must add the constant of integration $C$