Maxwell-Boltzmann Statistics

From here, we continue to consider the problem of distributing $N$ particles into $K$ boxes. Assume that the probability of a particle going into box $i$ is the same as the probability of a particle going into box $j$ for all $i,j$, i.e. we assume the equal probability for the distribution of a single particle going into a box. Let us call it $p$. Then the probability of distributing $n_1$ particles in box 1, $n_2$ particles in box 2, …, $n_K$ particles in box $K$ is
\begin{equation}
\begin{aligned}
p&=N!\prod_{i=1}^K\frac{1}{n_i!}p^{n_1}p^{n_2}\cdots p^{n_K}\\
&=N!\prod_{i=1}^K\frac{1}{n_i!}p^N
\end{aligned}\label{eq:maxwell-boltzmann}
\end{equation}
We want to find the distribution of particles into different boxes by maximizing the probability \eqref{eq:maxwell-boltzmann}. Since $p^N$ is constant, maximizing the probability is the same as maximizing $W:=N!\prod_{i=1}^K\frac{1}{n_i!}$. Boltzmann defined entropy corresponding to a distribution of particles by
$$S=k\log W$$
where $k$ is the Boltzmann constant. By Sterling’s formula, we can write $S$ as
$$S\approx k[N\log N-N-\sum_i(n_i\log n_i-n_i)]$$
We are going to neglect $N\log N -N$ from this entropy, so the form of entropy we are considering is
\begin{equation}
\label{eq:maxwell-boltzmann2}
S\approx -k\sum_i(n_i\log n_i-n_i)
\end{equation}
This amounts to dropping $N!$ from $W$. The reason for this mysterious step is to avoid the so-called Gibbs paradox. For details about Gibbs paradox see, for example, [1] of the references at the end of this note.
Let $\epsilon_i$ denote the single particle energy. We have two conservative quantities that we want to keep fixed: the particle number $N=\sum_i n_i$ and the energy $U=\sum_i n_i\epsilon_i$. So, we add the terms of these constraints to $S$:
$$S\approx k[-\sum_i(n_i\log n_i-n_i)]+\beta(U-\sum_i n_i\epsilon_i)-\beta\mu (N-\sum_i n_i)$$
$\frac{\partial S}{\partial n_i}=0$ results in the critical point $n_i=e^{-\beta(\epsilon_i-\mu)}$. This is the value at which the probability and entropy assume a maximum. This is called the Maxwell-Boltzmann distribution.
From the constraints, we obtain
\begin{align*} N&=\sum_i e^{-\beta(\epsilon_i-\mu)}\\ U&=\sum_i \epsilon_ie^{-\beta(\epsilon_i-\mu)} \end{align*}
Substituting $n_i=e^{-\beta(\epsilon_i-\mu)}$ in \eqref{eq:maxwell-boltzmann2}, the value of the entropy at the maximum is given by
\begin{equation}
\begin{aligned}
S&\approx k[\beta\sum_i\epsilon_i e^{-\beta(\epsilon_i-\mu)}-\beta\mu\sum_i e^{-\beta(\epsilon_i-\mu)}+\sum_i e^{-\beta(\epsilon_i-\mu)}]\\
&=k[\beta U-\beta\mu N+N]
\end{aligned}\label{eq:maxwell-boltzmann3}
\end{equation}
We are going to determine $\mu$ and $\beta$. The single particle kinetic energy is $\epsilon=\frac{p^2}{2m}$. The summation covers all possible states of each particle. This means that we may replace the summation by an integration over momentum and position:
$$N\to e^{\beta\mu}\int d^3xd^3p e^{-\beta\frac{p^2}{2m}},\ U\to e^{\mu\beta}\int d^3xd^3p \frac{p^2}{2m}e^{-\beta\frac{p^2}{2m}}$$
However, note that the number of states cannot be given only by $d^3x d^3p$ because of its dimension. To make it dimensionless, we make the following quantum mechanical correction:
\begin{equation}
\label{eq:maxwell-boltzmann4}
\frac{d^3x d^3p}{h^3}=\frac{d^3 xd^3p}{(2\pi\hbar)^3}
\end{equation}
Recall that the Planck constant $h$ has the dimension length$\times$momentum.
\begin{equation}
\begin{aligned}
N&=\frac{e^{\beta\mu}}{h^3}\int d^3xd^3p e^{-\beta\frac{p^2}{2m}}\\
&=\frac{e^{\beta\mu}}{h^3}V\left(\frac{2m\pi}{\beta}\right)^{\frac{3}{2}},\\
U&=\frac{e^{\beta\mu}}{h^3}\int d^3xd^3p \frac{p^2}{2m}e^{-\beta\frac{p^2}{2m}}\\
&=\frac{e^{\beta\mu}}{h^3}V\frac{3}{2\beta}\left(\frac{2m\pi}{\beta}\right)^{\frac{3}{2}}
\end{aligned}\label{eq:maxwell-boltzmann5}
\end{equation}
For some details about Gaussian integrals, see here. From \eqref{eq:maxwell-boltzmann5}, we obtain
\begin{align*} \beta&=\frac{3N}{2U},\\ \beta\mu&=\log\left[\frac{Nh^3}{V}\left(\frac{\beta}{2\pi m}\right)^{\frac{3}{2}}\right]=\log\left[\frac{Nh^3}{V}\left(\frac{3N}{4\pi mU}\right)^{\frac{3}{2}}\right] \end{align*}
Consequently, the entropy in \eqref{eq:maxwell-boltzmann3} can be written as
\begin{equation}
\label{eq:maxwell-boltzmann6}
S=kN\left[\frac{5}{2}+\log\left(\frac{V}{N}\right)+\frac{3}{2}\log\left(\frac{U}{N}\right)+\frac{3}{2}\log\left(\frac{4\pi m}{3h^2}\right)\right]
\end{equation}
\eqref{eq:maxwell-boltzmann6} is known in statistical mechanics as the Sackur-Tetrode formula for the entropy of a classical ideal gas (we will soon see its relationship with an ideal gas). According to the Huang’s book [1], this formula has been experimentally verified as the correct entropy of an ideal gas at high temperatures.

