Rules for integrands of the form (((a Csc[e+f x]))^m)(((b Sec[e+f x]))^n)

1:  ∫(((a Csc[e+f x]))^m)(((b Sec[e+f x]))^n)dx  when  m+n-2==0 ∧ n≠1

Reference: G&R 2.510.3, CRC 334a, A&S 4.3.128b with m+n-2==0

Reference: G&R 2.510.6, CRC 334b, A&S 4.3.128a with m+n-2==0

Rule: If  m+n-2==0 ∧ n≠1, then

∫(((a Csc[e+f x]))^m)(((b Sec[e+f x]))^n)dx  ⟶  ((a b (((a Csc[e+f x]))^(m-1)) (((b Sec[e+f x]))^(n-1)))/(f (n-1)))

Program code:

Int[(a_.*csc[e_.+f_.*x_])^m_*(b_.*sec[e_.+f_.*x_])^n_,x_Symbol] :=
  a*b*(a*Csc[e+f*x])^(m-1)*(b*Sec[e+f*x])^(n-1)/(f*(n-1)) /;
FreeQ[{a,b,e,f,m,n},x] && EqQ[m+n-2,0] && NeQ[n,1]

2:  ∫((Csc[e+f x])^m)((Sec[e+f x])^n)dx  when  (m|n|((m+n)/2))∈ℤ

Derivation: Integration by substitution

Basis: If  (m|n|((m+n)/2))∈ℤ, then ((Csc[e+f x])^m) ((Sec[e+f x])^n)==(1/f)Subst[((((1+(x^2)))^(((m+n)/2)-1))/(x^m)),x,Tan[e+f x]](∂_x)Tan[e+f x]

Rule: If  (m|n|((m+n)/2))∈ℤ, then

∫((Csc[e+f x])^m)((Sec[e+f x])^n)dx  ⟶  (1/f)Subst[∫((((1+(x^2)))^(((m+n)/2)-1))/(x^m))dx,x,Tan[e+f x]]

Program code:

Int[csc[e_.+f_.*x_]^m_.*sec[e_.+f_.*x_]^n_.,x_Symbol] :=
  1/f*Subst[Int[(1+x^2)^((m+n)/2-1)/x^m,x],x,Tan[e+f*x]] /;
FreeQ[{e,f},x] && IntegersQ[m,n,(m+n)/2]

3:  ∫(((a Csc[e+f x]))^m) ((Sec[e+f x])^n)dx  when  ((n+1)/2)∈ℤ

Derivation: Integration by substitution

Basis: If ((n-1)/2)∈ℤ, then (((a Csc[e+f x]))^m) ((Sec[e+f x])^n)==-(1/(f (a^n)))Subst[((x^(m+n-1))/(((-1+((x^2)/(a^2))))^((n+1)/2))),x,a Csc[e+f x]] (∂_x)(a Csc[e+f x])

Rule: If ((n+1)/2)∈ℤ, then

∫(((a Csc[e+f x]))^m) ((Sec[e+f x])^n)dx  ⟶  -(1/(f (a^n)))Subst[∫((x^(m+n-1))/(((-1+((x^2)/(a^2))))^((n+1)/2)))dx,x,a Csc[e+f x]]

Program code:

Int[(a_.*csc[e_.+f_.*x_])^m_*sec[e_.+f_.*x_]^n_.,x_Symbol] :=
  -1/(f*a^n)*Subst[Int[x^(m+n-1)/(-1+x^2/a^2)^((n+1)/2),x],x,a*Csc[e+f*x]] /;
FreeQ[{a,e,f,m},x] && IntegerQ[(n+1)/2] && Not[IntegerQ[(m+1)/2] && LtQ[0,m,n]]

Int[(a_.*sec[e_.+f_.*x_])^m_*csc[e_.+f_.*x_]^n_.,x_Symbol] :=
  1/(f*a^n)*Subst[Int[x^(m+n-1)/(-1+x^2/a^2)^((n+1)/2),x],x,a*Sec[e+f*x]] /;
FreeQ[{a,e,f,m},x] && IntegerQ[(n+1)/2] && Not[IntegerQ[(m+1)/2] && LtQ[0,m,n]]

4.  ∫(((a Csc[e+f x]))^m)(((b Sec[e+f x]))^n)dx  when  m>1

1:  ∫(((a Csc[e+f x]))^m) (((b Sec[e+f x]))^n)dx  when  m>1 ∧ n<-1

Reference: G&R 2.510.1

Reference: G&R 2.510.4

Rule: If  m>1 ∧ n<-1, then

∫(((a Csc[e+f x]))^m) (((b Sec[e+f x]))^n)dx  ⟶  
-((a(((a Csc[e+f x]))^(m-1)) (((b Sec[e+f x]))^(n+1)))/(f b(m-1)))+(((a^2)(n+1))/((b^2)(m-1)))∫(((a Csc[e+f x]))^(m-2)) (((b Sec[e+f x]))^(n+2))dx

