How can I integrate

$$\int\sqrt{\dfrac{x^2+bx+c}{x^2+ex+f}}\,dx?$$ I was thinking a substitution $$t=\frac{x^2+bx+c}{x^2+ex+f},$$ which inverts as follows:

$$(x^2+ex+f)t=x^2+bx+c$$ $$(t-1)x^2+(et-b)x+ft-c=0$$ $$x=\dfrac{b-et+\sqrt{(b-et)^2-4(t-1)(ft-c)}}{2(t-1)},$$ but I've never really dealt with integrals of this complexity with the aim of finding a closed form in terms of fundamental integral functions. The best I could do is expand the integrand as a not-so-nice power series.

  • 9
    $\begingroup$ It's probably some pile of elliptic functions. $\endgroup$ Commented Feb 1, 2023 at 0:15
  • 2
    $\begingroup$ I'd first complete-the-square for both the numerator and denominator, then relabel the constants and look for that form in an integral table $\endgroup$
    – Xoque55
    Commented Feb 1, 2023 at 17:58
  • 2
    $\begingroup$ Maple gives an answer with lots and lots of Elliptic functions. $\endgroup$
    – MasB
    Commented Feb 1, 2023 at 18:56
  • 3
    $\begingroup$ If either quadratic in the numerator or denominator happen to be perfect squares ($b^2=4c$ or $e^2=4f$), you can enforce an Euler sub $\endgroup$
    – user170231
    Commented Feb 1, 2023 at 20:27
  • 2
    $\begingroup$ Here's the full mathematica output: pastebin.com/BWgbf96d (you can probably paste this into mathematica to see it with correct formatting lol) Indeed, it is a mess of elliptic functions of the first and third kind. $\endgroup$
    – Max0815
    Commented Feb 2, 2023 at 6:14

3 Answers 3