Differentiating $S$ in \eqref{eq:maxwell-boltzmann6}, we obtain
\begin{align*} dU&=\frac{\partial U}{\partial S}dS-\frac{\partial U}{\partial S}\frac{\partial S}{\partial N}dN-\frac{\partial U}{\partial S}\frac{\partial S}{\partial V}dV\\ &=\frac{1}{k\beta}dS-\frac{NkT}{V}+\mu dN \end{align*}
Comparing this with
$$dU=TdS-pdV+\mu dN$$ from the first law of thermodynamics, we have
\begin{align*} \beta&=\frac{1}{kT},\\ p&=\frac{NkT}{V} \end{align*}
The second equation is the well-known ideal gas equation of state. The chemical potential $\mu$ and the internal energy $U$ can be expressed as functions of the temperature $T$ as
\begin{align*} \mu&=kT\log\left[\frac{h^3N}{V}\frac{1}{(2\pi mkT)^{\frac{3}{2}}}\right],\\ U&=\frac{3}{2}NkT \end{align*}

References:

  1. Kerson Huang, Statistical Mechanics, John Wiley & Sons, 1987
  2. V. P. Nair, Lectures on Thermodynamics and Statistical Mechanics

Solving a bound state Schrödinger equation in momentum space for a delta potential in position space

In this note, we first obtain Schrödinger equation in momentum space and then solve a bound state problem with delta potential in position space. This is based on what I learned from my friend and a physicist Khin Maung. Let us begin with eigenstate Schrödinger equation
$$\hat H|\psi\rangle=E|\psi\rangle$$
with
$$\hat H=\frac{\hat p^2}{2m}+\hat V$$
in position space. As we will see Schrödinger equation in momentum space becomes an integral equation, while Schrödinger equation in position space is a differential equation.
Before we continue, here is the list of a few things we need for our discussion.

  • The completeness: $1=\int |p\rangle\langle p|dp$, $1=\int |x\rangle\langle x|dx$.
  • Eigenvalue equations: \begin{align*} \hat p|p’\rangle&=p’|p’\rangle\\ \hat x|x’\rangle&=x’|x’\rangle \end{align*}
  • $\langle p|p’\rangle=\delta(p’-p)$, $\langle x|x’\rangle=\delta(x’-x)$.
  • $\langle p|x\rangle=\frac{e^{-\frac{i}{\hbar}px}}{\sqrt{2\pi\hbar}}$, $\langle x|p’\rangle=\frac{e^{\frac{i}{\hbar}p’x}}{\sqrt{2\pi\hbar}}$.

