Computing $\int_{0}^1 \frac{\left( (1-x )a +x b\right)^2}{(1-x)c +x d} dx$

703 Views Asked by At

I want to find the integral of \begin{align*} \int_{0}^1 \frac{\left( (1-x )a +x b\right)^2}{(1-x)c +x d}dx \end{align*} for any $a,b$ and $c>0$ and $d>0$.

Using Wolfram-Alpha I found that the anti-derivative is given by \begin{align*} \int_{0}^1 \frac{\left( (1-x)a +x b\right)^2}{(1-x)c +x d}d x &=-\frac{x(a-b)(acx-2ac-adx+4ad-bcx-2bc+bdx)}{2(c-d)^2} -\frac{(bc-ad)^2 \ln \left(c(x-1)-d x \right) }{2(c-d)^3} \end{align*}

Now, observe that the second term has $\ln(c(x-1)-dx)$ so when I evaluated at $x=1$ we get $\ln(-d)$ which is complex number. How can this be, the argument of integral is well behaved function of $x$ on $(0,1)$?

I have tried several example but I never get a complex answer. For example

$a=5$ $b=6$, $c=10$ $d=7$ I get that \begin{align*} \int_{0}^1 \frac{\left( (1-x)a +x b\right)^2}{(1-x)c +x d}d x \approx 3.64 \end{align*}

Thanks

1

There are 1 best solutions below

8
On BEST ANSWER

Just a tip why solve the form you have and not try to start by collecting terms? $$ \frac{((1-x)a+xb)^2}{(1-x)c + xd} = \frac{((b-a)x+a)^2}{(d-c)x+c} $$ then probably go with $$ t = (d-c)x+c $$ and go from there?

$$ \int_0^1 \frac{((1-x)a+xb)^2}{(1-x)c + xd} dx = \frac{1}{d-c}\int_c^d \frac{((b-a)\left(\frac{t-c}{d-c}\right)+a)^2}{t}dt $$

lets re-arrange $$ \begin{align} ((b-a)\left(\frac{t-c}{d-c}\right)+a)^2 &=& \left(\frac{b-a}{d-c}\right)^2\left[t -c+a\frac{d-c}{b-a}\right]^2 \\ &=&\left(\frac{b-a}{d-c}\right)^2\left[t^2 + 2\left(a\frac{d-c}{b-a}-c\right)t + \left(a\frac{d-c}{b-a}-c\right)^2\right] \end{align} $$

so the integral becomes $$ \frac{1}{d-c}\left(\frac{b-a}{d-c}\right)^2\int_c^d \frac{t^2 + 2\left(a\frac{d-c}{b-a}-c\right)t + \left(a\frac{d-c}{b-a}-c\right)^2}{t}dt\\ \frac{1}{d-c}\left(\frac{b-a}{d-c}\right)^2\int_c^d t + 2\left(a\frac{d-c}{b-a}-c\right) + \left(a\frac{d-c}{b-a}-c\right)^2\frac{1}{t}dt\\ \frac{1}{d-c}\left(\frac{b-a}{d-c}\right)^2\left[\frac{t^2}{2} + 2\left(a\frac{d-c}{b-a}-c\right)t + \left(a\frac{d-c}{b-a}-c\right)^2\ln (t)\right]_c^d $$ putting in the limits we get $$ \frac{1}{d-c}\left(\frac{b-a}{d-c}\right)^2\frac{d^2-c^2}{2} + 2\frac{1}{d-c}\left(\frac{b-a}{d-c}\right)^2\frac{ad-cb}{b-a}(d-c) + \frac{1}{d-c}\left(\frac{b-a}{d-c}\right)^2\frac{1}{(b-a)^2}\left(ad-cb\right)^2\ln \left(\frac{d}{c}\right)=\\ \left(\frac{b-a}{d-c}\right)^2\frac{d+c}{2} + 2\frac{(b-a)(ad-cb)}{(d-c)^2} + \frac{\left(ad-cb\right)^2}{(d-c)^3}\ln \left(\frac{d}{c}\right)=\\ \frac{(b-a)}{2(d-c)^2}\left(bd-ac+3(ad-cb)\right) + \frac{\left(ad-cb\right)^2}{(d-c)^3}\ln \left(\frac{d}{c}\right) $$ so finally we reach this $$ -\frac{(a-b)}{2(c-d)^2}\left(bd-ac+3(ad-cb)\right) - \frac{\left(bc-ad\right)^2}{(c-d)^3}\ln \left(\frac{d}{c}\right) $$ The minus come from odd powers of terms i.e. $(b-a)^n = -(a-b)^n$ for $n$ is odd.

when comparing with wolfram we can utilise the fact that the first term only occurs for $x=1$ and in this case

$$ -\frac{(a-b)\left[ac-2ac-ad+4ad-bc-2bc+bd\right]}{2(c-d)^2} = -\frac{(a-b)\left(-ac+3ad-3bc+bd\right)}{2(c-d)^2} $$ so checks with my other calculation. The log component I will leave as an exercise.