3.291 \(\int \frac {1+x}{-\sqrt {1+x+x^2}+\sqrt {4+2 x+x^2}} \, dx\)

Optimal. Leaf size=158 \[ \frac {1}{2} \sqrt {x^2+2 x+4} (x+1)+\frac {1}{4} (2 x+1) \sqrt {x^2+x+1}-2 \sqrt {x^2+x+1}-2 \sqrt {x^2+2 x+4}-2 \sqrt {7} \tanh ^{-1}\left (\frac {5 x+1}{2 \sqrt {7} \sqrt {x^2+x+1}}\right )+2 \sqrt {7} \tanh ^{-1}\left (\frac {1-2 x}{\sqrt {7} \sqrt {x^2+2 x+4}}\right )+\frac {11}{2} \sinh ^{-1}\left (\frac {x+1}{\sqrt {3}}\right )+\frac {43}{8} \sinh ^{-1}\left (\frac {2 x+1}{\sqrt {3}}\right ) \]

________________________________________________________________________________________

Rubi [A]  time = 0.53, antiderivative size = 158, normalized size of antiderivative = 1.00, number of steps used = 36, number of rules used = 8, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.258, Rules used = {6742, 734, 843, 619, 215, 724, 206, 612} \[ \frac {1}{2} \sqrt {x^2+2 x+4} (x+1)+\frac {1}{4} (2 x+1) \sqrt {x^2+x+1}-2 \sqrt {x^2+x+1}-2 \sqrt {x^2+2 x+4}-2 \sqrt {7} \tanh ^{-1}\left (\frac {5 x+1}{2 \sqrt {7} \sqrt {x^2+x+1}}\right )+2 \sqrt {7} \tanh ^{-1}\left (\frac {1-2 x}{\sqrt {7} \sqrt {x^2+2 x+4}}\right )+\frac {11}{2} \sinh ^{-1}\left (\frac {x+1}{\sqrt {3}}\right )+\frac {43}{8} \sinh ^{-1}\left (\frac {2 x+1}{\sqrt {3}}\right ) \]

Antiderivative was successfully verified.

[In]

Int[(1 + x)/(-Sqrt[1 + x + x^2] + Sqrt[4 + 2*x + x^2]),x]

[Out]

-2*Sqrt[1 + x + x^2] + ((1 + 2*x)*Sqrt[1 + x + x^2])/4 - 2*Sqrt[4 + 2*x + x^2] + ((1 + x)*Sqrt[4 + 2*x + x^2])
/2 + (11*ArcSinh[(1 + x)/Sqrt[3]])/2 + (43*ArcSinh[(1 + 2*x)/Sqrt[3]])/8 - 2*Sqrt[7]*ArcTanh[(1 + 5*x)/(2*Sqrt
[7]*Sqrt[1 + x + x^2])] + 2*Sqrt[7]*ArcTanh[(1 - 2*x)/(Sqrt[7]*Sqrt[4 + 2*x + x^2])]