Details about these can be found in any standard quantum mechanics textbook, particularly in the chapter about quantum systems with continuous spectra.

Using the completeness, we have
$$\int\left(\frac{\hat p^2}{2m}+\hat V\right)|p’\rangle\langle p’|\psi\rangle dp’=E|\psi\rangle$$
and
\begin{equation}
\label{eq:seq}
\int\langle p|\left(\frac{\hat p^2}{2m}+\hat V\right)|p’\rangle\tilde\psi(p’)dp’=E\tilde\psi(p)
\end{equation}
where $\tilde\psi(p)=\langle p|\psi\rangle$. Since $\hat p|p’\rangle=p’|p’\rangle$, $\hat p^2|p’\rangle=p’^2|p’\rangle$. So, \eqref{eq:seq} can be written as
\begin{equation}
\label{eq:seq2}
\int\langle p|p’\rangle\frac{p’^2}{2m}\tilde\psi(p’)dp’+\int\langle p|\hat V|p’\rangle\tilde\psi(p’)dp’=E\tilde\psi(p)
\end{equation}
The LHS of \eqref{eq:seq2} is then
$$\int\delta(p’-p)\frac{p’^2}{2m}\tilde\psi(p’)dp’+\int\langle p|\hat V|p’\rangle\tilde\psi(p’)dp’=\frac{p^2}{2m}\tilde\psi(p)+\int\langle p|\hat V|p’\rangle\tilde\psi(p’)dp’$$
Hence, we arrive at the one-dimensional Schrödinger equation in momentum space (or $p$-space)
\begin{equation}
\label{eq:seq3}
\frac{p^2}{2m}\tilde\psi(p)+\int\langle p|\hat V|p’\rangle\tilde\psi(p’)dp’=E\tilde\psi(p)
\end{equation}
\begin{align*} \langle p|\hat V|p’\rangle&=\langle p|I|\hat V|I|p’\rangle\\ &=\langle p|\int|x\rangle\langle x|dx|\hat V|\int|x’\rangle\langle x’|dx’|p’\rangle\\ &=\int\langle p|x\rangle\langle x|\hat V|x’\rangle\langle x’|p’\rangle dxdx’ \end{align*}
Since $\hat V$ is a scalar potential,
\begin{align*} \langle x|\hat V|x’\rangle&=\langle x|x’\rangle\hat V\\ &=\delta(x-x’)V(x) \end{align*}
So, we have
\begin{align*} \langle p|\hat V|p’\rangle&=\int\langle p|x\rangle\delta(x-x’)V(x)\langle x’|p’\rangle dx’dx\\ &=\int\langle p|x\rangle V(x)\langle x|p’\rangle dx\\ &=\int \frac{e^{-ipx}}{\sqrt{2\pi}}V(x)\frac{e^{ip’x}}{\sqrt{2\pi}}dx\ [\mbox{assuming}\ \hbar=1]\\ &=\frac{1}{2\pi}\int V(x)e^{i(p’-p)x}dx \end{align*}
If we want to keep $\hbar$, we have
$$\langle p|\hat V|p’\rangle=\frac{1}{2\pi\hbar}\int V(x) e^{\frac{i}{\hbar}(p’-p)x}dx$$

Now, we consider a special case of a delta potential
$$V(x)=-\delta(x)V_0$$
\begin{align*} \langle p|\hat V|p’\rangle&=\frac{1}{2\pi}\int_{-\infty}^\infty[-\delta(x)V_0e^{i(p’-p)x}]dx\\ &=-\frac{V_0}{2\pi} \end{align*}
The Schrödinger equation \eqref{eq:seq3} then becomes
\begin{equation}
\label{eq:seq4}
\left(\frac{p^2}{2m}-E\right)\tilde\psi(p)=\frac{V_0}{2\pi}\int_{-\infty}^\infty\tilde\psi(p’)dp’
\end{equation}
Note here that the bound state energy must be negative, so we assume that $E<0$. Let
$$A=\int_{-\infty}^\infty\tilde\psi(p’)dp’$$
Then \eqref{eq:seq4} can be written as
$$\tilde\psi(p)=\frac{V_0}{2\pi}\frac{A}{\frac{p^2}{2m}-E}$$
Integrating this with respect to $p$, we obtain
\begin{align*} 1&=\frac{V_0}{2\pi}\int_{-\infty}^\infty\frac{dp}{\frac{p^2}{2m}-E}\\ &=\frac{V_0}{2}\sqrt{\frac{2m}{-E}} \end{align*}
Hence, we find the bound state energy
\begin{equation}
\label{eq:bde}
E=-\frac{V_0^2m}{2}
\end{equation}
For $\hbar\ne 1$, we have
$$E=-\frac{V_0^2m}{2\hbar^2}$$
Recall that $\tilde\psi(p)$ has $A$ in it. $A$ can be found by normalizing $\tilde\psi(p)$.
$$1=\int_{-\infty}^\infty |\tilde\psi(p)|^2dp$$
Since
$$|\tilde\psi(p)|^2=\frac{V_0^2}{4\pi^2}\frac{|A|^2}{\left(\frac{p^2}{2m}-E\right)^2},$$
we have
\begin{equation}
\label{eq:sqe5}
1=\frac{V_0^2}{4\pi^2}|A|^2\int_{-\infty}^\infty\frac{dp}{\left(\frac{p^2}{2m}-E\right)^2}
\end{equation}
Let
$$I=\int_{-\infty}^\infty\frac{dp}{\left(\frac{p^2}{2m}-E\right)^2}=\sqrt{2m}\pi(-E)^{-\frac{1}{2}}$$
Then
$$\frac{\partial I}{\partial E}=\int_{-\infty}^\infty\frac{dp}{\left(\frac{p^2}{2m}-E\right)^2}=\sqrt{\frac{m}{2}}\pi(-E)^{-\frac{3}{2}}$$
Therefore, from \eqref{eq:sqe5} with \eqref{eq:bde}, we obtain
$$A=\sqrt{2\pi mV_0}e^{i\theta}$$
for some $\theta$.

Evaluating $\int\frac{dx}{\sqrt{x^2+a}+b}$

While back, I was calculating a physics problem involving an integral of the form
$$\int\frac{dx}{\sqrt{x^2+a}+b}$$
Naturally, one would begin with the trig substitution $x=a\tan\theta$. So, the integral can be written as
\begin{align*} \int\frac{dx}{\sqrt{x^2+a}+b}&=\int\frac{a\sec^2\theta d\theta}{a\sec\theta+b}\\ &=\frac{1}{a}\int\frac{a^2\sec^2\theta-b^2+b^2}{a\sec\theta+b}d\theta\\ &=\int\sec\theta d\theta-\frac{b}{a}\theta+\frac{b^2}{a}\int\frac{d\theta}{a\sec\theta+b}\\ &=\ln|\sec\theta+\tan\theta|-\frac{b}{\sqrt{b^2-a^2}}\ln\frac{\sqrt{b^2-a^2}\tan\left(\frac{\theta}{2}\right)+a+b}{\sqrt{b^2-a^2}\tan\left(\frac{\theta}{2}\right)-(a+b)}\\ &=\ln\left|\frac{\sqrt{x^2+a^2}+x}{a}\right|-\frac{b}{\sqrt{b^2-a^2}}\ln\left[\frac{\frac{\sqrt{b^2-a^2}x}{a+\sqrt{x^2+a^2}}+a+b}{\frac{\sqrt{b^2-a^2}x}{a+\sqrt{x^2+a^2}}-(a+b)}\right] \end{align*}
Here,
\begin{align*} \int\frac{d\theta}{a\sec\theta+b}&=\int\frac{\cos\theta d\theta}{a+b\cos\theta}\\ &=\frac{1}{b}\int d\theta-\frac{a}{b}\int\frac{d\theta}{a+b\cos\theta}\\ &=\frac{1}{b}\theta-\frac{a}{b}\frac{1}{\sqrt{b^2-a^2}}\ln\frac{\sqrt{b^2-a^2}\tan\left(\frac{\theta}{2}\right)+a+b}{\sqrt{b^2-a^2}\tan\left(\frac{\theta}{2}\right)-(a+b)} \end{align*}
For the evaluation of $\int\frac{d\theta}{a+b\cos\theta}$, I used the formula from here.

