# 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*}

## 3 Answers

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}{4} \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!

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$