Program code:

Int[(a_.*csc[e_.+f_.*x_])^m_*(b_.*sec[e_.+f_.*x_])^n_,x_Symbol] :=
  -a*(a*Csc[e+f*x])^(m-1)*(b*Sec[e+f*x])^(n+1)/(f*b*(m-1)) + 
  a^2*(n+1)/(b^2*(m-1))*Int[(a*Csc[e+f*x])^(m-2)*(b*Sec[e+f*x])^(n+2),x] /;
FreeQ[{a,b,e,f},x] && GtQ[m,1] && LtQ[n,-1] && IntegersQ[2*m,2*n]

Int[(a_.*csc[e_.+f_.*x_])^m_*(b_.*sec[e_.+f_.*x_])^n_,x_Symbol] :=
  b*(a*Csc[e+f*x])^(m+1)*(b*Sec[e+f*x])^(n-1)/(f*a*(n-1)) + 
  b^2*(m+1)/(a^2*(n-1))*Int[(a*Csc[e+f*x])^(m+2)*(b*Sec[e+f*x])^(n-2),x] /;
FreeQ[{a,b,e,f},x] && GtQ[n,1] && LtQ[m,-1] && IntegersQ[2*m,2*n]

2:  ∫(((a Csc[e+f x]))^m) (((b Sec[e+f x]))^n)dx  when  m>1

Reference: G&R 2.510.2, CRC 323b, A&S 4.3.127b

Reference: G&R 2.510.5, CRC 323a, A&S 4.3.127a

Rule: If  m>1, then

∫(((a Csc[e+f x]))^m) (((b Sec[e+f x]))^n)dx  ⟶  
-((a b(((a Csc[e+f x]))^(m-1)) (((b Sec[e+f x]))^(n-1)))/(f (m-1)))+(((a^2)(m+n-2))/(m-1))∫(((a Csc[e+f x]))^(m-2)) (((b Sec[e+f x]))^n)dx

Program code:

Int[(a_.*csc[e_.+f_.*x_])^m_*(b_.*sec[e_.+f_.*x_])^n_.,x_Symbol] :=
  -a*b*(a*Csc[e+f*x])^(m-1)*(b*Sec[e+f*x])^(n-1)/(f*(m-1)) + 
  a^2*(m+n-2)/(m-1)*Int[(a*Csc[e+f*x])^(m-2)*(b*Sec[e+f*x])^n,x] /;
FreeQ[{a,b,e,f,n},x] && GtQ[m,1] && IntegersQ[2*m,2*n] && Not[GtQ[n,m]]

Int[(a_.*csc[e_.+f_.*x_])^m_.*(b_.*sec[e_.+f_.*x_])^n_,x_Symbol] :=
  a*b*(a*Csc[e+f*x])^(m-1)*(b*Sec[e+f*x])^(n-1)/(f*(n-1)) + 
  b^2*(m+n-2)/(n-1)*Int[(a*Csc[e+f*x])^m*(b*Sec[e+f*x])^(n-2),x] /;
FreeQ[{a,b,e,f,m},x] && GtQ[n,1] && IntegersQ[2*m,2*n]

5:  ∫(((a Csc[e+f x]))^m) (((b Sec[e+f x]))^n)dx  when  m<-1 ∧ m+n≠0

Reference: G&R 2.510.3, CRC 334a, A&S 4.3.128b

Reference: G&R 2.510.6, CRC 334b, A&S 4.3.128a

Rule: If  m<-1 ∧ m+n≠0, then

∫(((a Csc[e+f x]))^m) (((b Sec[e+f x]))^n)dx  ⟶  ((b (((a Csc[e+f x]))^(m+1)) (((b Sec[e+f x]))^(n-1)))/(a f(m+n)))+((m+1)/((a^2)(m+n)))∫(((a Csc[e+f x]))^(m+2)) (((b Sec[e+f x]))^n)dx

Program code:

Int[(a_.*csc[e_.+f_.*x_])^m_*(b_.*sec[e_.+f_.*x_])^n_.,x_Symbol] :=
  b*(a*Csc[e+f*x])^(m+1)*(b*Sec[e+f*x])^(n-1)/(a*f*(m+n)) + 
  (m+1)/(a^2*(m+n))*Int[(a*Csc[e+f*x])^(m+2)*(b*Sec[e+f*x])^n,x] /;
FreeQ[{a,b,e,f,n},x] && LtQ[m,-1] && NeQ[m+n,0] && IntegersQ[2*m,2*n]

Int[(a_.*csc[e_.+f_.*x_])^m_.*(b_.*sec[e_.+f_.*x_])^n_,x_Symbol] :=
  -a*(a*Csc[e+f*x])^(m-1)*(b*Sec[e+f*x])^(n+1)/(b*f*(m+n)) + 
  (n+1)/(b^2*(m+n))*Int[(a*Csc[e+f*x])^m*(b*Sec[e+f*x])^(n+2),x] /;