The Gaussian Integral

The Gaussian integral is not only important in mathematics but is also extremely important in studying physics, for example, quantum mechanics, quantum field theory, and statistical mechanics. Let us begin with the most simple Gaussian integral
$$G=\int_{-\infty}^\infty e^{-x^2}dx$$
This is not an easy integral to calculate but it can be done easily if we extend it to an integral in two-dimensions as
\begin{align*} G^2&=\int_{-\infty}^\infty e^{-x^2}dx\int_{-\infty}^\infty e^{-y^2}dy\\ &=\int_{-\infty}^\infty\int_{-\infty}^\infty e^{-(x^2+y^2)}dxdy \end{align*}
Now, in term of the polar coordinates, $x=r\cos\theta$, $y=r\sin\theta$ and the area element is $dA=rdrd\theta$, so $G^2$ can be written as
\begin{align*} G^2&=\int_0^{2\pi}\int_0^\infty re^{-r^2}drd\theta\\ &=\pi \end{align*}
The integral $\int_0^\infty re^{-r^2}dr$ can be easily evaluated using the substitution $u=-r^2$ and its value is $\frac{1}{2}$. Now, we obtain
$$G=\int_{-\infty}^\infty e^{-x^2}dx=\sqrt{\pi}$$
From this you can evaluate more complicated Gaussian integrals using a simple substitution and/or some algebra. For example, $\int_{-\infty}^\infty e^{-ax^2}dx$ for a positive real number $a$ can be evaluated easily by a simple substitution $u=\sqrt{a}x$:
\begin{equation}
\begin{aligned}
\int_{-\infty}^\infty e^{-ax^2}dx&=\frac{1}{\sqrt{a}}\int_{-\infty}^\infty e^{-u^2}du\\
&=\sqrt{\frac{\pi}{a}}
\end{aligned}\label{eq:gaussint}
\end{equation}
If $a=\frac{1}{2}$, then $\int_{-\infty}^\infty e^{-\frac{1}{2}x^2}dx=\sqrt{2\pi}$. Normally one will have to use the integration by parts to calculate $\int_{-\infty}^\infty x^2e^{-x^2}dx$ or $\int_{-\infty}^\infty x^4e^{-x^2}dx$. There is a neat trick of evaluating such integrals by differentiating \eqref{eq:gaussint} with respect to $a$:
$$\frac{d}{da}\int_{-\infty}^\infty e^{-ax^2}dx=-\int_{-\infty}^\infty x^2e^{-ax^2}dx$$
and
$$\frac{d}{da}\sqrt{\frac{\pi}{a}}=-\frac{1}{2a}\sqrt{\frac{\pi}{a}}$$
Thus, we have
\begin{equation}
\label{eq:gaussint2}
\int_{-\infty}^\infty x^2e^{-ax^2}dx=\frac{1}{2a}\sqrt{\frac{\pi}{a}}
\end{equation}
For $a=1$, we obtain
$$\int_{-\infty}^\infty x^2e^{-x^2}dx=\frac{\sqrt{\pi}}{2}$$
Differentiating \eqref{eq:gaussint2} with respect to $a$ leads to
\begin{equation}
\label{eq:gaussint3}
\int_{-\infty}^\infty x^4e^{-ax^2}dx=\frac{3}{4a^2}\sqrt{\frac{\pi}{a}}
\end{equation}
For $a=1$, we obtain
\begin{equation}
\label{eq:gaussint4}
\int_{-\infty}^\infty x^4e^{-x^2}dx=\frac{3}{4}\sqrt{\pi}
\end{equation}
I learned this trick from the book Quantum Field Theory in a Nutshell by Anthony Zee. Another important variation is
\begin{equation}
\label{eq:gaussint5}
\int_{-\infty}^\infty e^{-ax^2+bx}dx
\end{equation}
This integral can be evaluated from \eqref{eq:gaussint} with a little bit of algebra. First, by completing the square, we write
\begin{align*} -ax^2+bx&=-a\left(x^2-\frac{b}{a}x\right)\\ &=-a\left(x^2-\frac{b}{a}x+\left(-\frac{b}{2a}\right)^2-\left(-\frac{b}{2a}\right)^2\right)\\ &=-a\left(x-\frac{b}{2a}\right)^2+\frac{b^2}{4a} \end{align*}
Now, \eqref{eq:gaussint5} is evaluated as
\begin{align*} \int_{-\infty}^\infty e^{-ax^2+bx}dx&=\int_{-\infty}^\infty e^{-a\left(x-\frac{b}{2a}\right)^2+\frac{b^2}{4a}}dx\\ &=e^{\frac{b^2}{4a}}\int_{-\infty}^\infty e^{-a\left(x-\frac{b}{2a}\right)^2}dx\\ &=e^{\frac{b^2}{4a}}\int_{-\infty}^\infty e^{-au^2}du\ \left[u=x-\frac{b}{2a}\right]\\ &=e^{\frac{b^2}{4a}}\sqrt{\frac{\pi}{a}} \end{align*}

