\(\int (a+b x) (c+d x)^{-3+n} (e+f x)^{-n} \, dx\) [255]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [B] (verification not implemented)
Sympy [F(-2)]
Maxima [F]
Giac [B] (verification not implemented)
Mupad [B] (verification not implemented)
Reduce [F]

Optimal result

Integrand size = 24, antiderivative size = 122 \[ \int (a+b x) (c+d x)^{-3+n} (e+f x)^{-n} \, dx=\frac {(b c-a d) (c+d x)^{-2+n} (e+f x)^{1-n}}{d (d e-c f) (2-n)}+\frac {(a d f+b c f (1-n)-b d e (2-n)) (c+d x)^{-1+n} (e+f x)^{1-n}}{d (d e-c f)^2 (1-n) (2-n)} \] Output:

(-a*d+b*c)*(d*x+c)^(-2+n)*(f*x+e)^(1-n)/d/(-c*f+d*e)/(2-n)+(a*d*f+b*c*f*(1 
-n)-b*d*e*(2-n))*(d*x+c)^(-1+n)*(f*x+e)^(1-n)/d/(-c*f+d*e)^2/(1-n)/(2-n)
 

Mathematica [A] (verified)

Time = 0.10 (sec) , antiderivative size = 82, normalized size of antiderivative = 0.67 \[ \int (a+b x) (c+d x)^{-3+n} (e+f x)^{-n} \, dx=\frac {(c+d x)^{-2+n} (e+f x)^{1-n} (-a c f (-2+n)+a d e (-1+n)+a d f x+b d e (-2+n) x-b c (e+f (-1+n) x))}{(d e-c f)^2 (-2+n) (-1+n)} \] Input:

Integrate[((a + b*x)*(c + d*x)^(-3 + n))/(e + f*x)^n,x]
 

Output:

((c + d*x)^(-2 + n)*(e + f*x)^(1 - n)*(-(a*c*f*(-2 + n)) + a*d*e*(-1 + n) 
+ a*d*f*x + b*d*e*(-2 + n)*x - b*c*(e + f*(-1 + n)*x)))/((d*e - c*f)^2*(-2 
 + n)*(-1 + n))
 

Rubi [A] (verified)

Time = 0.23 (sec) , antiderivative size = 122, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.083, Rules used = {88, 48}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (a+b x) (c+d x)^{n-3} (e+f x)^{-n} \, dx\)

\(\Big \downarrow \) 88

\(\displaystyle \frac {(b c-a d) (c+d x)^{n-2} (e+f x)^{1-n}}{d (2-n) (d e-c f)}-\frac {(a d f+b c f (1-n)-b d e (2-n)) \int (c+d x)^{n-2} (e+f x)^{-n}dx}{d (2-n) (d e-c f)}\)

\(\Big \downarrow \) 48

\(\displaystyle \frac {(b c-a d) (c+d x)^{n-2} (e+f x)^{1-n}}{d (2-n) (d e-c f)}+\frac {(c+d x)^{n-1} (e+f x)^{1-n} (a d f+b c f (1-n)-b d e (2-n))}{d (1-n) (2-n) (d e-c f)^2}\)

Input:

Int[((a + b*x)*(c + d*x)^(-3 + n))/(e + f*x)^n,x]
 

Output:

((b*c - a*d)*(c + d*x)^(-2 + n)*(e + f*x)^(1 - n))/(d*(d*e - c*f)*(2 - n)) 
 + ((a*d*f + b*c*f*(1 - n) - b*d*e*(2 - n))*(c + d*x)^(-1 + n)*(e + f*x)^( 
1 - n))/(d*(d*e - c*f)^2*(1 - n)*(2 - n))
 

Defintions of rubi rules used

rule 48
Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> Simp 
[(a + b*x)^(m + 1)*((c + d*x)^(n + 1)/((b*c - a*d)*(m + 1))), x] /; FreeQ[{ 
a, b, c, d, m, n}, x] && EqQ[m + n + 2, 0] && NeQ[m, -1]
 