Rule 206

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTanh[(Rt[-b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[-b, 2]), x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 215

Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Simp[ArcSinh[(Rt[b, 2]*x)/Sqrt[a]]/Rt[b, 2], x] /; FreeQ[{a, b},
 x] && GtQ[a, 0] && PosQ[b]

Rule 612

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[((b + 2*c*x)*(a + b*x + c*x^2)^p)/(2*c*(2*p +
1)), x] - Dist[(p*(b^2 - 4*a*c))/(2*c*(2*p + 1)), Int[(a + b*x + c*x^2)^(p - 1), x], x] /; FreeQ[{a, b, c}, x]
 && NeQ[b^2 - 4*a*c, 0] && GtQ[p, 0] && IntegerQ[4*p]

Rule 619

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Dist[1/(2*c*((-4*c)/(b^2 - 4*a*c))^p), Subst[Int[Si
mp[1 - x^2/(b^2 - 4*a*c), x]^p, x], x, b + 2*c*x], x] /; FreeQ[{a, b, c, p}, x] && GtQ[4*a - b^2/c, 0]

Rule 724

Int[1/(((d_.) + (e_.)*(x_))*Sqrt[(a_.) + (b_.)*(x_) + (c_.)*(x_)^2]), x_Symbol] :> Dist[-2, Subst[Int[1/(4*c*d
^2 - 4*b*d*e + 4*a*e^2 - x^2), x], x, (2*a*e - b*d - (2*c*d - b*e)*x)/Sqrt[a + b*x + c*x^2]], x] /; FreeQ[{a,
b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[2*c*d - b*e, 0]

Rule 734

Int[((d_.) + (e_.)*(x_))^(m_)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[((d + e*x)^(m + 1)*(
a + b*x + c*x^2)^p)/(e*(m + 2*p + 1)), x] - Dist[p/(e*(m + 2*p + 1)), Int[(d + e*x)^m*Simp[b*d - 2*a*e + (2*c*
d - b*e)*x, x]*(a + b*x + c*x^2)^(p - 1), x], x] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ
[c*d^2 - b*d*e + a*e^2, 0] && NeQ[2*c*d - b*e, 0] && GtQ[p, 0] && NeQ[m + 2*p + 1, 0] && ( !RationalQ[m] || Lt
Q[m, 1]) &&  !ILtQ[m + 2*p, 0] && IntQuadraticQ[a, b, c, d, e, m, p, x]

Rule 843

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Dis
t[g/e, Int[(d + e*x)^(m + 1)*(a + b*x + c*x^2)^p, x], x] + Dist[(e*f - d*g)/e, Int[(d + e*x)^m*(a + b*x + c*x^
2)^p, x], x] /; FreeQ[{a, b, c, d, e, f, g, m, p}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0]
&&  !IGtQ[m, 0]

Rule 6742

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

Rubi steps

\begin {align*} \int \frac {1+x}{-\sqrt {1+x+x^2}+\sqrt {4+2 x+x^2}} \, dx &=\int \left (-\frac {1}{\sqrt {1+x+x^2}-\sqrt {4+2 x+x^2}}-\frac {x}{\sqrt {1+x+x^2}-\sqrt {4+2 x+x^2}}\right ) \, dx\\ &=-\int \frac {1}{\sqrt {1+x+x^2}-\sqrt {4+2 x+x^2}} \, dx-\int \frac {x}{\sqrt {1+x+x^2}-\sqrt {4+2 x+x^2}} \, dx\\ &=-\int \left (-\frac {\sqrt {1+x+x^2}}{3+x}-\frac {\sqrt {4+2 x+x^2}}{3+x}\right ) \, dx-\int \left (-\sqrt {1+x+x^2}+\frac {3 \sqrt {1+x+x^2}}{3+x}-\sqrt {4+2 x+x^2}+\frac {3 \sqrt {4+2 x+x^2}}{3+x}\right ) \, dx\\ &=-\left (3 \int \frac {\sqrt {1+x+x^2}}{3+x} \, dx\right )-3 \int \frac {\sqrt {4+2 x+x^2}}{3+x} \, dx+\int \sqrt {1+x+x^2} \, dx+\int \frac {\sqrt {1+x+x^2}}{3+x} \, dx+\int \sqrt {4+2 x+x^2} \, dx+\int \frac {\sqrt {4+2 x+x^2}}{3+x} \, dx\\ &=-2 \sqrt {1+x+x^2}+\frac {1}{4} (1+2 x) \sqrt {1+x+x^2}-2 \sqrt {4+2 x+x^2}+\frac {1}{2} (1+x) \sqrt {4+2 x+x^2}+\frac {3}{8} \int \frac {1}{\sqrt {1+x+x^2}} \, dx-\frac {1}{2} \int \frac {1+5 x}{(3+x) \sqrt {1+x+x^2}} \, dx-\frac {1}{2} \int \frac {-2+4 x}{(3+x) \sqrt {4+2 x+x^2}} \, dx+\frac {3}{2} \int \frac {1+5 x}{(3+x) \sqrt {1+x+x^2}} \, dx+\frac {3}{2} \int \frac {1}{\sqrt {4+2 x+x^2}} \, dx+\frac {3}{2} \int \frac {-2+4 x}{(3+x) \sqrt {4+2 x+x^2}} \, dx\\ &=-2 \sqrt {1+x+x^2}+\frac {1}{4} (1+2 x) \sqrt {1+x+x^2}-2 \sqrt {4+2 x+x^2}+\frac {1}{2} (1+x) \sqrt {4+2 x+x^2}-2 \int \frac {1}{\sqrt {4+2 x+x^2}} \, dx-\frac {5}{2} \int \frac {1}{\sqrt {1+x+x^2}} \, dx+6 \int \frac {1}{\sqrt {4+2 x+x^2}} \, dx+7 \int \frac {1}{(3+x) \sqrt {1+x+x^2}} \, dx+7 \int \frac {1}{(3+x) \sqrt {4+2 x+x^2}} \, dx+\frac {15}{2} \int \frac {1}{\sqrt {1+x+x^2}} \, dx-21 \int \frac {1}{(3+x) \sqrt {1+x+x^2}} \, dx-21 \int \frac {1}{(3+x) \sqrt {4+2 x+x^2}} \, dx+\frac {1}{8} \sqrt {3} \operatorname {Subst}\left (\int \frac {1}{\sqrt {1+\frac {x^2}{3}}} \, dx,x,1+2 x\right )+\frac {1}{4} \sqrt {3} \operatorname {Subst}\left (\int \frac {1}{\sqrt {1+\frac {x^2}{12}}} \, dx,x,2+2 x\right )\\ &=-2 \sqrt {1+x+x^2}+\frac {1}{4} (1+2 x) \sqrt {1+x+x^2}-2 \sqrt {4+2 x+x^2}+\frac {1}{2} (1+x) \sqrt {4+2 x+x^2}+\frac {3}{2} \sinh ^{-1}\left (\frac {1+x}{\sqrt {3}}\right )+\frac {3}{8} \sinh ^{-1}\left (\frac {1+2 x}{\sqrt {3}}\right )-14 \operatorname {Subst}\left (\int \frac {1}{28-x^2} \, dx,x,\frac {-1-5 x}{\sqrt {1+x+x^2}}\right )-14 \operatorname {Subst}\left (\int \frac {1}{28-x^2} \, dx,x,\frac {2-4 x}{\sqrt {4+2 x+x^2}}\right )+42 \operatorname {Subst}\left (\int \frac {1}{28-x^2} \, dx,x,\frac {-1-5 x}{\sqrt {1+x+x^2}}\right )+42 \operatorname {Subst}\left (\int \frac {1}{28-x^2} \, dx,x,\frac {2-4 x}{\sqrt {4+2 x+x^2}}\right )-\frac {\operatorname {Subst}\left (\int \frac {1}{\sqrt {1+\frac {x^2}{12}}} \, dx,x,2+2 x\right )}{\sqrt {3}}-\frac {5 \operatorname {Subst}\left (\int \frac {1}{\sqrt {1+\frac {x^2}{3}}} \, dx,x,1+2 x\right )}{2 \sqrt {3}}+\sqrt {3} \operatorname {Subst}\left (\int \frac {1}{\sqrt {1+\frac {x^2}{12}}} \, dx,x,2+2 x\right )+\frac {1}{2} \left (5 \sqrt {3}\right ) \operatorname {Subst}\left (\int \frac {1}{\sqrt {1+\frac {x^2}{3}}} \, dx,x,1+2 x\right )\\ &=-2 \sqrt {1+x+x^2}+\frac {1}{4} (1+2 x) \sqrt {1+x+x^2}-2 \sqrt {4+2 x+x^2}+\frac {1}{2} (1+x) \sqrt {4+2 x+x^2}+\frac {11}{2} \sinh ^{-1}\left (\frac {1+x}{\sqrt {3}}\right )+\frac {43}{8} \sinh ^{-1}\left (\frac {1+2 x}{\sqrt {3}}\right )-2 \sqrt {7} \tanh ^{-1}\left (\frac {1+5 x}{2 \sqrt {7} \sqrt {1+x+x^2}}\right )+2 \sqrt {7} \tanh ^{-1}\left (\frac {1-2 x}{\sqrt {7} \sqrt {4+2 x+x^2}}\right )\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.34, size = 151, normalized size = 0.96 \[ \frac {1}{8} \left (2 \left (2 \sqrt {x^2+x+1} x+2 \sqrt {x^2+2 x+4} x-7 \sqrt {x^2+x+1}-6 \sqrt {x^2+2 x+4}-8 \sqrt {7} \tanh ^{-1}\left (\frac {5 x+1}{2 \sqrt {7} \sqrt {x^2+x+1}}\right )+8 \sqrt {7} \tanh ^{-1}\left (\frac {1-2 x}{\sqrt {7} \sqrt {x^2+2 x+4}}\right )\right )+44 \sinh ^{-1}\left (\frac {x+1}{\sqrt {3}}\right )+43 \sinh ^{-1}\left (\frac {2 x+1}{\sqrt {3}}\right )\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[(1 + x)/(-Sqrt[1 + x + x^2] + Sqrt[4 + 2*x + x^2]),x]

[Out]

(44*ArcSinh[(1 + x)/Sqrt[3]] + 43*ArcSinh[(1 + 2*x)/Sqrt[3]] + 2*(-7*Sqrt[1 + x + x^2] + 2*x*Sqrt[1 + x + x^2]
 - 6*Sqrt[4 + 2*x + x^2] + 2*x*Sqrt[4 + 2*x + x^2] - 8*Sqrt[7]*ArcTanh[(1 + 5*x)/(2*Sqrt[7]*Sqrt[1 + x + x^2])
] + 8*Sqrt[7]*ArcTanh[(1 - 2*x)/(Sqrt[7]*Sqrt[4 + 2*x + x^2])]))/8

________________________________________________________________________________________

IntegrateAlgebraic [A]  time = 2.99, size = 165, normalized size = 1.04 \[ \frac {1}{2} \sqrt {x^2+2 x+4} (x-3)+\frac {1}{4} (2 x-7) \sqrt {x^2+x+1}-\frac {43}{8} \log \left (2 \sqrt {x^2+x+1}-2 x-1\right )-\frac {11}{2} \log \left (\sqrt {x^2+2 x+4}-x-1\right )-4 \sqrt {7} \tanh ^{-1}\left (-\frac {\sqrt {x^2+x+1}}{\sqrt {7}}+\frac {x}{\sqrt {7}}+\frac {3}{\sqrt {7}}\right )-4 \sqrt {7} \tanh ^{-1}\left (-\frac {\sqrt {x^2+2 x+4}}{\sqrt {7}}+\frac {x}{\sqrt {7}}+\frac {3}{\sqrt {7}}\right ) \]

Antiderivative was successfully verified.

[In]

IntegrateAlgebraic[(1 + x)/(-Sqrt[1 + x + x^2] + Sqrt[4 + 2*x + x^2]),x]

[Out]

((-7 + 2*x)*Sqrt[1 + x + x^2])/4 + ((-3 + x)*Sqrt[4 + 2*x + x^2])/2 - 4*Sqrt[7]*ArcTanh[3/Sqrt[7] + x/Sqrt[7]
- Sqrt[1 + x + x^2]/Sqrt[7]] - 4*Sqrt[7]*ArcTanh[3/Sqrt[7] + x/Sqrt[7] - Sqrt[4 + 2*x + x^2]/Sqrt[7]] - (43*Lo
g[-1 - 2*x + 2*Sqrt[1 + x + x^2]])/8 - (11*Log[-1 - x + Sqrt[4 + 2*x + x^2]])/2

________________________________________________________________________________________

fricas [A]  time = 0.73, size = 155, normalized size = 0.98 \[ \frac {1}{4} \, \sqrt {x^{2} + x + 1} {\left (2 \, x - 7\right )} + \frac {1}{2} \, \sqrt {x^{2} + 2 \, x + 4} {\left (x - 3\right )} + 2 \, \sqrt {7} \log \left (\frac {2 \, \sqrt {7} {\left (5 \, x + 1\right )} + 2 \, \sqrt {x^{2} + x + 1} {\left (5 \, \sqrt {7} - 14\right )} - 25 \, x - 5}{x + 3}\right ) + 2 \, \sqrt {7} \log \left (\frac {\sqrt {7} {\left (2 \, x - 1\right )} + \sqrt {x^{2} + 2 \, x + 4} {\left (2 \, \sqrt {7} - 7\right )} - 4 \, x + 2}{x + 3}\right ) - \frac {11}{2} \, \log \left (-x + \sqrt {x^{2} + 2 \, x + 4} - 1\right ) - \frac {43}{8} \, \log \left (-2 \, x + 2 \, \sqrt {x^{2} + x + 1} - 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1+x)/(-(x^2+x+1)^(1/2)+(x^2+2*x+4)^(1/2)),x, algorithm="fricas")

[Out]

1/4*sqrt(x^2 + x + 1)*(2*x - 7) + 1/2*sqrt(x^2 + 2*x + 4)*(x - 3) + 2*sqrt(7)*log((2*sqrt(7)*(5*x + 1) + 2*sqr
t(x^2 + x + 1)*(5*sqrt(7) - 14) - 25*x - 5)/(x + 3)) + 2*sqrt(7)*log((sqrt(7)*(2*x - 1) + sqrt(x^2 + 2*x + 4)*
(2*sqrt(7) - 7) - 4*x + 2)/(x + 3)) - 11/2*log(-x + sqrt(x^2 + 2*x + 4) - 1) - 43/8*log(-2*x + 2*sqrt(x^2 + x
+ 1) - 1)

________________________________________________________________________________________

giac [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {x + 1}{\sqrt {x^{2} + 2 \, x + 4} - \sqrt {x^{2} + x + 1}}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1+x)/(-(x^2+x+1)^(1/2)+(x^2+2*x+4)^(1/2)),x, algorithm="giac")

[Out]

integrate((x + 1)/(sqrt(x^2 + 2*x + 4) - sqrt(x^2 + x + 1)), x)

________________________________________________________________________________________

maple [A]  time = 0.03, size = 140, normalized size = 0.89




method result size



default \(-2 \sqrt {\left (3+x \right )^{2}-5 x -8}+\frac {43 \arcsinh \left (\frac {2 \left (\frac {1}{2}+x \right ) \sqrt {3}}{3}\right )}{8}+2 \sqrt {7}\, \arctanh \left (\frac {\left (-1-5 x \right ) \sqrt {7}}{14 \sqrt {\left (3+x \right )^{2}-5 x -8}}\right )-2 \sqrt {\left (3+x \right )^{2}-4 x -5}+\frac {11 \arcsinh \left (\frac {\left (1+x \right ) \sqrt {3}}{3}\right )}{2}+2 \sqrt {7}\, \arctanh \left (\frac {\left (2-4 x \right ) \sqrt {7}}{14 \sqrt {\left (3+x \right )^{2}-4 x -5}}\right )+\frac {\left (1+2 x \right ) \sqrt {x^{2}+x +1}}{4}+\frac {\left (2 x +2\right ) \sqrt {x^{2}+2 x +4}}{4}\) \(140\)



Verification of antiderivative is not currently implemented for this CAS.

[In]

int((1+x)/(-(x^2+x+1)^(1/2)+(x^2+2*x+4)^(1/2)),x,method=_RETURNVERBOSE)

[Out]

-2*((3+x)^2-5*x-8)^(1/2)+43/8*arcsinh(2/3*(1/2+x)*3^(1/2))+2*7^(1/2)*arctanh(1/14*(-1-5*x)*7^(1/2)/((3+x)^2-5*
x-8)^(1/2))-2*((3+x)^2-4*x-5)^(1/2)+11/2*arcsinh(1/3*(1+x)*3^(1/2))+2*7^(1/2)*arctanh(1/14*(2-4*x)*7^(1/2)/((3
+x)^2-4*x-5)^(1/2))+1/4*(1+2*x)*(x^2+x+1)^(1/2)+1/4*(2*x+2)*(x^2+2*x+4)^(1/2)

________________________________________________________________________________________

maxima [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {x + 1}{\sqrt {x^{2} + 2 \, x + 4} - \sqrt {x^{2} + x + 1}}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1+x)/(-(x^2+x+1)^(1/2)+(x^2+2*x+4)^(1/2)),x, algorithm="maxima")

[Out]

integrate((x + 1)/(sqrt(x^2 + 2*x + 4) - sqrt(x^2 + x + 1)), x)

________________________________________________________________________________________

mupad [F]  time = 0.00, size = -1, normalized size = -0.01 \[ \int -\frac {x+1}{\sqrt {x^2+x+1}-\sqrt {x^2+2\,x+4}} \,d x \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(-(x + 1)/((x + x^2 + 1)^(1/2) - (2*x + x^2 + 4)^(1/2)),x)

[Out]

int(-(x + 1)/((x + x^2 + 1)^(1/2) - (2*x + x^2 + 4)^(1/2)), x)

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {x + 1}{- \sqrt {x^{2} + x + 1} + \sqrt {x^{2} + 2 x + 4}}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((1+x)/(-(x**2+x+1)**(1/2)+(x**2+2*x+4)**(1/2)),x)

[Out]

Integral((x + 1)/(-sqrt(x**2 + x + 1) + sqrt(x**2 + 2*x + 4)), x)

________________________________________________________________________________________