The question looked fairly awful – STEP questions usually do. It was a request to sketch the function:

$g(x) = \int_{-1}^{1} \frac{1}{\sqrt{1-2xt + x^2}} dt$, for all real $x$.

Have a go, if you’d like! I’ll spoiler it below the line.

The first insight

The first thing that makes the question less awful than it looks is the realisation that, as far as the integral is concerned, $x$ is a constant. (I suppose it’s a parameter. But it doesn’t change within the integral.)

That means we’re actually trying to integrate $\int_{-1}^{1} \frac{1}{\sqrt{a+bt}} dt$, where $a$ and $b$ are functions of $x$ we don’t much care about – specifically, $a(x) = 1+x^2$ and $b(x)=-2x$.

Writing the integral as $\int_{-1}^{1} (a+bt)^{-1/2} dt$ makes is simple enough to integrate as $\left[ \frac{2}{b} (a+bt)^{1/2} \right]_{-1}^1$, or $\frac{2}{b}\left( \sqrt{a+b} - \sqrt{a-b}\right)$.

Substituting in the values of $a$ and $b$ gives us $-\frac{1}{x} \left(\sqrt{1-2x + x^2} - \sqrt{1+2x+x^2}\right)$

And this is where I fell into…

The heffalump trap

Aha!, I thought, cleverly: those are both perfect squares! That means, $g(x) = -\frac{1}{x}\left((1-x)-(1+x)\right)$ , which is 2. Job done! Simple sketch, straight line.

Do you see my error? Don’t worry if not, but award yourself a smug pat on the back if so.

$\sqrt{z^2}$ is not $z$. It’s $| z |$. You could happily put 3 into $\sqrt{1-2x+x^2}$ and get 2 out – but $(1-x)$ is -2.

The correct statement of $g(x)$ is $-\frac{1}{x}\left( | 1-x | - | 1+x|\right)$. That’s a much nastier one to sketch.

When $1-x$ and $1+x$ are both positive – that is, for $-1<x<1$, then we do get $g(x)=2$. But only over that domain.

When $x < -1$, $g(x) = -\frac{1}{x}\left( (1-x)+(1+x)\right)$, which simplifies to $g(x) = -\frac{2}{x}$.

Similarly, when $x > 1$, $g(x)$ works out to be $\frac{2}{x}$.

So instead of a straight line, we have a pedestal: outside of the straight line segment from $(-1,2)$ to $(1,2)$, we have two reciprocal curves that drop ever so pleasantly towards the axes.

I thought that was an interesting mistake! Would it have tripped you up?