Dear Uncle Colin,

I’ve been set an evil integral: $\int_0^\piby{4} \frac{\sqrt{3}}{2 + \sin(2x)}\d x$. There is a hint to use the substitution $\tan(x) = \frac{1}{2}\left( -1 + \sqrt{3}\tan(\theta)\right)$, but I can’t see how that helps in the slightest.

-- Let’s Integrate Everything!

Hello, LIE, and thank you for your message!

That, my friend, is an evil, evil integral. It took me a couple of goes. But! Let’s go through the steps in a logical order.

### Step 1: change the limits

When $x=0$, the hint gives $0 = \frac{1}{2}\left( -1 + \sqrt{3}\tan(\theta)\right)$, which means $\tan(\theta)=\frac{1}{\sqrt{3}}$ and $\theta = \piby 6$.

Similarly, when $x = \piby 4$, $\theta = \piby 3$, so at least the limits are nice.

### Step 2: replace $\d x$

To avoid @realityminus3 getting in our faces, let’s do it properly: $\d x = \diff x \theta \d \theta$, so we need to know $\diff x \theta$. I would rearrange the hint to give $2 \tan(x)+1 = \sqrt{3} \tan(\theta)$.

Differentiating implicitly with respect to $\theta$ gives $2 \sec^2(x) \diff x \theta = \sqrt{3} \sec^2(\theta)$, so $\diff x \theta = \frac{\sqrt{3}\cos^2(x)}{2 \cos^2(\theta)}$.

This makes our integral yet messier. $\int_{\piby 6}^{\piby 3} \frac{\sqrt{3}}{2 + \sin(2x)} \times \frac{\sqrt{3}\cos^2(x)}{2\cos^2(\theta)}\d \theta$.

### Step 3: tidy up and explore

However, there are things we can tidy up. The $\sqrt{3}$s combine nicely, and I think expanding the $\sin(2x)$ is a good idea:

$\int_{\piby 6}^{\piby 3} \frac{3 \cos^2(x)}{4 + 4\sin(x)\cos(x)} \times \sec^2(\theta)\d \theta$.

If we divide top and bottom by $\cos^2(x)$, we get something nicer still:

$\int_{\piby 6}^{\piby 3} \frac{3 }{4\sec^2(x) + 4\tan(x)} \times \sec^2(\theta)\d \theta$.

Aha! There’s our tan! Also, $\sec^2(x) \equiv 1 + \tan^2(x)$, so the whole of the denominator can be written in terms of $\tan(x)$.

### Step 4: tidy up any remaining $x$s

Let’s define $t = \tan(x)$ and $T = \tan(\theta)$; our substitution is $2t + 1 = \sqrt{3}T$ and the bottom of the fraction is $4t^2 + 4t + 4$. By squaring, we have $4t^2 + 4t + 1 = 3T^2$, so the bottom is clearly $3T^2 + 3$.

Now we have $\int_{\piby 6}^{\piby 3} \frac{3 }{3\tan^2(\theta)+ 3} \times \sec^2(\theta)\d \theta$.

### Step 5: Do the actual integration

That integrand, once you cancel the 3s and remember your relationship between $\tan^2(\theta)$ and $\sec^2(\theta)$, turns out to be … 1.

And $\int_{\piby 6}^{\piby 3} \d \theta$ is trivially $\piby 6$.

Phew! I’m glad I got to use ‘trivially’ at the end there. Hope that helps!

- Uncle Colin