Rewriting the integrand gives $$\int \frac{x^2 + b x + c}{\sqrt{(x^2 + b x + c)(x^2 + e x + f)}} \,dx ,$$ and---except when the quartic under the radical has a repeated root---definite integrals of functions of this form are elliptic integrals, which usually cannot be expressed in terms of elementary functions. In general these integrals can be decomposed into combinations of $3$ normal forms, namely, incomplete elliptic integrals of the first ($F$), second ($E$), and third ($\Pi$) kinds. Maple produces a general expression in terms of these functions and the the arbitrary coefficients $b, c, e, f$, but the formula is too large to reproduce here, even if you first apply a suitable affine change of variables to put the integral in the form $$\int \sqrt{\frac{(x - h)^2 \pm k}{x^2 \pm' 1}}\,dx .$$ For the special case $h = 0$ (which occurs iff $b = e$), $\pm = -$, $\pm' = -$, at least, we have the compact elliptical integral expression $$\int\sqrt\frac{x^2 - k^2}{x^2 - 1} \,dx = k E \left(x, \frac{1}{k}\right) + C .$$

The above considerations leaves just the special cases when the quartic has a repeated root, and all such cases can be managed with standard techniques. The $3$ essential cases are:

  • The repeated roots are the roots of $x^2 + b x + c$, so that the integral is essentially $$\int \frac{x + p}{\sqrt{x^2 + e x + f}} \,dx .$$
  • The repeated roots are the roots of $x^2 + d x + e$, so that the integral is essentially $$\int \frac{\sqrt{x^2 + b x + c}}{x + q} \,dx .$$
  • The quadratics $x^2 + b x + c$ and $x^2 + e x + f$ have a common root, so that the integral is essentially $$\int \sqrt{\frac{x + r}{x + s}} \,dx .$$

The first two cases can be handled using either an appropriate (hyperbolic) trigonometric substitution, depending on the sign of the discriminant $e^2 - 4f$, resp. $b^2 - 4c$, of the remaining quadratic, or Euler substitution. (If the discriminant is zero, the integrand is just a ratio of linear functions.) In the third case the rationalizing substitution $u = \sqrt{\frac{x + r}{x + s}}$ transforms the integral into $$2 (s - r) \int \frac{u^2}{(u - 1)^2} \,du ,$$ which can be managed using the method of partial fractions.

  • $\begingroup$ I'll give you the win since you did a pretty good breakdown of the whole ordeal. $\endgroup$ Commented May 5, 2023 at 18:57

Going off of Travis Willse's answer, I notice that

$$\int \frac{x^2+ax+b}{\sqrt{x^4+\alpha x^2+\beta x+\gamma}}dx$$ can be addressed as follows:

Since $$\frac{1}{\sqrt{x^4+\alpha x^2+\beta x+\gamma}}=\sum_{p,q,r\geqslant 0 }\binom{-\frac{1}{2}}{p,q,r,-\frac{1}{2}-p-q-r}\alpha^{q}\beta^r\gamma^{-\frac{1}{2}-p-q-r}x^{4p+2q+r},$$ we have

$$\int \frac{x^2+ax+b}{\sqrt{x^4+\alpha x^2+\beta x+\gamma}}dx=\int \sum_{p,q,r\geqslant 0 }\binom{-\frac{1}{2}}{p,q,r,-\frac{1}{2}-p-q-r}\alpha^{q}\beta^r\gamma^{-\frac{1}{2}-p-q-r}x^{4p+2q+r}(x^2+ax+b) dx\\=\boxed{\sum_{p,q,r\geqslant 0 }\binom{-\frac{1}{2}}{p,q,r,-\frac{1}{2}-p-q-r}\alpha^{q}\beta^r\gamma^{-\frac{1}{2}-p-q-r}\left(\frac{x^{4p+2q+r+3}}{4p+2q+r+3}+\frac{ax^{4p+2q+r+2}}{4p+2q+r+2}+\frac{bx^{4p+2q+r}}{4p+2q+r}\right) +C}$$ However, this is not the answer I'm looking for, but I put it here just so that it's out there to inspire someone.


Notice how $$\int \sqrt{\frac{x^2+\alpha x+\beta}{x^2+\gamma x +\delta}}dx=\int \frac{\sqrt{(x^2+\alpha x+\beta)(x^2+\gamma x+\delta)}}{x^2+\gamma x +\delta}dx,$$ and upon shifting $x=y-\frac{\gamma}{2}$ we obtain $$\equiv \int \frac{\sqrt{(\delta'+y^2)(\beta'+\alpha' y+y^2)}}{\delta'+y^2}dy$$ for $$\alpha'=\alpha-\gamma,\\\beta'=\beta-\frac{\alpha\gamma}{2}+\frac{\gamma^2}{4},\\\delta'=\delta-\frac{\gamma^2}{4}.$$ Now, two cases arise. Case 1: The quartic underneath the square root is a perfect quadratic. In other words:$$\sqrt{(\delta'+y^2)(\beta'+\alpha' y+y^2)}=y^2+Ay+B,\\\iff (\delta'+y^2)(\beta'+\alpha' y+y^2)=(y^2+Ay+B)^2;\\\therefore B^2=\delta'\beta',\\\therefore BA=\delta'\alpha'.$$ So $$\equiv \int \frac{y^2+Ay+B}{\delta'+y^2}dy=\int \frac{[\delta'-\delta']+y^2+Ay+B}{\delta'+y^2}dy=y+\int\frac{Ay+B-\delta'}{\delta'+y^2}dy\\ =y+\frac{A}{2}\int \frac{1}{\delta'+y^2}dy^2+\int \frac{B-\delta'}{\delta'+y^2}dy=\boxed{\boxed{y+\frac{A}{2}\ln|\delta'+y^2|+\frac{B-\delta'}{\sqrt{\delta'}}\tan^{-1}\frac{y}{\sqrt{\delta'}}+\text{const.}}}_1$$

Case 2: It isn't. The quartic is not a perfect square.

Expand the radical as a series; $$\sqrt{(\delta'+y^2)}\sqrt{(\beta'+\alpha' y+y^2)}=\sqrt{\delta'\beta'}\sum_{k,l,m\geqslant 0}\binom{\frac{1}{2}}{k}\binom{\frac{1}{2}}{l,m,\frac{1}{2}-l-m}\delta'^{-k}\beta'^{-l-m}\alpha'^ly^{k+l+2m},$$ and notice that, after short-handing the coefficients of $y$ in the series expansion as $$\boxed{C_n:=\sum_{k+l+2m=n}\frac{(\frac{1}{2})!^2\delta'^{-k}\beta'^{-l-m}\alpha'^l}{k!l!m!(\frac{1}{2}-l-m)!}},$$ we have $$\int \frac{\sqrt{(\delta'+y^2)(\beta'+\alpha' y+y^2)}}{\delta'+y^2}dy=\sqrt{\delta'\beta'}\sum_{n\geqslant 0}C_n\int \frac{y^n}{\delta'+y^2}dy,$$ requiring the integration of $$\int \frac{z^{\alpha}}{1+z^2}dz$$ in general. Omitting constants, $$\int \frac{1}{1+z^2}dz=\tan^{-1}z,\ \int \frac{z}{1+z^2}dz=\ln\sqrt{1+z^2},\ \int \frac{z^2}{1+z^2}dz=z-\tan^{-1}z,\\ \int \frac{z^3}{1+z^2}dz=\frac{z^2}{2}-\frac{1}{2}\ln \sqrt{1+z^2};$$ in general $$\boxed{\int \frac{z^{\alpha}}{1+z^2}dz=\int \frac{(1+z^2)z^{\alpha-2}-z^{\alpha-2}}{1+z^2}dz=\frac{z^{\alpha-1}}{\alpha-1}-\int \frac{z^{\alpha-2}}{1+z^2}dz}$$ for $\alpha\neq 1.$ Thus the integrals satisfy the recursion $$I_{n+2}=\frac{z^{n+1}}{n+1}-I_n$$ for $$I_0=\tan^{-1}z,\ I_1=\ln\sqrt{1+z^2}.$$ Therefore, the answer I am satisfied with is: $$\boxed{\boxed{\int \frac{\sqrt{(\delta'+y^2)(\beta'+\alpha' y+y^2)}}{\delta'+y^2}dy=\sqrt{\beta'}\sum_{n\geqslant 0}C_n\delta'^{\frac{n}{2}}I_n\left(\frac{y}{\sqrt{\delta'}}\right)+\text{const.}}}_2$$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .