\(\int \frac {(1-x)^n (1+x)^{-n}}{x} \, dx\) [330]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [F]
Fricas [F]
Sympy [F]
Maxima [F]
Giac [F]
Mupad [F(-1)]
Reduce [F]

Optimal result

Integrand size = 18, antiderivative size = 68 \[ \int \frac {(1-x)^n (1+x)^{-n}}{x} \, dx=-\frac {(1-x)^n (1+x)^{-n} \operatorname {Hypergeometric2F1}\left (1,n,1+n,\frac {1-x}{1+x}\right )}{n}+\frac {2^{-n} (1-x)^n \operatorname {Hypergeometric2F1}\left (n,n,1+n,\frac {1-x}{2}\right )}{n} \] Output:

-(1-x)^n*hypergeom([1, n],[1+n],(1-x)/(1+x))/n/((1+x)^n)+(1-x)^n*hypergeom 
([n, n],[1+n],1/2-1/2*x)/(2^n)/n
 

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 67, normalized size of antiderivative = 0.99 \[ \int \frac {(1-x)^n (1+x)^{-n}}{x} \, dx=\frac {2^{-n} (1-x)^n (1+x)^{-n} \left (-2^n \operatorname {Hypergeometric2F1}\left (1,n,1+n,\frac {1-x}{1+x}\right )+(1+x)^n \operatorname {Hypergeometric2F1}\left (n,n,1+n,\frac {1-x}{2}\right )\right )}{n} \] Input:

Integrate[(1 - x)^n/(x*(1 + x)^n),x]
 

Output:

((1 - x)^n*(-(2^n*Hypergeometric2F1[1, n, 1 + n, (1 - x)/(1 + x)]) + (1 + 
x)^n*Hypergeometric2F1[n, n, 1 + n, (1 - x)/2]))/(2^n*n*(1 + x)^n)
 

Rubi [A] (verified)

Time = 0.17 (sec) , antiderivative size = 68, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {140, 79, 141}

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 \frac {(1-x)^n (x+1)^{-n}}{x} \, dx\)

\(\Big \downarrow \) 140

\(\displaystyle \int \frac {(1-x)^{n-1} (x+1)^{-n}}{x}dx-\int (1-x)^{n-1} (x+1)^{-n}dx\)

\(\Big \downarrow \) 79

\(\displaystyle \int \frac {(1-x)^{n-1} (x+1)^{-n}}{x}dx+\frac {2^{-n} (1-x)^n \operatorname {Hypergeometric2F1}\left (n,n,n+1,\frac {1-x}{2}\right )}{n}\)

\(\Big \downarrow \) 141

\(\displaystyle \frac {2^{-n} (1-x)^n \operatorname {Hypergeometric2F1}\left (n,n,n+1,\frac {1-x}{2}\right )}{n}-\frac {(1-x)^n (x+1)^{-n} \operatorname {Hypergeometric2F1}\left (1,n,n+1,\frac {1-x}{x+1}\right )}{n}\)

Input:

Int[(1 - x)^n/(x*(1 + x)^n),x]
 

Output:

-(((1 - x)^n*Hypergeometric2F1[1, n, 1 + n, (1 - x)/(1 + x)])/(n*(1 + x)^n 
)) + ((1 - x)^n*Hypergeometric2F1[n, n, 1 + n, (1 - x)/2])/(2^n*n)
 

Defintions of rubi rules used

rule 79
Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(( 
a + b*x)^(m + 1)/(b*(m + 1)*(b/(b*c - a*d))^n))*Hypergeometric2F1[-n, m + 1 
, m + 2, (-d)*((a + b*x)/(b*c - a*d))], x] /; FreeQ[{a, b, c, d, m, n}, x] 
&&  !IntegerQ[m] &&  !IntegerQ[n] && GtQ[b/(b*c - a*d), 0] && (RationalQ[m] 
 ||  !(RationalQ[n] && GtQ[-d/(b*c - a*d), 0]))
 

rule 140
Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_)*((e_.) + (f_.)*(x_) 
)^(p_), x_] :> Simp[b*d^(m + n)*f^p   Int[(a + b*x)^(m - 1)/(c + d*x)^m, x] 
, x] + Int[(a + b*x)^(m - 1)*((e + f*x)^p/(c + d*x)^m)*ExpandToSum[(a + b*x 
)*(c + d*x)^(-p - 1) - (b*d^(-p - 1)*f^p)/(e + f*x)^p, x], x] /; FreeQ[{a, 
b, c, d, e, f, m, n}, x] && EqQ[m + n + p + 1, 0] && ILtQ[p, 0] && (GtQ[m, 
0] || SumSimplerQ[m, -1] ||  !(GtQ[n, 0] || SumSimplerQ[n, -1]))
 

rule 141
Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_)*((e_.) + (f_.)*(x_) 
)^(p_), x_] :> Simp[(b*c - a*d)^n*((a + b*x)^(m + 1)/((m + 1)*(b*e - a*f)^( 
n + 1)*(e + f*x)^(m + 1)))*Hypergeometric2F1[m + 1, -n, m + 2, (-(d*e - c*f 
))*((a + b*x)/((b*c - a*d)*(e + f*x)))], x] /; FreeQ[{a, b, c, d, e, f, m, 
p}, x] && EqQ[m + n + p + 2, 0] && ILtQ[n, 0] && (SumSimplerQ[m, 1] ||  !Su 
mSimplerQ[p, 1]) &&  !ILtQ[m, 0]
 
Maple [F]

\[\int \frac {\left (1-x \right )^{n} \left (1+x \right )^{-n}}{x}d x\]

Input:

int((1-x)^n/x/((1+x)^n),x)
 

Output:

int((1-x)^n/x/((1+x)^n),x)
 

Fricas [F]

\[ \int \frac {(1-x)^n (1+x)^{-n}}{x} \, dx=\int { \frac {{\left (-x + 1\right )}^{n}}{{\left (x + 1\right )}^{n} x} \,d x } \] Input:

integrate((1-x)^n/x/((1+x)^n),x, algorithm="fricas")
 

Output:

integral((-x + 1)^n/((x + 1)^n*x), x)
 

Sympy [F]

\[ \int \frac {(1-x)^n (1+x)^{-n}}{x} \, dx=\int \frac {\left (1 - x\right )^{n} \left (x + 1\right )^{- n}}{x}\, dx \] Input:

integrate((1-x)**n/x/((1+x)**n),x)
 

Output:

Integral((1 - x)**n/(x*(x + 1)**n), x)
 

Maxima [F]

\[ \int \frac {(1-x)^n (1+x)^{-n}}{x} \, dx=\int { \frac {{\left (-x + 1\right )}^{n}}{{\left (x + 1\right )}^{n} x} \,d x } \] Input:

integrate((1-x)^n/x/((1+x)^n),x, algorithm="maxima")
 

Output:

integrate((-x + 1)^n/((x + 1)^n*x), x)
 

Giac [F]

\[ \int \frac {(1-x)^n (1+x)^{-n}}{x} \, dx=\int { \frac {{\left (-x + 1\right )}^{n}}{{\left (x + 1\right )}^{n} x} \,d x } \] Input:

integrate((1-x)^n/x/((1+x)^n),x, algorithm="giac")
 

Output:

integrate((-x + 1)^n/((x + 1)^n*x), x)
 

Mupad [F(-1)]

Timed out. \[ \int \frac {(1-x)^n (1+x)^{-n}}{x} \, dx=\int \frac {{\left (1-x\right )}^n}{x\,{\left (x+1\right )}^n} \,d x \] Input:

int((1 - x)^n/(x*(x + 1)^n),x)
 

Output:

int((1 - x)^n/(x*(x + 1)^n), x)
 

Reduce [F]

\[ \int \frac {(1-x)^n (1+x)^{-n}}{x} \, dx=\int \frac {\left (1-x \right )^{n}}{\left (x +1\right )^{n} x}d x \] Input:

int((1-x)^n/x/((1+x)^n),x)
 

Output:

int(( - x + 1)**n/((x + 1)**n*x),x)