Integrate $\int \sqrt{(x+a)(x+b)} \space dx$
I've tried to use first Euler substitution:
$$\sqrt{x^2 + (a+b)x + ab} = x + t \implies x = \frac{t^2 - ab}{a + b - 2t}$$
$$dx = \frac{-2t^2 + 2(a+b)t - 2ab}{(a + b - 2t)^2}dt$$
Then:
$$(x + a) = \frac{t^2 - 2at + a^2}{a + b - 2t} = \frac{(t-a)^2}{a + b - 2t}$$
$$(x + b) = \frac{t^2 - 2bt + b^2}{a + b - 2t} = \frac{(t-b)^2}{a + b - 2t}$$
$$\sqrt{(x+a)(x+b)} = \frac{(t-a)(t-b)}{a+b-2t} = \frac{t^2 - (a+b)t + ab}{a + b - 2t}$$
Then we have multiplication by $dx$:
$$\int \frac{t^2 - (a+b)t + ab}{a + b - 2t} \cdot \frac{-2t^2 + 2(a+b)t - 2ab}{(a + b - 2t)^2}dt = -2 \int \frac{(t^2 -(a+b)t + ab)^2}{(a+b - 2t)^3}dt$$
Substitution $ t = \sqrt{(x+a)(x+b)} - x$ doesn't help. Second Euler substitution $\sqrt{t^2 - (a+b)t + ab} = t + l$ won't help too.
Okay, another idea.
$$(x+a)(x+b) =\left (x + \frac{a+b}{2}\right)^2 - \left(\frac{a-b}{2}\right)^2$$
Then $$u = x + \frac{a+b}{2}, dx = du ; \sqrt{u^2 - (\frac{a -b}{2})^2} = \frac{a-b}{2}\sqrt{\frac{4 u^2}{(a-b)^2} - 1}$$
If we substitute $s = \sec^{-1} \frac{2u}{a-b}$:
$$\frac{a-b}{2}\sqrt{\frac{4 u^2}{(a-b)^2} - 1} = \frac{a-b}{2}\sqrt{\sec^2 s - 1} = \frac{a-b}{2} \tan s$$
As for the $ds$:
$$\sec s = \frac{2u}{a-b} \implies u = \frac{(a-b)}{2} \sec(s)$$
$$ du = \left(\frac{(a-b)}{2} \sec(s)\right)' du = \frac{(a-b)}{2} \sec u \tan u \cdot ds$$
As a result: $$\int \sqrt{(x+a)(x+b)} dx = \int \frac{(a-b)^2}{4} \tan s \tan u \sec u \cdot ds$$
Something is wrong. I have a formula for finding this integral, but still I would like to "understand" this problem. I want to find it step by step. Any ideas for solution?
Throughout this answer, for ease of syntax, all references to the Constant of Integration have been omitted.
This answer assumes that $~(a - b) \neq 0.$
Per "Calculus, Vol 1" (2nd Edition, Tom Apostol, 1966):
First Substitution:
To integrate $\displaystyle \int\sqrt{A^2 + (Cx + D)^2} ~dx,~$
use the substitution $Cx + D = A\tan(t) \implies C ~dx = A\sec^2 ~t ~dt.$
Second Substitution:
To integrate $\displaystyle \int\sqrt{(Cx + D)^2 - A^2} ~dx,~$
use the substitution $Cx + D = A\sec(t), \implies C ~dx = A\sec ~t \tan ~t ~dt.$
In the present problem,
$$\text{let} ~~~C = 1, ~D = \frac{a+b}{2}, ~A = \frac{a-b}{2} \implies $$
$$(Cx + D)^2 - A^2 = x^2 + (a+b)x + \frac{a^2 + 2ab + b^2}{4} - \frac{a^2 - 2ab + b^2}{4}$$
$$= x^2 + (a+b)x + ab = (x+a)(x+b).$$
This implies that the second substitution above will solve the problem.
Details follow:
Applying the formula
$$Cx+D = A \sec ~t, ~C ~dx = A\sec ~t ~\tan ~t \implies$$
$$\int ~\sqrt{(Cx + D)^2 - A^2} ~dx $$
$$= \int ~\sqrt{A^2(\sec^2 ~t - 1)} ~~\frac{A}{C} ~\sec ~t ~\tan ~t ~dt$$
$$= \int \frac{A^2}{C} ~\sec ~t ~\tan^2 ~t ~dt$$
$$= \frac{A^2}{C} \times \int ~\sec ~t \times (\sec^2 t - 1) ~dt$$
$$ = \frac{A^2}{C} \times \int \sec^3 t - \sec t ~dt. \tag1 $$
To resolve (1) above, the first thing to do is use a substitution to compute $~\displaystyle \int sec ~t ~dt.~$ Once this is done, you can then use integration by parts to compute $~\displaystyle \int ~\sec^3 ~t dt.$
Third Substitution
Set $~\displaystyle u = \tan\left( ~\frac{t}{2} ~\right) \implies : $
$\displaystyle ~t = 2 \arctan ~u, ~dt = \frac{2}{1+u^2} ~du$
$\displaystyle ~u^2 + 1 = \sec^2\left( ~\frac{t}{2} ~\right) \implies ~\frac{1}{u^2 + 1} = \cos^2\left( ~\frac{t}{2} ~\right)$
$\displaystyle \cos(t) = 2\cos^2\left( ~\frac{t}{2} ~\right) - 1 = \frac{2}{u^2 + 1} - 1 = \frac{1 - u^2}{1 + u^2}.$
So,
$$\int ~\sec ~t ~dt = \int ~\frac{1}{\cos t} ~dt$$
$$= \int ~\frac{1+u^2}{1-u^2} \times \frac{2 ~du}{1 + u^2}$$
$$= \int ~\left( ~\frac{1}{1 - u} + \frac{1}{1 + u} ~\right) ~du = \ln ~\left| ~\frac{1 + u}{1 - u} ~\right|.$$
Further,
$$\frac{1 + u}{1 - u} = \frac{1 + \tan\left(\frac{t}{2}\right)}{1 - \tan\left(\frac{t}{2}\right)}$$
$$= \frac{\cos\left(\frac{t}{2}\right) + \sin\left(\frac{t}{2}\right)}{\cos\left(\frac{t}{2}\right) - \sin\left(\frac{t}{2}\right)} \times \frac{\cos\left(\frac{t}{2}\right) - \sin\left(\frac{t}{2}\right)}{\cos\left(\frac{t}{2}\right) - \sin\left(\frac{t}{2}\right)}$$
$$ = \frac{\cos^2\left(\frac{t}{2}\right) - \sin^2\left(\frac{t}{2}\right)}{1 - 2\sin\left(\frac{t}{2}\right)\cos\left(\frac{t}{2}\right)} = \frac{\cos ~t}{1 - \sin ~t}.$$
Therefore,
$$\int ~\sec t ~dt = \ln ~\left| ~\frac{\cos ~t}{1 - \sin ~t} ~\right|.$$
With $~\int \sec t ~dt~$ computed, the computation of $~\sec^3 t ~dt ~$ is completed, by integration by parts.
Set $~I = \displaystyle \int ~\sec ~t ~\sec^2 ~t ~dt.$
\begin{array}{| r | r | r | r |} \hline u & \sec ~t & v & \tan ~t \\ du & \sec ~t ~\tan ~t dt & dv & sec^2 ~t ~dt \\ \hline \end{array}
Then,
$$I = \sec ~t ~\tan ~t - \int ~sec ~t \tan^2 ~t dt$$
$$= \sec ~t ~\tan ~t - \int ~(\sec^3 ~t - \sec t) ~dt$$
$$= \sec ~t ~\tan ~t - I + \int \sec ~t ~dt \implies $$
$$2I = \left( ~\sec ~t ~\tan ~t + \ln ~\left| ~\frac{\cos ~t}{1 - \sin ~t} ~\right| ~\right) \implies $$
$$\int \sec^3 ~t ~dt = I = \frac{1}{2} \times \left( ~\sec ~t ~\tan ~t + \ln ~\left| ~\frac{\cos ~t}{1 - \sin ~t} ~\right| ~\right).$$
Therefore,
$$ \frac{A^2}{C} \times \int \sec^3 t - \sec t ~dt $$
$$ = \frac{A^2}{C} \times \frac{1}{2} \times \left( ~\sec ~t ~\tan ~t - \ln ~\left| ~\frac{\cos ~t}{1 - \sin ~t} ~\right| ~\right). \tag2 $$
$\underline{\text{Putting this all together}}$
It remains to work backward, through the substitutions, starting from (2) above, to compute
$$\int \sqrt{(x+a)(x+b)} \space dx \tag3 $$
in terms of $~a~$ and $~b.$
The substitutions are:
$Cx + D = A ~\sec ~t.$
$C = 1, ~D = \dfrac{a+b}{2}, ~A = \dfrac{a-b}{2}.$
Then
$$x + \frac{a+b}{2} = \frac{a - b}{2} ~\sec ~t \implies $$
$$\cos ~t = \frac{a - b}{2x + a + b}, ~\sin ~t = \frac{2 ~\sqrt{(x+a)(x+b)}}{2x + a + b}. \tag4 $$
Now, using the values in (4) above, the expression in (2) above can be converted into an expression in $~a~$ and $~b.$
$$\frac{A^2}{C} = \frac{(a-b)^2}{4}.$$
$$\sec ~t ~\tan ~t = \frac{2 ~\sqrt{(x+a)(x+b)} ~(2x + a + b)}{(a-b)^2}.$$
$$\ln ~\left| ~\frac{\cos ~t}{1 - \sin ~t} ~\right| = \ln ~\left| ~\frac{a-b}{(2x + a + b) - 2 ~\sqrt{(x+a)(x+b)}} ~\right|.$$
So,
$$\int \sqrt{(x+a)(x+b)} \space dx = E \times (F - G),$$
where
$\displaystyle E = \frac{(a-b)^2}{8}.$
$\displaystyle F = \frac{2 ~\sqrt{(x+a)(x+b)} ~(2x + a + b)}{(a-b)^2}.$
$\displaystyle G = \ln ~\left| ~\frac{a-b}{(2x + a + b) - 2 ~\sqrt{(x+a)(x+b)}} ~\right|.$
Addendum
Soap Box:
If you have been assigned this problem from a book or class without being handed the formulas for the first, second, or third substitutions at the start of my answer, then you have a legitimate complaint with your teacher.
There is no way that you should be expected to derive these results on your own.