This time let us try to calculate
\begin{equation}
\label{eq:gaussint6}
\int_{-\infty}^\infty\int_{-\infty}^\infty\int_{-\infty}^\infty (x^2+y^2+z^2)e^{-(x^2+y^2+z^2)}dxdydz
\end{equation}
You stumble upon this type of integral, for example, in a derivation of the Maxwell-Boltzmann statistics in the form of
$$\int d^3p\frac{p^2}{2m}\exp\left(-\beta\frac{p^2}{2m}\right)$$
The integral \eqref{eq:gaussint6} can be easily evaluated using the spherical coordinates:
\begin{align*} x&=r\sin\theta\cos\phi\\ y&=r\sin\theta\sin\phi\\ z&=r\cos\theta\ \end{align*}
where
$$0\leq r<\infty,\ 0\leq\theta\leq\pi,\ 0\leq\theta\leq 2\pi$$
The volume element in the spherical coordinates is $dV=r^2dr\sin\theta d\theta d\phi$, so
\begin{align*} \int_{-\infty}^\infty\int_{-\infty}^\infty\int_{-\infty}^\infty (x^2+y^2+z^2)e^{-(x^2+y^2+z^2)}dxdydz&=\int_0^{2\pi}\int_0^\pi\int_0^\infty r^4e^{-r^2}dr\sin\theta d\theta d\phi\\&=\frac{3}{2}\pi\sqrt{\pi} \end{align*}
We obtain
$$\int_0^\infty r^4e^{-r^2}dr=\frac{3}{8}\sqrt{\pi}$$
using \eqref{eq:gaussint4}.

Evaluating $\int\frac{dx}{a+b\cos x}$ where $b^2>a^2$