FreeQ[{a,b,e,f,m},x] && LtQ[n,-1] && NeQ[m+n,0] && IntegersQ[2*m,2*n]

6:  ∫(((a Csc[e+f x]))^m) (((b Sec[e+f x]))^n)dx  when  n∉ℤ ∧ m+n==0

Derivation: Piecewise constant extraction

Basis: If  m+n==0, then (∂_x)(((((a Csc[e+f x]))^m)(((b Sec[e+f x]))^n))/((Tan[e+f x])^n))==0

Rule: If  n∉ℤ ∧ m+n==0, then

∫(((a Csc[e+f x]))^m) (((b Sec[e+f x]))^n)dx  ⟶  (((((a Csc[e+f x]))^m)(((b Sec[e+f x]))^n))/((Tan[e+f x])^n))∫((Tan[e+f x])^n)dx

Program code:

Int[(a_.*csc[e_.+f_.*x_])^m_*(b_.*sec[e_.+f_.*x_])^n_,x_Symbol] :=
  (a*Csc[e+f*x])^m*(b*Sec[e+f*x])^n/Tan[e+f*x]^n*Int[Tan[e+f*x]^n,x] /;
FreeQ[{a,b,e,f,m,n},x] && Not[IntegerQ[n]] && EqQ[m+n,0]

7.  ∫(((a Csc[e+f x]))^m)(((b Sec[e+f x]))^n)dx

1:  ∫(((a Csc[e+f x]))^m) (((b Sec[e+f x]))^n)dx  when  m-(1/2)∈ℤ ∧ n-(1/2)∈ℤ

Derivation: Piecewise constant extraction

Basis: (∂_x)((((a Csc[e+f x]))^m) (((b Sec[e+f x]))^n) (((a Sin[e+f x]))^m) (((b Cos[e+f x]))^n))==0

Rule: If m-(1/2)∈ℤ ∧ n-(1/2)∈ℤ, then

∫(((a Csc[e+f x]))^m) (((b Sec[e+f x]))^n)dx  ⟶  
(((a Csc[e+f x]))^m) (((b Sec[e+f x]))^n) (((a Sin[e+f x]))^m) (((b Cos[e+f x]))^n)∫(((a Sin[e+f x]))^(-m)) (((b Cos[e+f x]))^(-n))dx

Program code:

Int[(a_.*csc[e_.+f_.*x_])^m_*(b_.*sec[e_.+f_.*x_])^n_,x_Symbol] :=
  (a*Csc[e+f*x])^m*(b*Sec[e+f*x])^n*(a*Sin[e+f*x])^m*(b*Cos[e+f*x])^n*Int[(a*Sin[e+f*x])^(-m)*(b*Cos[e+f*x])^(-n),x] /;
FreeQ[{a,b,e,f,m,n},x] && IntegerQ[m-1/2] && IntegerQ[n-1/2]

2:  ∫(((a Csc[e+f x]))^m) (((b Sec[e+f x]))^n)dx

Derivation: Piecewise constant extraction

Basis: (∂_x)((((a Csc[e+f x]))^m) (((b Sec[e+f x]))^n) (((a Sin[e+f x]))^m) (((b Cos[e+f x]))^n))==0

Rule:

∫(((a Csc[e+f x]))^m) (((b Sec[e+f x]))^n)dx  ⟶  
((a^2)/(b^2)) (((a Csc[e+f x]))^(m-1)) (((b Sec[e+f x]))^(n+1)) (((a Sin[e+f x]))^(m-1)) (((b Cos[e+f x]))^(n+1))∫(((a Sin[e+f x]))^(-m)) (((b Cos[e+f x]))^(-n))dx

Program code:

Int[(a_.*csc[e_.+f_.*x_])^m_*(b_.*sec[e_.+f_.*x_])^n_,x_Symbol] :=
  a^2/b^2*(a*Csc[e+f*x])^(m-1)*(b*Sec[e+f*x])^(n+1)*(a*Sin[e+f*x])^(m-1)*(b*Cos[e+f*x])^(n+1)*
    Int[(a*Sin[e+f*x])^(-m)*(b*Cos[e+f*x])^(-n),x] /;
FreeQ[{a,b,e,f,m,n},x] && Not[SimplerQ[-m,-n]]

Int[(a_.*sec[e_.+f_.*x_])^m_*(b_.*csc[e_.+f_.*x_])^n_,x_Symbol] :=
  a^2/b^2*(a*Sec[e+f*x])^(m-1)*(b*Csc[e+f*x])^(n+1)*(a*Cos[e+f*x])^(m-1)*(b*Sin[e+f*x])^(n+1)*
    Int[(a*Cos[e+f*x])^(-m)*(b*Sin[e+f*x])^(-n),x] /;
FreeQ[{a,b,e,f,m,n},x]