rule 88
Int[((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p 
_.), x_] :> Simp[(-(b*e - a*f))*(c + d*x)^(n + 1)*((e + f*x)^(p + 1)/(f*(p 
+ 1)*(c*f - d*e))), x] - Simp[(a*d*f*(n + p + 2) - b*(d*e*(n + 1) + c*f*(p 
+ 1)))/(f*(p + 1)*(c*f - d*e))   Int[(c + d*x)^n*(e + f*x)^Simplify[p + 1], 
 x], x] /; FreeQ[{a, b, c, d, e, f, n, p}, x] &&  !RationalQ[p] && SumSimpl 
erQ[p, 1]
 
Maple [A] (verified)

Time = 0.58 (sec) , antiderivative size = 161, normalized size of antiderivative = 1.32

method result size
gosper \(-\frac {\left (x d +c \right )^{n -2} \left (f x +e \right ) \left (f x +e \right )^{-n} \left (b c f n x -b d e n x +a c f n -a d e n -a d f x -b c f x +2 b d e x -2 a c f +a d e +b c e \right )}{c^{2} f^{2} n^{2}-2 c d e f \,n^{2}+d^{2} e^{2} n^{2}-3 c^{2} f^{2} n +6 c d e f n -3 d^{2} e^{2} n +2 c^{2} f^{2}-4 c d e f +2 d^{2} e^{2}}\) \(161\)
orering \(-\frac {\left (f x +e \right ) \left (x d +c \right ) \left (b c f n x -b d e n x +a c f n -a d e n -a d f x -b c f x +2 b d e x -2 a c f +a d e +b c e \right ) \left (x d +c \right )^{-3+n} \left (f x +e \right )^{-n}}{c^{2} f^{2} n^{2}-2 c d e f \,n^{2}+d^{2} e^{2} n^{2}-3 c^{2} f^{2} n +6 c d e f n -3 d^{2} e^{2} n +2 c^{2} f^{2}-4 c d e f +2 d^{2} e^{2}}\) \(166\)
parallelrisch \(\frac {\left (x^{3} \left (x d +c \right )^{-3+n} b \,d^{3} e \,f^{2} n -x^{2} \left (x d +c \right )^{-3+n} a c \,d^{2} f^{3} n +x^{2} \left (x d +c \right )^{-3+n} a \,d^{3} e \,f^{2} n -x^{2} \left (x d +c \right )^{-3+n} b \,c^{2} d \,f^{3} n +x^{2} \left (x d +c \right )^{-3+n} b \,d^{3} e^{2} f n +x^{3} \left (x d +c \right )^{-3+n} a \,d^{3} f^{3}-3 x \left (x d +c \right )^{-3+n} b c \,d^{2} e^{2} f -\left (x d +c \right )^{-3+n} a \,c^{2} d e \,f^{2} n +\left (x d +c \right )^{-3+n} a c \,d^{2} e^{2} f n -2 x^{2} \left (x d +c \right )^{-3+n} b c \,d^{2} e \,f^{2}-x \left (x d +c \right )^{-3+n} a \,c^{2} d \,f^{3} n +x \left (x d +c \right )^{-3+n} a \,d^{3} e^{2} f n +2 x \left (x d +c \right )^{-3+n} a c \,d^{2} e \,f^{2}-x \left (x d +c \right )^{-3+n} b \,c^{2} d e \,f^{2} n -x^{3} \left (x d +c \right )^{-3+n} b c \,d^{2} f^{3} n +x \left (x d +c \right )^{-3+n} b c \,d^{2} e^{2} f n +x^{3} \left (x d +c \right )^{-3+n} b c \,d^{2} f^{3}-2 x^{3} \left (x d +c \right )^{-3+n} b \,d^{3} e \,f^{2}+3 x^{2} \left (x d +c \right )^{-3+n} a c \,d^{2} f^{3}+x^{2} \left (x d +c \right )^{-3+n} b \,c^{2} d \,f^{3}-2 x^{2} \left (x d +c \right )^{-3+n} b \,d^{3} e^{2} f +2 x \left (x d +c \right )^{-3+n} a \,c^{2} d \,f^{3}-x \left (x d +c \right )^{-3+n} a \,d^{3} e^{2} f +2 \left (x d +c \right )^{-3+n} a \,c^{2} d e \,f^{2}-\left (x d +c \right )^{-3+n} a c \,d^{2} e^{2} f -\left (x d +c \right )^{-3+n} b \,c^{2} d \,e^{2} f \right ) \left (f x +e \right )^{-n}}{\left (c^{2} f^{2} n^{2}-2 c d e f \,n^{2}+d^{2} e^{2} n^{2}-3 c^{2} f^{2} n +6 c d e f n -3 d^{2} e^{2} n +2 c^{2} f^{2}-4 c d e f +2 d^{2} e^{2}\right ) d f}\) \(650\)

Input:

int((b*x+a)*(d*x+c)^(-3+n)/((f*x+e)^n),x,method=_RETURNVERBOSE)
 

Output:

-(d*x+c)^(n-2)*(f*x+e)/((f*x+e)^n)/(c^2*f^2*n^2-2*c*d*e*f*n^2+d^2*e^2*n^2- 
3*c^2*f^2*n+6*c*d*e*f*n-3*d^2*e^2*n+2*c^2*f^2-4*c*d*e*f+2*d^2*e^2)*(b*c*f* 
n*x-b*d*e*n*x+a*c*f*n-a*d*e*n-a*d*f*x-b*c*f*x+2*b*d*e*x-2*a*c*f+a*d*e+b*c* 
e)
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 324 vs. \(2 (115) = 230\).

Time = 0.11 (sec) , antiderivative size = 324, normalized size of antiderivative = 2.66 \[ \int (a+b x) (c+d x)^{-3+n} (e+f x)^{-n} \, dx=\frac {{\left (2 \, a c^{2} e f - {\left (2 \, b d^{2} e f - {\left (b c d + a d^{2}\right )} f^{2} - {\left (b d^{2} e f - b c d f^{2}\right )} n\right )} x^{3} - {\left (b c^{2} + a c d\right )} e^{2} - {\left (2 \, b d^{2} e^{2} + 2 \, b c d e f - {\left (b c^{2} + 3 \, a c d\right )} f^{2} - {\left (b d^{2} e^{2} + a d^{2} e f - {\left (b c^{2} + a c d\right )} f^{2}\right )} n\right )} x^{2} + {\left (a c d e^{2} - a c^{2} e f\right )} n + {\left (2 \, a c d e f + 2 \, a c^{2} f^{2} - {\left (3 \, b c d + a d^{2}\right )} e^{2} - {\left (b c^{2} e f + a c^{2} f^{2} - {\left (b c d + a d^{2}\right )} e^{2}\right )} n\right )} x\right )} {\left (d x + c\right )}^{n - 3}}{{\left (2 \, d^{2} e^{2} - 4 \, c d e f + 2 \, c^{2} f^{2} + {\left (d^{2} e^{2} - 2 \, c d e f + c^{2} f^{2}\right )} n^{2} - 3 \, {\left (d^{2} e^{2} - 2 \, c d e f + c^{2} f^{2}\right )} n\right )} {\left (f x + e\right )}^{n}} \] Input:

integrate((b*x+a)*(d*x+c)^(-3+n)/((f*x+e)^n),x, algorithm="fricas")
 

Output:

(2*a*c^2*e*f - (2*b*d^2*e*f - (b*c*d + a*d^2)*f^2 - (b*d^2*e*f - b*c*d*f^2 
)*n)*x^3 - (b*c^2 + a*c*d)*e^2 - (2*b*d^2*e^2 + 2*b*c*d*e*f - (b*c^2 + 3*a 
*c*d)*f^2 - (b*d^2*e^2 + a*d^2*e*f - (b*c^2 + a*c*d)*f^2)*n)*x^2 + (a*c*d* 
e^2 - a*c^2*e*f)*n + (2*a*c*d*e*f + 2*a*c^2*f^2 - (3*b*c*d + a*d^2)*e^2 - 
(b*c^2*e*f + a*c^2*f^2 - (b*c*d + a*d^2)*e^2)*n)*x)*(d*x + c)^(n - 3)/((2* 
d^2*e^2 - 4*c*d*e*f + 2*c^2*f^2 + (d^2*e^2 - 2*c*d*e*f + c^2*f^2)*n^2 - 3* 
(d^2*e^2 - 2*c*d*e*f + c^2*f^2)*n)*(f*x + e)^n)
 

Sympy [F(-2)]

Exception generated. \[ \int (a+b x) (c+d x)^{-3+n} (e+f x)^{-n} \, dx=\text {Exception raised: HeuristicGCDFailed} \] Input:

integrate((b*x+a)*(d*x+c)**(-3+n)/((f*x+e)**n),x)
                                                                                    
                                                                                    
 

Output:

Exception raised: HeuristicGCDFailed >> no luck
 

Maxima [F]

\[ \int (a+b x) (c+d x)^{-3+n} (e+f x)^{-n} \, dx=\int { \frac {{\left (b x + a\right )} {\left (d x + c\right )}^{n - 3}}{{\left (f x + e\right )}^{n}} \,d x } \] Input:

integrate((b*x+a)*(d*x+c)^(-3+n)/((f*x+e)^n),x, algorithm="maxima")
 

Output:

integrate((b*x + a)*(d*x + c)^(n - 3)/(f*x + e)^n, x)
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1049 vs. \(2 (115) = 230\).

Time = 0.15 (sec) , antiderivative size = 1049, normalized size of antiderivative = 8.60 \[ \int (a+b x) (c+d x)^{-3+n} (e+f x)^{-n} \, dx=\text {Too large to display} \] Input:

integrate((b*x+a)*(d*x+c)^(-3+n)/((f*x+e)^n),x, algorithm="giac")
 

Output:

(b*d^2*e*f*n*x^3*e^(n*log(d*x + c) - 3*log(d*x + c))/(f*x + e)^n - b*c*d*f 
^2*n*x^3*e^(n*log(d*x + c) - 3*log(d*x + c))/(f*x + e)^n + b*d^2*e^2*n*x^2 
*e^(n*log(d*x + c) - 3*log(d*x + c))/(f*x + e)^n + a*d^2*e*f*n*x^2*e^(n*lo 
g(d*x + c) - 3*log(d*x + c))/(f*x + e)^n - b*c^2*f^2*n*x^2*e^(n*log(d*x + 
c) - 3*log(d*x + c))/(f*x + e)^n - a*c*d*f^2*n*x^2*e^(n*log(d*x + c) - 3*l 
og(d*x + c))/(f*x + e)^n - 2*b*d^2*e*f*x^3*e^(n*log(d*x + c) - 3*log(d*x + 
 c))/(f*x + e)^n + b*c*d*f^2*x^3*e^(n*log(d*x + c) - 3*log(d*x + c))/(f*x 
+ e)^n + a*d^2*f^2*x^3*e^(n*log(d*x + c) - 3*log(d*x + c))/(f*x + e)^n + b 
*c*d*e^2*n*x*e^(n*log(d*x + c) - 3*log(d*x + c))/(f*x + e)^n + a*d^2*e^2*n 
*x*e^(n*log(d*x + c) - 3*log(d*x + c))/(f*x + e)^n - b*c^2*e*f*n*x*e^(n*lo 
g(d*x + c) - 3*log(d*x + c))/(f*x + e)^n - a*c^2*f^2*n*x*e^(n*log(d*x + c) 
 - 3*log(d*x + c))/(f*x + e)^n - 2*b*d^2*e^2*x^2*e^(n*log(d*x + c) - 3*log 
(d*x + c))/(f*x + e)^n - 2*b*c*d*e*f*x^2*e^(n*log(d*x + c) - 3*log(d*x + c 
))/(f*x + e)^n + b*c^2*f^2*x^2*e^(n*log(d*x + c) - 3*log(d*x + c))/(f*x + 
e)^n + 3*a*c*d*f^2*x^2*e^(n*log(d*x + c) - 3*log(d*x + c))/(f*x + e)^n + a 
*c*d*e^2*n*e^(n*log(d*x + c) - 3*log(d*x + c))/(f*x + e)^n - a*c^2*e*f*n*e 
^(n*log(d*x + c) - 3*log(d*x + c))/(f*x + e)^n - 3*b*c*d*e^2*x*e^(n*log(d* 
x + c) - 3*log(d*x + c))/(f*x + e)^n - a*d^2*e^2*x*e^(n*log(d*x + c) - 3*l 
og(d*x + c))/(f*x + e)^n + 2*a*c*d*e*f*x*e^(n*log(d*x + c) - 3*log(d*x + c 
))/(f*x + e)^n + 2*a*c^2*f^2*x*e^(n*log(d*x + c) - 3*log(d*x + c))/(f*x...
 

Mupad [B] (verification not implemented)

Time = 1.29 (sec) , antiderivative size = 358, normalized size of antiderivative = 2.93 \[ \int (a+b x) (c+d x)^{-3+n} (e+f x)^{-n} \, dx=\frac {x\,{\left (c+d\,x\right )}^{n-3}\,\left (2\,a\,c^2\,f^2-a\,d^2\,e^2-3\,b\,c\,d\,e^2-a\,c^2\,f^2\,n+a\,d^2\,e^2\,n+2\,a\,c\,d\,e\,f+b\,c\,d\,e^2\,n-b\,c^2\,e\,f\,n\right )}{{\left (e+f\,x\right )}^n\,{\left (c\,f-d\,e\right )}^2\,\left (n^2-3\,n+2\right )}+\frac {x^2\,{\left (c+d\,x\right )}^{n-3}\,\left (b\,c^2\,f^2-2\,b\,d^2\,e^2+3\,a\,c\,d\,f^2-b\,c^2\,f^2\,n+b\,d^2\,e^2\,n-2\,b\,c\,d\,e\,f-a\,c\,d\,f^2\,n+a\,d^2\,e\,f\,n\right )}{{\left (e+f\,x\right )}^n\,{\left (c\,f-d\,e\right )}^2\,\left (n^2-3\,n+2\right )}-\frac {c\,e\,{\left (c+d\,x\right )}^{n-3}\,\left (a\,d\,e-2\,a\,c\,f+b\,c\,e+a\,c\,f\,n-a\,d\,e\,n\right )}{{\left (e+f\,x\right )}^n\,{\left (c\,f-d\,e\right )}^2\,\left (n^2-3\,n+2\right )}+\frac {d\,f\,x^3\,{\left (c+d\,x\right )}^{n-3}\,\left (a\,d\,f+b\,c\,f-2\,b\,d\,e-b\,c\,f\,n+b\,d\,e\,n\right )}{{\left (e+f\,x\right )}^n\,{\left (c\,f-d\,e\right )}^2\,\left (n^2-3\,n+2\right )} \] Input:

int(((a + b*x)*(c + d*x)^(n - 3))/(e + f*x)^n,x)
 

Output:

(x*(c + d*x)^(n - 3)*(2*a*c^2*f^2 - a*d^2*e^2 - 3*b*c*d*e^2 - a*c^2*f^2*n 
+ a*d^2*e^2*n + 2*a*c*d*e*f + b*c*d*e^2*n - b*c^2*e*f*n))/((e + f*x)^n*(c* 
f - d*e)^2*(n^2 - 3*n + 2)) + (x^2*(c + d*x)^(n - 3)*(b*c^2*f^2 - 2*b*d^2* 
e^2 + 3*a*c*d*f^2 - b*c^2*f^2*n + b*d^2*e^2*n - 2*b*c*d*e*f - a*c*d*f^2*n 
+ a*d^2*e*f*n))/((e + f*x)^n*(c*f - d*e)^2*(n^2 - 3*n + 2)) - (c*e*(c + d* 
x)^(n - 3)*(a*d*e - 2*a*c*f + b*c*e + a*c*f*n - a*d*e*n))/((e + f*x)^n*(c* 
f - d*e)^2*(n^2 - 3*n + 2)) + (d*f*x^3*(c + d*x)^(n - 3)*(a*d*f + b*c*f - 
2*b*d*e - b*c*f*n + b*d*e*n))/((e + f*x)^n*(c*f - d*e)^2*(n^2 - 3*n + 2))
 

Reduce [F]

\[ \int (a+b x) (c+d x)^{-3+n} (e+f x)^{-n} \, dx=\left (\int \frac {\left (d x +c \right )^{n}}{\left (f x +e \right )^{n} c^{3}+3 \left (f x +e \right )^{n} c^{2} d x +3 \left (f x +e \right )^{n} c \,d^{2} x^{2}+\left (f x +e \right )^{n} d^{3} x^{3}}d x \right ) a +\left (\int \frac {\left (d x +c \right )^{n} x}{\left (f x +e \right )^{n} c^{3}+3 \left (f x +e \right )^{n} c^{2} d x +3 \left (f x +e \right )^{n} c \,d^{2} x^{2}+\left (f x +e \right )^{n} d^{3} x^{3}}d x \right ) b \] Input:

int((b*x+a)*(d*x+c)^(-3+n)/((f*x+e)^n),x)
 

Output:

int((c + d*x)**n/((e + f*x)**n*c**3 + 3*(e + f*x)**n*c**2*d*x + 3*(e + f*x 
)**n*c*d**2*x**2 + (e + f*x)**n*d**3*x**3),x)*a + int(((c + d*x)**n*x)/((e 
 + f*x)**n*c**3 + 3*(e + f*x)**n*c**2*d*x + 3*(e + f*x)**n*c*d**2*x**2 + ( 
e + f*x)**n*d**3*x**3),x)*b