Using double angle formulas in integration, trouble following an example. I have just started looking at integration and I am having trouble understanding what has been done in one of the examples in the book I am working through.  
It involves using the double angle formula for $\sin(2\theta)$ to provide a rearrangement for which an indefinite integral can then be found.
The double angle formula provided is $\sin(2\theta)=2\sin(\theta)\cos(\theta)$ and the example is as follows:
$$\int\cos\left(\frac{1}{2}x\right)\sin\left(\frac{1}{2}x\right)dx=\int\frac{1}{2}\sin\left(x\right)dx$$
$$=-\frac{1}{2}\cos\left(x\right)+c$$
The part of this example I am specifically stuck with is the first line where $\cos\left(\frac{1}{2}x\right)\sin\left(\frac{1}{2}x\right)$ is rewritten as $\frac{1}{2}\sin\left(x\right)$ using the previously stated double angle formula.

Consider $\theta = \frac{1}{2}x$.  Then
$$ \cos\left(\frac{1}{2}x\right)\sin\left(\frac{1}{2}x\right)
= \cos \theta \sin \theta$$
Notice that the double angle formula could be written:
$$ \sin \theta \cos \theta = \frac{1}{2}\sin(2\theta)$$  So the integrand is now:
$$ \cos\left(\frac{1}{2}x\right)\sin\left(\frac{1}{2}x\right)
= \cos \theta \sin \theta = \frac{1}{2} \sin(2\theta) = \frac{1}{2}\sin\left(2\cdot \frac{1}{2}x\right) = \frac{1}{2}\sin x$$
Hope this helps!
