# "We want to look at the integral:" #
# \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad int \ sqrt{ tan(x) } \ dx. #
# "When someone asked me this many years ago, a substitution" #
# "occurred to me then, and resolved the situation, without too" #
# "much difficulty. The calculus was fairly direct; there was some" #
# "post-calculus algebra that supeficially appeared complex, but" #
# "structurally was not. Later, I found that slightly adjusting" #
# "this substitution eliminates some of the superficial complexity" #
# "of the algebra involved with the simplification."#
# "The substitution I originally used was:" \qquad u \ = \ sqrt{ tan(x) }; #
# "The one I found to be a bit better is:" \qquad \qquad u \ = \ sqrt{ 2 tan(x) }. #
# "So, let's go ahead with this substitution:" \qquad \ u \ = \ sqrt{ 2 tan(x) }. #
# "1) Let:" \qquad \qquad \qquad \qquad u \ = \ sqrt{ 2 tan(x) }. \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \quad \ \ \ (I) #
# "2) So:" \qquad \qquad \qquad \qquad du = { sec^2(x) } / { sqrt{ 2 tan(x) } } \ dx. #
# "3) Thus:" \qquad \qquad \qquad dx = { sqrt{ 2 tan(x) } } / { sec^2(x) } \ du. #
# "4) So, we begin (!!):" #
# \qquad \qquad \quad int \ sqrt{ tan(x) } \ dx #
# \qquad \qquad \qquad \qquad \qquad \quad = \ int \ sqrt{ tan(x) } cdot { sqrt{ 2 tan(x) } } / { sec^2(x) } \ du #
# \qquad \qquad \qquad \qquad \qquad \quad = \ sqrt{ 2 } int \ tan(x) / sec^2(x) \ du #
# \qquad \qquad \qquad \qquad \qquad \quad = \ sqrt{ 2 } \int \ tan(x) /{ 1 + tan^2(x) } \ du #
# \qquad \qquad \qquad \qquad \qquad \quad = \ sqrt{ 2 } \int \ { 1/2 u^2 } /{ 1 + 1/4 u^4 } \ du \qquad \qquad \qquad [ "as" \ \tan(x) \ = \ 1/2 u^2 ] #
# \qquad \qquad \qquad \qquad \qquad \quad = \ sqrt{ 2 } \int \ 4/4 cdot { 1/2 u^2 } /{ 1 + 1/4 u^4 } \ du #
# \qquad \qquad \qquad \qquad \qquad \quad = \ 2 sqrt{ 2 } \int \ u^2/{ 4 + u^4 } \ du. #
# \qquad \qquad :. \qquad \qquad int \ sqrt{ tan(x) } \ dx \ = \ 2 sqrt{ 2 } \int \ u^2/{ 4 + u^4 } \ du. \qquad \qquad \qquad \ (II) #
# "At this point, the essential calculus is over. The remaining" #
# "calculus is the method of partial fractions -- deterministic." #
# "Any complexity from this point on -- superficial or structural," #
# "is purely algebraic, and not analytic." #
# "5) Expand integrand into partial fractions:" #
# \qquad "a) Factor denominator:" #
# \qquad \qquad \qquad \qquad \qquad \quad u^4 + 4 \ = \ u^4 + 4 u^2 + 4 - 4 u^2 #
# \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \quad = \ ( u^2 + 2 )^2 - ( 2 u )^2 #
# \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \quad = \ [ u^2 + 2 - 2 u ] cdot [ u^2 + 2 + 2 u ] #
# \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \quad = \ [ u^2 - 2 u + 2 ] cdot [ u^2 + 2 u + 2 ]. #
# \qquad \qquad "Can tell the two factors on the RHS of the previous are" #
# "irreducible over" \ \ RR, "because their discriminants are both" #
# "negative. So:" #
# \qquad \qquad "Factorization of denominator, over" \ RR: #
# \qquad \qquad \qquad \qquad \quad \ u^4 + 4 \ = \
( u^2 - 2 u + 2 ) ( u^2 + 2 u + 2 ). #
# \qquad "b) Partial Fraction Decomposition of integrand:" #
# \qquad \qquad \qquad \qquad \ u^2/{ 4 + u^4 } \ = \
{ a u + b }/{ u^2 - 2 u + 2 } + { c u + d }/{ u^2 + 2 u + 2 }. #
# \qquad \qquad "Using the standard technique of clearing the" #
# "polynomial fractions, and equating coefficients of like powers" #
# "of" \ \ u \ \ "in the resulting equality of polynomials, and solving" #
# "the resulting linear system for" \ \ a, b, c, d \ \ "we find:" #
# \qquad \qquad \qquad a = 1/4 \qquad \qquad b = 0 \qquad \qquad c = -1/4 \qquad \qquad d = 0. #
# "[These values can easily be checked in the decomposition" #
# "equality above -- almost by eye alone !]" #
# \qquad \qquad "So, the partial fraction decomposition of the integrand is:" #
# \qquad \qquad \qquad u^2/{ 4 + u^4 } \ = \ 1/4
( u/{ u^2 - 2 u + 2 } - u/( u^2 + 2 u + 2 ) ). #
# "6) Completion of Integration:" #
# \qquad \qquad "Now we complete the integration, following from the" #
# "partial fraction decomposition, using the standard technique of" #
# "adjusting the polynomial fractions there, to set up a ln part," #
# "and an arctan part:" #
# \qquad \qquad \qquad u^2/{ 4 + u^4 } \ = \ 1/4
( u/{ u^2 - 2 u + 2 } - u/{ u^2 + 2 u + 2 } )#
# \qquad \qquad \qquad \qquad \qquad \qquad \quad = \ 1/4 cdot 1/2
( { 2 u }/{ u^2 - 2 u + 2 } - { 2 u }/{ u^2 + 2 u + 2 } )#
# \qquad \qquad \qquad \qquad \qquad \qquad \quad = \ 1/8 ( { 2 u - 2 + 2 }/{ u^2 - 2 u + 2 } - { 2 u + 2 - 2 }/{ u^2 + 2 u + 2 } )#
# \qquad \qquad \qquad \qquad \qquad \qquad \quad = \ 1/8 ( { 2 u - 2 }/{ u^2 - 2 u + 2 } + { 2 }/{ u^2 - 2 u + 2 } #
# \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \ - { 2 u + 2 }/{ u^2 + 2 u + 2 } + { 2 }/{ u^2 + 2 u + 2 } ) #
#\qquad \qquad \qquad \qquad \qquad \qquad \quad = \ 1/8
( { 2 u - 2 }/{ u^2 - 2 u + 2 } + { 2 }/{ ( u - 1 )^2 + 1 } #
# \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad - { 2 u + 2 }/{ u^2 + 2 u + 2 } + { 2 }/{ ( u + 1 )^2 + 1 } ) #
# \qquad \qquad \qquad \qquad \qquad \qquad \quad = \ 1/8
( \underbrace{ { 2 u - 2 }/{ u^2 - 2 u + 2 } - { 2 u + 2 }/{ u^2 + 2 u + 2 }}_{ "ln part"} #
# \qquad \qquad \qquad \qquad \qquad \qquad \qquad + \underbrace{ { 2 }/{ ( u - 1 )^2 + 1 }+ { 2 }/{ ( u + 1 )^2 + 1 } }_{ "arctan part"} ). \qquad \qquad (III) #
# \qquad \qquad "Now by (II), and (III), we have, altogether:" #
# \ int \ sqrt{ tan(x) } \ dx \ = \ 2 \sqrt{ 2 } \int \ u^2/{ 4 + u^4 } \ du #
# \qquad \qquad \qquad \qquad \qquad \qquad \quad = \ 2 \sqrt{ 2 } int \ 1/8
( { 2 u - 2 }/{ u^2 - 2 u + 2 } - { 2 u + 2 }/{ u^2 + 2 u + 2 } #
# \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \ \ + { 2 }/{ ( u - 1 )^2 + 1 }+ { 2 }/{ ( u + 1 )^2 + 1 } ) \ du #
# \qquad \qquad \qquad \qquad \qquad \qquad \quad = \ { 2 \sqrt{ 2 } }/8 int \
( { 2 u - 2 }/{ u^2 - 2 u + 2 } - { 2 u + 2 }/{ u^2 + 2 u + 2 } #
# \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \ \ + { 2 }/{ ( u - 1 )^2 + 1 }+ { 2 }/{ ( u + 1 )^2 + 1 } ) \ du #
# \qquad \qquad \qquad \qquad \qquad \qquad \quad = \ \sqrt{ 2 }/4
( ln| u^2 - 2 u + 2 | - ln | u^2 + 2 u + 2 | #
# \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \ +2 arctan( u - 1 )+ 2 arctan( u + 1 ) )+ C #
# = \ \sqrt{ 2 }/4
( ln| { u^2 - 2 u + 2 }/{ u^2 + 2 u + 2 } | + 2 arctan[ { ( u - 1 ) + ( u + 1 ) }/{ 1 - ( u - 1 )( u + 1 ) } ] ) + C #
# = \ \sqrt{ 2 }/4
( ln| { u^2 - 2 u + 2 }/{ u^2 + 2 u + 2 } | + 2 arctan( { 2 u }/{ 2 - u^2 } ) )+ C #
# \qquad \qquad \qquad \qquad \qquad [ \ "as, by (I):" \quad u = \sqrt{ 2 tan(x) } \qquad rArr \qquad ] #
# = \sqrt{ 2 }/4
[ ln| { 2 tan x - 2 \sqrt{ 2 tan x } + 2 }/{ 2 tan x + 2 \sqrt{ 2 tan x } + 2} | + 2 arctan( { 2 \sqrt{ 2 tan x } }/{ 2 - 2 tan x } ) ] + C #
# = \sqrt{ 2 }/4
[ ln| { tan x - \sqrt{ 2 tan x } + 1 }/{ tan x + \sqrt{ 2 tan x } + 1 } | + 2 arctan( { \sqrt{ 2 tan x } }/{ 1 - tan x } ) ] + C. #
# \qquad \qquad "So, we now have here:" #
# \ int \ sqrt{ tan(x) } \ dx \ = #
# = \ \ \sqrt{ 2 }/4
( ln| { tan x - \sqrt{ 2 tan x } + 1 }/{ tan x + \sqrt{ 2 tan x } + 1 } | + 2 arctan( { \sqrt{ 2 tan x } }/{ 1 - tan x } ) ) + C. #
# "This is the desired result. " \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \ square #