Actually either \displaystyle \begin{align*} x = r\sin{(\theta)} \end{align*} or \displaystyle \begin{align*} x = r\cos{(\theta)} \end{align*} can be substituted. The whole idea is to make use of the Pythagorean Identity to simplify the integrand to something that can be integrated.