Separate variables:
\(\int \frac{1}{x+2} \, dx = \int \cot \frac{1}{2} \theta \, d\theta\)
Integrate both sides:
\(\ln(x+2) = 2 \ln \sin \frac{1}{2} \theta + C\)
Use the initial condition \(x = 1\) when \(\theta = \frac{1}{3} \pi\):
\(\ln(1+2) = 2 \ln \sin \frac{1}{6} \pi + C\)
\(\ln 3 = 2 \ln \frac{1}{2} + C\)
\(C = \ln 3 - 2 \ln \frac{1}{2} = \ln 12\)
Substitute back:
\(\ln(x+2) = 2 \ln \sin \frac{1}{2} \theta + \ln 12\)
\(x+2 = 12 \sin^2 \frac{1}{2} \theta\)
Use the double angle identity \(\sin^2 \frac{1}{2} \theta = \frac{1 - \cos \theta}{2}\):
\(x+2 = 12 \cdot \frac{1 - \cos \theta}{2}\)
\(x+2 = 6(1 - \cos \theta)\)
\(x = 6 - 6 \cos \theta - 2\)
\(x = 4 - 6 \cos \theta\)