Take the integral: cos ( 2 x ) sec ( 3 x ) d x Write   cos ( 2 x ) sec ( 3 x )   as   cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) - sin 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x )   =   ( cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) - sin 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) ) d x Integrate   the   sum   term   by   term   and   factor   out   constants:    =   - sin 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) d x + cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) d x ⁠  Multiply   numerator   and   denominator   of   sin 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x )   by   - cot ( x ) csc 3 ( x )   =   - - cot ( x ) csc ( x ) 3 cot 2 ( x ) - cot 4 ( x ) d x + cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) d x ⁠  Prepare   to   substitute   u = csc ( x )   Rewrite   - cot ( x ) csc ( x ) 3 cot 2 ( x ) - cot 4 ( x )   using   cot 2 ( x ) = csc 2 ( x ) - 1   =   - - cot ( x ) csc ( x ) - 4 + 5 csc 2 ( x ) - csc 4 ( x ) d x + cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) d x For   the   integrand   - cot ( x ) csc ( x ) - 4 + 5 csc 2 ( x ) - csc 4 ( x )   substitute   u = csc ( x )   and   d u = - cot ( x ) csc ( x )    d x   =   - 1 - u 4 + 5 u 2 - 4 d u + cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) d x For   the   integrand   1 - u 4 + 5 u 2 - 4   use   partial   fractions:    =   - ( 1 6 ( u - 1 ) - 1 6 ( u + 1 ) + 1 12 ( u + 2 ) - 1 12 ( u - 2 ) ) d u + cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) d x Integrate   the   sum   term   by   term   and   factor   out   constants:    =   - 1 12 1 u + 2 d u + 1 6 1 u + 1 d u - 1 6 1 u - 1 d u + 1 12 1 u - 2 d u + cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) d x For   the   integrand   1 u + 2   substitute   s = u + 2   and   d s =      d u   =   - 1 12 1 s d s + 1 6 1 u + 1 d u - 1 6 1 u - 1 d u + 1 12 1 u - 2 d u + cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) d x The   integral   of   1 s   is   log ( s )   =   - log ( s ) 12 + 1 6 1 u + 1 d u - 1 6 1 u - 1 d u + 1 12 1 u - 2 d u + cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) d x For   the   integrand   1 u + 1   substitute   p = u + 1   and   d p =      d u   =   - log ( s ) 12 + 1 6 1 p d p - 1 6 1 u - 1 d u + 1 12 1 u - 2 d u + cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) d x The   integral   of   1 p   is   log ( p )   =   log ( p ) 6 - log ( s ) 12 - 1 6 1 u - 1 d u + 1 12 1 u - 2 d u + cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) d x For   the   integrand   1 u - 1   substitute   w = u - 1   and   d w =      d u   =   log ( p ) 6 - log ( s ) 12 - 1 6 1 w d w + 1 12 1 u - 2 d u + cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) d x The   integral   of   1 w   is   log ( w )   =   log ( p ) 6 - log ( s ) 12 - log ( w ) 6 + 1 12 1 u - 2 d u + cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) d x For   the   integrand   1 u - 2   substitute   v = u - 2   and   d v =      d u   =   log ( p ) 6 - log ( s ) 12 - log ( w ) 6 + 1 12 1 v d v + cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) d x The   integral   of   1 v   is   log ( v )   =   log ( p ) 6 - log ( s ) 12 + log ( v ) 12 - log ( w ) 6 + cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x ) d x ⁠  Multiply   numerator   and   denominator   of   cos 2 ( x ) cos 3 ( x ) - 3 sin 2 ( x ) cos ( x )   by   - csc 2 ( x ) sec ( x )   =   log ( p ) 6 - log ( s ) 12 + log ( v ) 12 - log ( w ) 6 + - cot ( x ) csc ( x ) 3 - cot 2 ( x ) d x ⁠  Prepare   to   substitute   z 1 = csc ( x )   Rewrite   - cot ( x ) csc ( x ) 3 - cot 2 ( x )   using   cot 2 ( x ) = csc 2 ( x ) - 1   =   log ( p ) 6 - log ( s ) 12 + log ( v ) 12 - log ( w ) 6 + - cot ( x ) csc ( x ) 4 - csc 2 ( x ) d x For   the   integrand   - cot ( x ) csc ( x ) 4 - csc 2 ( x )   substitute   z 1 = csc ( x )   and   d z 1 = - cot ( x ) csc ( x )    d x   =   log ( p ) 6 - log ( s ) 12 + log ( v ) 12 - log ( w ) 6 + 1 4 - z 1 2 d z 1 Factor   4   from   the   denominator:    =   log ( p ) 6 - log ( s ) 12 + log ( v ) 12 - log ( w ) 6 + 1 4 ( 1 - z 1 2 4 ) d z 1 Factor   out   constants:    =   log ( p ) 6 - log ( s ) 12 + log ( v ) 12 - log ( w ) 6 + 1 4 1 1 - z 1 2 4 d z 1 For   the   integrand   1 1 - z 1 2 4   substitute   z 2 = z 1 2   and   d z 2 = 1 2    d z 1   =   log ( p ) 6 - log ( s ) 12 + log ( v ) 12 - log ( w ) 6 + 1 2 1 1 - z 2 2 d z 2 The   integral   of   1 1 - z 2 2   is   tanh - 1 ( z 2 )   =   log ( p ) 6 - log ( s ) 12 + log ( v ) 12 - log ( w ) 6 + 1 2 tanh - 1 ( z 2 ) + constant  Substitute   back   for   z 2 = z 1 2   =   log ( p ) 6 - log ( s ) 12 + log ( v ) 12 - log ( w ) 6 + 1 2 tanh - 1 ( z 1 2 ) + constant  Substitute   back   for   z 1 = csc ( x )   =   log ( p ) 6 - log ( s ) 12 + log ( v ) 12 - log ( w ) 6 + 1 2 coth - 1 ( 2 sin ( x ) ) + constant  Substitute   back   for   v = u - 2   =   log ( p ) 6 - log ( s ) 12 + 1 12 log ( u - 2 ) - log ( w ) 6 + 1 2 coth - 1 ( 2 sin ( x ) ) + constant  Substitute   back   for   w = u - 1   =   log ( p ) 6 - log ( s ) 12 + 1 12 log ( u - 2 ) - 1 6 log ( u - 1 ) + 1 2 coth - 1 ( 2 sin ( x ) ) + constant  Substitute   back   for   p = u + 1   =   - log ( s ) 12 + 1 12 log ( u - 2 ) - 1 6 log ( u - 1 ) + 1 6 log ( u + 1 ) + 1 2 coth - 1 ( 2 sin ( x ) ) + constant  Substitute   back   for   s = u + 2   =   1 12 log ( u - 2 ) - 1 6 log ( u - 1 ) + 1 6 log ( u + 1 ) - 1 12 log ( u + 2 ) + 1 2 coth - 1 ( 2 sin ( x ) ) + constant  Substitute   back   for   u = csc ( x )   =   1 12 log ( csc ( x ) - 2 ) - 1 6 log ( csc ( x ) - 1 ) + 1 6 log ( csc ( x ) + 1 ) - 1 12 log ( csc ( x ) + 2 ) + 1 2 coth - 1 ( 2 sin ( x ) ) + constant  Factor   the   answer   a   different   way:    =   1 12 ( log ( csc ( x ) - 2 ) - 2 log ( csc ( x ) - 1 ) + 2 log ( csc ( x ) + 1 ) - log ( csc ( x ) + 2 ) + 6 coth - 1 ( 2 sin ( x ) ) ) + constant  An   alternative   form   of   the   integral   is:    =   1 12 ( log ( csc ( x ) - 2 csc ( x ) + 2 ) + 6 coth - 1 ( 2 sin ( x ) ) + 4 coth - 1 ( csc ( x ) ) ) + constant