Find the following integral: $\int {{{1 + \sin x} \over {\cos x}}dx} $ My attempt:
$\int {{{1 + \sin x} \over {\cos x}}dx} $,
given : $u = \sin x$
I use the general rule:
$\eqalign{
  & \int {f(x)dx = \int {f\left[ {g(u)} \right]{{dx} \over {du}}du} }   \cr 
  & {{du} \over {dx}} = \cos x  \cr 
  & {{dx} \over {du}} = {1 \over {\cos x}}  \cr 
  & so:  \cr 
  & \int {{{1 + \sin x} \over {\cos x}}dx = \int {{{1 + u} \over {\cos x}}{1 \over {\cos x}}du} }   \cr 
  &  = \int {{{1 + u} \over {{{\cos }^2}x}}du}   \cr 
  &  = \int {{{1 + u} \over {\sqrt {1 - {u^2}} }}du}   \cr 
  &  = \int {{{1 + u} \over {{{(1 - {u^2})}^{{1 \over 2}}}}}du}   \cr 
  &  = \int {(1 + u){{(1 - {u^2})}^{ - {1 \over 2}}}} du  \cr 
  &  = {(1 - u)^{ - {1 \over 2}}} + u{(1 - {u^2})^{ - {1 \over 2}}}du  \cr 
  &  = {1 \over {({1 \over 2})}}{(1 - u)^{{1 \over 2}}} + u - {1 \over {\left( {{1 \over 2}} \right)}}{(1 - {u^2})^{{1 \over 2}}} + C  \cr 
  &  = 2{(1 - u)^{{1 \over 2}}} - 2u{(1 - {u^2})^{{1 \over 2}}} + C  \cr 
  &  = 2{(1 - \sin x)^{{1 \over 2}}} - 2(\sin x){(1 - {\sin ^2}x)^{{1 \over 2}}} + C  \cr 
  &  = {(1 - \sin x)^{{1 \over 2}}}(2 - 2\sin x) + C \cr} $
This is wrong, the answer in the book is:
$y =  - \ln |1 - \sin x| + C$
Could someone please explain where I integrated wrongly?
Thank you!
 A: Do this:
$    \int { \frac { 1+\sin { x }  }{ \cos { x }  } dx } =\int { \frac { \left( 1+\sin { x }  \right) \left( 1-\sin { x }  \right)  }{ \cos { x } \left( 1-\sin { x }  \right)  } dx= } \int { \frac { \cos { x }  }{ \left( 1-\sin { x }  \right)  }  } dx$
Then do the substitution rule
$\left( 1-\sin { x }  \right) =u$
A: You replaced $\cos^2 x$ by $\sqrt{1-u^2}$, it should be $1-u^2$.
Remark: It is easier to multiply top and bottom by $1-\sin x$. Then we are integrating $\frac{\cos x}{1-\sin x}$, easy. 
A: Split the fraction, you get to integrate secx and tanx. Standard
A: Another approach (this is essentially the same as your $u=\sin(x)$ subsitution)
$$
\begin{align}
\int\frac{1+\sin(x)}{\cos(x)}\,\mathrm{d}x
&=\int\frac{1+\sin(x)}{\cos^2(x)}\,\mathrm{d}\sin(x)\\
&=\int\frac{1+\sin(x)}{1-\sin^2(x)}\,\mathrm{d}\sin(x)\\
&=\int\frac{\mathrm{d}\sin(x)}{1-\sin(x)}\\
&=-\log(1-\sin(x))+C
\end{align}
$$
A: There's an easier way:
$$
I = \int \frac{(1+\sin x)dx}{\cos x} = \int \frac{(1-\sin ^2 x)dx}{\cos x(1-\sin x)}=\int \frac{\cos x dx}{(1-\sin x)} = -\int \frac{d (1-\sin x)}{1-\sin x}
$$
Denote $1-\sin x=t$ to get 
$$
I=-\log |1-\sin x|+C_1
$$
A: $$\int{(\frac {1}{\cos x}}+{\frac {\sin x}{\cos x})}dx$$
$$\int {(\sec x + \tan x)dx}$$
$$\int {\sec x dx} +\int {\tan x dx}$$
$$\log |(\sec x + \tan x)| - \log |\cos x|+C$$
$$ \log \frac{ |(\sec x + \tan x)|}{|\cos x|}+C$$
 from here you can get different version of answer.
