Analytic expression for the primitive of square root of a quadratic

When you see $$ ax^2 + \underbrace{{}\quad bx\quad{}}_\text{1st-degree term} + c, $$ it may help to remember that there is a standard technique in algebra for reducing problems involving quadratic polynomials with a first-degree term to problems involving quadratic polynomials with no first-degree term. It's called "completing the square". You write $$ ax^2+bx+c = a\left( x^2 + \frac b a x\right) + c. $$ Then you need to work on $\displaystyle x^2 + \frac b a x$.

Half of the coefficient of the first-degree term is $\dfrac{b}{2a}$. If you square that and add it to this expression you're working on, you get a perfect square—i.e. something squared: $$ \underbrace{x^2 + \frac b a x} \quad +\quad \frac{b^2}{4a^2} = \left( x + \frac{b}{2a} \right)^2. $$

So \begin{align} ax^2+bx+c = a\left( x^2 + \frac b a x\right) + c & = a\left( x^2 + \frac b a x + \frac{b^2}{4a^2} \right) - a\left( \frac{b^2}{4a^2} \right) + c \\[12pt] & = a\left( x+ \frac{b}{2a} \right)^2 + \frac{4ac-b^2}{4a} \\[12pt] & au^2 + \text{constant}. \end{align}

Let's call that last constant capital $C$, and later we'll recall that it's $\dfrac{4ac-b^2}{4a}$.

Then since $u= x + \dfrac{b}{2a}$, we have $du = dx$, and the integral becomes $$ \int \sqrt{au^2+C}\,du. $$

Now we'd like a "$1$" where $C$ is, so that we can apply trigonometric identities. So do a bit of algebra: $$ \int \sqrt{au^2+C}\,du = \int \sqrt{\frac{a}{C} u^2 + 1} \, du. $$ We also need $(\text{something})^2+1$, in order to apply the identity involving $\tan^2\theta+1$. So we write: $$ \int\sqrt{\left(u\sqrt{\frac{a}{C}}\right)^2+1}\ du. $$

Then we have $$ \int \sqrt{w^2 + 1}\ du. $$ Since $w=u\sqrt{\dfrac{a}{C}}$, we have $dw = du\sqrt{\dfrac{a}{C}}$, so $du = dw\sqrt{\dfrac{C}{a}}$.

Now we have $$ \sqrt{\dfrac{C}{a}} \int \sqrt{w^2+1}\ dw. $$

This is $$ \sqrt{\dfrac{C}{a}} \int \sqrt{\tan^2\theta+1}\ \sec^2\theta\,d\theta. $$ $$ = \sqrt{\dfrac{C}{a}} \int \sec^3\theta\,d\theta. $$

In April 2007, I wrote this Wikipedia article, which has since been edited by a number of others, and by me, explaining how to treat that integral and why it matters.

Later note: The above works if $a$ and (capital) $C$ are positive. This implies (among other things) that $b^2-4ac<0$, so the quadratic polynomial cannot be factored using real numbers.