One of my Ph.D. students, Victor Zankoni is reading the paper Relativistically corrected Schrödinger equation with Coulomb interaction by J. L. Friar and E. L. Tomusiak, Physical Review C, Volume 29, Number 4, 1537. Following their calculations, he stumbled upon an integral of the form
$$\int\frac{dx}{a+b\cos x}$$
where $b^2>a^2$. Thinking it may not be easy to calculate, I suggested him to look up the well-known book Tables of Integrals, Series, and Products by Gradshteyn and Ryzhik. He said he couldn’t find a relevant formula (actually there is and he somehow missed it) and instead he decided to calculate it. He used a clever substitution and it worked beautifully, so here I am introducing his calculation. First note the identity
$$\cos x=\frac{1-\tan^2\left(\frac{x}{2}\right)}{1+\tan^2\left(\frac{x}{2}\right)}$$
Here, I assume $a>0$ and $b>0$ but similar calculations can be carried out for other cases as well. With the above substitution, we have
\begin{align*} \int\frac{dx}{a+b\cos x}&=\int\frac{\sec^2\left(\frac{x}{2}\right)}{b+a-(b-a)\tan^2\left(\frac{x}{2}\right)}dx\\ &=\frac{2}{b-a}\int\frac{du}{\left(\sqrt{\frac{b+a}{b-a}}\right)^2-u^2}\\ &=\frac{1}{\sqrt{b^2-a^2}}\left[\int\frac{du}{\sqrt{\frac{b+a}{b-a}}+u}+\int\frac{du}{\sqrt{\frac{b+a}{b-a}}-u}\right]\\ &=\frac{1}{\sqrt{b^2-a^2}}\ln\frac{u+\sqrt{\frac{b+a}{b-a}}}{u-\sqrt{\frac{b+a}{b-a}}}\\ &=\frac{1}{\sqrt{b^2-a^2}}\ln\frac{\sqrt{b^2-a^2}u+a+b}{\sqrt{b^2-a^2}u-(a+b)}\\ &=\frac{1}{\sqrt{b^2-a^2}}\ln\frac{\sqrt{b^2-a^2}\tan\left(\frac{x}{2}\right)+a+b}{\sqrt{b^2-a^2}\tan\left(\frac{x}{2}\right)-(a+b)} \end{align*}
The last expression coincides with 2.553 #3 of Gradshteyn and Ryzhik, 8th Edition on page 172. Gradshteyn and Ryzhik 7th Edition does not contain this expression but one can find a supposedly equivalent expression in 2.553 #3 of the 7th Edition but unfortunately, it is stated incorrectly. It has been corrected in the 8th Edition and is listed as 2.553 #4:
$$\int\frac{dx}{a+b\cos x}=\frac{2}{\sqrt{b^2-a^2}}\ln\left|\frac{(b-a)\tan\left(\frac{x}{2}\right)+\sqrt{b^2-a^2}}{(b-a)\tan\left(\frac{x}{2}\right)-\sqrt{b^2-a^2}}\right|\ [b^2>a^2]$$
There is another incorrect formula that caught my eyes:
\begin{align*} \int\frac{dx}{a+b\cos x}&=\frac{2}{\sqrt{b^2-a^2}}\mathrm{arctanh}\left(\frac{(a-b)\tan\left(\frac{x}{2}\right)}{\sqrt{b^2-a^2}}\right)\ \left[b^2>a^2,\ \left|(b-a)\tan\left(\frac{x}{2}\right)\right|<\sqrt{b^2-a^2}\right]\\ &=\frac{2}{\sqrt{b^2-a^2}}\mathrm{arccoth}\left(\frac{(a-b)\tan\left(\frac{x}{2}\right)}{\sqrt{b^2-a^2}}\right)\ \left[b^2>a^2,\ \left|(b-a)\tan\left(\frac{x}{2}\right)\right|>\sqrt{b^2-a^2}\right] \end{align*}
in both 7th Edition and the 8th Edition. It should be corrected to
\begin{align*} \int\frac{dx}{a+b\cos x}&=\frac{2}{\sqrt{b^2-a^2}}\mathrm{arctanh}\left(\frac{(b-a)\tan\left(\frac{x}{2}\right)}{\sqrt{b^2-a^2}}\right)\ \left[b^2>a^2,\ \left|(b-a)\tan\left(\frac{x}{2}\right)\right|<\sqrt{b^2-a^2}\right]\\ &=\frac{2}{\sqrt{b^2-a^2}}\mathrm{arccoth}\left(\frac{(b-a)\tan\left(\frac{x}{2}\right)}{\sqrt{b^2-a^2}}\right)\ \left[b^2>a^2,\ \left|(b-a)\tan\left(\frac{x}{2}\right)\right|>\sqrt{b^2-a^2}\right] \end{align*}
I don’t use Gradshteyn and Ryzhik’s book much but I have heard that it contains numerous typos and mistakes. It appears to be true. So, please use it with caution when you do.