Question

$$\int \frac{1}{1 + \sec(x/2)} \mathop{dx}$$

I'm not sure how to go about this. I've tried to integrate it, and differentiating to check the answer, but I'm not sure if I've messed up the integration or the differentiation. And using CAS hasn't helped much, as perhaps they're giving it in a different form.

Working

Let $u = x/2,$ then $2 \cdot \mathop{du} = \mathop{dx}$ giving $2 \cdot \int \frac{1}{1 + \sec(u)} \mathop{dx}$.

Rearrange into terms of $\cos$ rather than $\sec$. Then multiply through by $\frac{1 - \cos(u)}{1 - \cos(u)}$.

This gives

\begin{equation*} \begin{aligned} 2 \cdot \int \frac{\cos(u) - \cos^2(u)}{1 - \cos^2(u)} \mathop{du} &= 2 \cdot \int \frac{\cos(u) - \cos^2(u)}{\sin^2 u} \mathop{du} \\ &= 2 \cdot \int \frac{\cos(u) }{\sin^2 u} \mathop{du} + 2 \cdot \int \frac{- \cos^2(u)}{\sin^2 u} \mathop{du} \\ &= 2 \cdot \int \frac{\cos(u) }{\sin^2 u} \mathop{du} + 2 \cdot \int - \cot^2 u \mathop{du} \\ &= 2 \cdot \int \frac{\cos(u) }{\sin^2 u} \mathop{du} + 2 \cdot \int (1 - \csc^2 u) \mathop{du} \\ &= 2 \cdot \int \frac{\cos(u) }{\sin^2 u} \mathop{du} + 2 \cdot \int \mathop{du} + 2 \cdot \int - \csc^2 u \mathop{du} \end{aligned} \end{equation*}

Looking at $2 \cdot \int \frac{\cos(u) }{\sin^2 u} \mathop{du}$, let $k = \sin u$ then $\frac{dk}{\cos u } = du$ and this gives

\begin{equation*} \begin{aligned} 2 \cdot \int \frac{\cos(u) }{\sin^2 u} \mathop{du} &= 2 \cdot \int \frac{\cos(u) }{k^2} \cdot \frac{1}{\cos u} \mathop{dk} \\ &= 2 \cdot \int \frac{ 1}{k^2} \mathop{dk} \\ &= 2 \cdot \int \frac{ 1}{k^2} \mathop{dk} \\ &= - 2 k^{-1} + C_1 \end{aligned} \end{equation*}

The other integrals are standard, giving

\begin{equation*} \begin{aligned} \int \frac{1}{1 + \sec(x/2)} \mathop{dx} &= 2 \cdot \int \frac{\cos(u) }{\sin^2 u} \mathop{du} + 2 \cdot \int \mathop{du} + 2 \cdot \int - \csc^2 u \mathop{du} \\ &= -2k^{-1} + 2 u - 2 \cdot \int \csc^2 u \mathop{du} \\ &= -2k^{-1} + 2 u - 2 \cot(u) + C_2 \end{aligned} \end{equation*}

Then subbing back in for $k,u$

\begin{equation*} \begin{aligned} -2k^{-1} + 2 u - 2 \cot(u) + C_2 &= -(\sin u)^{-1} + 2 u - 2 \cot(u) + C_2 \\ &= -(\sin (x/2))^{-1} + 2 (x/2) - 2 \cot((x/2)) + C_2 \end{aligned} \end{equation*}

Here is a simple (as I think) solution:-

$$\int \dfrac{1}{1 + \sec\left( \frac{x}{2} \right)} dx = \int \dfrac{\cos \left( \frac{x}{2} \right)}{1 + \cos \left( \frac{x}{2} \right)} dx$$ $$= \int \dfrac{1 + \cos \left( \frac{x}{2} \right) - 1}{1 + \cos \left( \frac{x}{2} \right)} dx$$ $$= \int dx - \int \dfrac{1}{2 \cos^2\left( \frac{x}{4} \right)} dx$$ $$= x - 2\tan \left( \dfrac{x}{4} \right) + c$$

Now, if you differentiate it properly, you will get the question back!

• @Lai: Thank you! I have changed the post. Jan 25, 2022 at 3:56

Write $$\frac{\cos\frac{x}{2}}{1+\cos\frac{x}{2}}=1-\frac{1}{1+\cos\frac{x}{2}}$$

If you want a relatively shorter way we have our integral as $I=\int \frac {\cos (u)}{1+\cos (u)}du$ adding and subtracting one we have $I=\int (1-\frac {1}{1+\cos (u)})du$ using double angle formulae. We have $I=\int (1-\frac {\sec^2 (\frac {u}{2})}{2})=u-\tan (\frac {u}{2})+C$

\begin{aligned} \because \int \frac{d \theta}{1+\sec \theta} =& \int \frac{\sec \theta-1}{\tan ^{2} \theta} d \theta \\ =&\int \csc \theta \cot \theta d\theta-\int\left(\csc ^{2} \theta-1\right) d \theta \\ =&-\csc \theta+\cot ^{2} \theta+\theta+c . \end{aligned}

$$\therefore \int \frac{d x}{1+\sec \left(\frac{x}{2}\right)}=2\left[-\csc \left(\frac{x}{2}\right)+\cot ^{2}\left(\frac{x}{2}\right)\right]+x+C$$